feat(git_push_mirror): ability to disable job with variable

!21
This commit is contained in:
2023-05-13 11:47:56 +09:30
parent 9e7d357bab
commit 81445c06e4

View File

@ -6,6 +6,7 @@
- apk update - apk update
- apk add git - apk add git
script: script:
- if [ "0$GIT_SYNC_URL" == "0"]; then echo "[ERROR] you must define variable GIT_SYNC_URL for mirroring this repository."; fi
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/$CI_PROJECT_PATH --mirror $CI_PROJECT_NAME - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/$CI_PROJECT_PATH --mirror $CI_PROJECT_NAME
- cd $CI_PROJECT_NAME - cd $CI_PROJECT_NAME
- git remote add destination $GIT_SYNC_URL - git remote add destination $GIT_SYNC_URL
@ -14,7 +15,9 @@
artifacts: artifacts:
expire_in: 1 day expire_in: 1 day
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$JOB_STOP_GIT_PUSH_MIRROR'
- if: '$CI_COMMIT_BRANCH == "development"' when: never
- if: '$CI_COMMIT_BRANCH == "master" && $GIT_SYNC_URL != null'
- if: '$CI_COMMIT_BRANCH == "development" && $GIT_SYNC_URL != null'
when: always when: always