ci: upstream main van GitHub spiegelen naar upstream-master
@@ -0,0 +1,53 @@
1
# Upstream-volgbranch voor deze fork.
2
#
3
# Haalt branch `main` op van het oorspronkelijke project op GitHub en zet die
4
# geforceerd op branch `upstream-master` in deze repository. `upstream-master`
5
# is een pure volgbranch: lokale commits daarop worden overschreven.
6
#
7
# BlueGit kent (nog) geen geplande pipelines. Start deze pipeline handmatig
8
# (knop "Run pipeline" op master) of extern via
9
# POST /api/v1/projects/ict/rusty-teams/pipelines {"ref": "master"}
10
# Bij een gewone push of merge request draait er niets.
11
#
12
# Pushen gebeurt met het job-token van BlueGit (CI_JOB_TOKEN). Is daar een
13
# repositorygeheim UPSTREAM_PUSH_TOKEN ingesteld, dan wordt dat gebruikt.
14
# Zet nooit een token in deze (publieke) repository.
15
#
16
# De workflows in .github/ zijn voor GitHub Actions en worden door BlueGit
17
# genegeerd.
18
19
workflow:
20
rules:
21
- if: $CI_PIPELINE_SOURCE == "push"
22
when: never
23
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
24
when: never
25
- when: always
26
27
variables:
28
UPSTREAM_URL: "https://github.com/danieldaeschle/rusty-teams.git"
29
UPSTREAM_BRANCH: "main"
30
TARGET_BRANCH: "upstream-master"
31
32
sync-upstream:
33
stage: sync
34
image: bluegit/base
35
resource_group: upstream-sync
36
timeout: 15m
37
retry:
38
max: 1
39
when: runner_system_failure
40
script:
41
- |
42
set -eu
43
rm -rf /tmp/upstream
44
git init -q --bare /tmp/upstream
45
cd /tmp/upstream
46
git fetch --no-tags "$UPSTREAM_URL" "+refs/heads/$UPSTREAM_BRANCH:refs/heads/$UPSTREAM_BRANCH"
47
echo "Upstream $UPSTREAM_BRANCH staat op $(git rev-parse "refs/heads/$UPSTREAM_BRANCH")"
48
export PUSH_TOKEN="${UPSTREAM_PUSH_TOKEN:-$CI_JOB_TOKEN}"
49
git -c credential.helper= \
50
-c credential.helper='!f() { echo username=ci-job; echo "password=$PUSH_TOKEN"; }; f' \
51
push --force "$CI_PROJECT_URL.git" "refs/heads/$UPSTREAM_BRANCH:refs/heads/$TARGET_BRANCH"
52
53
stages: [sync]
@@ -0,0 +1,53 @@1
# Upstream-volgbranch voor deze fork.2
#3
# Haalt branch `main` op van het oorspronkelijke project op GitHub en zet die4
# geforceerd op branch `upstream-master` in deze repository. `upstream-master`5
# is een pure volgbranch: lokale commits daarop worden overschreven.6
#7
# BlueGit kent (nog) geen geplande pipelines. Start deze pipeline handmatig8
# (knop "Run pipeline" op master) of extern via9
# POST /api/v1/projects/ict/rusty-teams/pipelines {"ref": "master"}10
# Bij een gewone push of merge request draait er niets.11
#12
# Pushen gebeurt met het job-token van BlueGit (CI_JOB_TOKEN). Is daar een13
# repositorygeheim UPSTREAM_PUSH_TOKEN ingesteld, dan wordt dat gebruikt.14
# Zet nooit een token in deze (publieke) repository.15
#16
# De workflows in .github/ zijn voor GitHub Actions en worden door BlueGit17
# genegeerd.18
19
workflow:20
rules:21
- if: $CI_PIPELINE_SOURCE == "push"22
when: never23
- if: $CI_PIPELINE_SOURCE == "merge_request_event"24
when: never25
- when: always26
27
variables:28
UPSTREAM_URL: "https://github.com/danieldaeschle/rusty-teams.git"29
UPSTREAM_BRANCH: "main"30
TARGET_BRANCH: "upstream-master"31
32
sync-upstream:33
stage: sync34
image: bluegit/base35
resource_group: upstream-sync36
timeout: 15m37
retry:38
max: 139
when: runner_system_failure40
script:41
- |42
set -eu43
rm -rf /tmp/upstream44
git init -q --bare /tmp/upstream45
cd /tmp/upstream46
git fetch --no-tags "$UPSTREAM_URL" "+refs/heads/$UPSTREAM_BRANCH:refs/heads/$UPSTREAM_BRANCH"47
echo "Upstream $UPSTREAM_BRANCH staat op $(git rev-parse "refs/heads/$UPSTREAM_BRANCH")"48
export PUSH_TOKEN="${UPSTREAM_PUSH_TOKEN:-$CI_JOB_TOKEN}"49
git -c credential.helper= \50
-c credential.helper='!f() { echo username=ci-job; echo "password=$PUSH_TOKEN"; }; f' \51
push --force "$CI_PROJECT_URL.git" "refs/heads/$UPSTREAM_BRANCH:refs/heads/$TARGET_BRANCH"52
53
stages: [sync]