feat(git_push_mirror): Added a job that syncs to a remote git repo

User must construct url with userdetails for the sync to work in non-public writable repositories

 Changes to be committed:
	new file:   git_push_mirror/.gitlab-ci.yml
	new file:   git_push_mirror/README.md

issue #1
This commit is contained in:
2021-08-03 14:28:39 +09:30
parent a2174104d1
commit 9b28ae5952
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,22 @@
.git_push_mirror:
image: alpine:latest
stage: sync
before_script:
- apk update
- apk add git
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/$CI_PROJECT_PATH --mirror $CI_PROJECT_NAME
- cd $CI_PROJECT_NAME
- git remote add destination $GIT_SYNC_URL
- echo "https://gitlab.com/ $CI_PROJECT_PATH / $CI_PROJECT_NAME .git"
- git push destination --mirror
artifacts:
expire_in: 1 day
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "development"'
when: always