Skip to content

Commit c47e497

Browse files
committed
TUN-9800: Add pipeline to sync between gitlab and github repos
1 parent 80b1634 commit c47e497

File tree

3 files changed

+49
-6
lines changed

3 files changed

+49
-6
lines changed

.ci/github.gitlab-ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
include:
2+
- local: .ci/commons.gitlab-ci.yml
3+
4+
######################################
5+
### Sync master branch with Github ###
6+
######################################
7+
push-github:
8+
stage: sync
9+
rules:
10+
#- !reference [.default-rules, run-on-master]
11+
- !reference [.default-rules, run-on-mr]
12+
script:
13+
- ./.ci/scripts/github-push.sh
14+
secrets:
15+
CLOUDFLARED_DEPLOY_SSH_KEY:
16+
# vault: gitlab/cloudflare/tun/cloudflared/_branch/master/cloudflared_github_ssh/data@kv
17+
vault: gitlab/cloudflare/tun/cloudflared/_dev/cloudflared_github_ssh/data@kv
18+
file: false
19+
cache: {}

.ci/scripts/github-push.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
set -e -o pipefail
3+
4+
mkdir -p tmp
5+
6+
echo "$CLOUDFLARED_DEPLOY_SSH_KEY" > tmp/github-deploy-key
7+
chmod 400 tmp/github-deploy-key
8+
9+
ssh-keyscan -t rsa github.com > tmp/github.pub
10+
11+
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=$PWD/tmp/github.pub -o IdentitiesOnly=yes -i $PWD/tmp/github-deploy-key"
12+
13+
git remote add github [email protected]:cloudflare/cloudflared.git || true
14+
#git push -u github master
15+
#if TAG="$(git describe --tags --exact-match 2>/dev/null)"; then
16+
# git push -u github "$TAG"
17+
#fi
18+
19+
git push -u github HEAD:joaocarlos/TUN-9800-migrate-github-push-to-gitlab

.gitlab-ci.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,40 @@ default:
77
VAULT_ID_TOKEN:
88
aud: https://vault.cfdata.org
99

10-
stages: [pre-build, build, validate, test, package, release]
10+
stages: [sync, pre-build, build, validate, test, package, release]
1111

1212
include:
1313
#####################################################
1414
########## Import Commons Configurations ############
1515
#####################################################
1616
- local: .ci/commons.gitlab-ci.yml
1717

18+
#####################################################
19+
########### Sync Repository with Github #############
20+
#####################################################
21+
- local: .ci/github.gitlab-ci.yml
22+
1823
#####################################################
1924
############# Build or Fetch CI Image ###############
2025
#####################################################
21-
- local: .ci/ci-image.gitlab-ci.yml
26+
#- local: .ci/ci-image.gitlab-ci.yml
2227

2328
#####################################################
2429
################## Linux Builds ###################
2530
#####################################################
26-
- local: .ci/linux.gitlab-ci.yml
31+
#- local: .ci/linux.gitlab-ci.yml
2732

2833
#####################################################
2934
################## Windows Builds ###################
3035
#####################################################
31-
- local: .ci/windows.gitlab-ci.yml
36+
#- local: .ci/windows.gitlab-ci.yml
3237

3338
#####################################################
3439
################### macOS Builds ####################
3540
#####################################################
36-
- local: .ci/mac.gitlab-ci.yml
41+
#- local: .ci/mac.gitlab-ci.yml
3742

3843
#####################################################
3944
################# Release Packages ##################
4045
#####################################################
41-
- local: .ci/release.gitlab-ci.yml
46+
#- local: .ci/release.gitlab-ci.yml

0 commit comments

Comments
 (0)