TUN-9800: Add pipeline to sync between gitlab and github repos

This commit is contained in:
João "Pisco" Fernandes 2025-09-22 15:44:50 +01:00
parent 80b1634515
commit cffbb2dbb3
3 changed files with 49 additions and 6 deletions

19
.ci/github.gitlab-ci.yml Normal file
View File

@ -0,0 +1,19 @@
include:
- local: .ci/commons.gitlab-ci.yml
######################################
### Sync master branch with Github ###
######################################
push-github:
stage: sync
rules:
#- !reference [.default-rules, run-on-master]
- !reference [.default-rules, run-on-mr]
script:
- ./.ci/scripts/github-push.sh
secrets:
CLOUDFLARED_DEPLOY_SSH_KEY:
# vault: gitlab/cloudflare/tun/cloudflared/_branch/master/cloudflared_github_ssh/data@kv
vault: gitlab/cloudflare/tun/cloudflared/_dev/cloudflared_github_ssh/data@kv
file: false
cache: {}

19
.ci/scripts/github-push.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e -o pipefail
mkdir -p tmp
echo "$CLOUDFLARED_DEPLOY_SSH_KEY" > tmp/github-deploy-key
chmod 400 tmp/github-deploy-key
ssh-keyscan -t rsa github.com > tmp/github.pub
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=$PWD/tmp/github.pub -o IdentitiesOnly=yes -i $PWD/tmp/github-deploy-key"
git remote add github git@github.com:cloudflare/cloudflared.git || true
#git push -u github master
#if TAG="$(git describe --tags --exact-match 2>/dev/null)"; then
# git push -u github "$TAG"
#fi
git push -u github origin/joaocarlos/TUN-9800-migrate-github-push-to-gitlab

View File

@ -7,7 +7,7 @@ default:
VAULT_ID_TOKEN:
aud: https://vault.cfdata.org
stages: [pre-build, build, validate, test, package, release]
stages: [sync, pre-build, build, validate, test, package, release]
include:
#####################################################
@ -15,27 +15,32 @@ include:
#####################################################
- local: .ci/commons.gitlab-ci.yml
#####################################################
########### Sync Repository with Github #############
#####################################################
- local: .ci/github.gitlab-ci.yml
#####################################################
############# Build or Fetch CI Image ###############
#####################################################
- local: .ci/ci-image.gitlab-ci.yml
#- local: .ci/ci-image.gitlab-ci.yml
#####################################################
################## Linux Builds ###################
#####################################################
- local: .ci/linux.gitlab-ci.yml
#- local: .ci/linux.gitlab-ci.yml
#####################################################
################## Windows Builds ###################
#####################################################
- local: .ci/windows.gitlab-ci.yml
#- local: .ci/windows.gitlab-ci.yml
#####################################################
################### macOS Builds ####################
#####################################################
- local: .ci/mac.gitlab-ci.yml
#- local: .ci/mac.gitlab-ci.yml
#####################################################
################# Release Packages ##################
#####################################################
- local: .ci/release.gitlab-ci.yml
#- local: .ci/release.gitlab-ci.yml