diff --git a/git_push_mirror/.gitlab-ci.yml b/git_push_mirror/.gitlab-ci.yml new file mode 100644 index 0000000..daa9b98 --- /dev/null +++ b/git_push_mirror/.gitlab-ci.yml @@ -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 + + + diff --git a/git_push_mirror/README.md b/git_push_mirror/README.md new file mode 100644 index 0000000..443b9e8 --- /dev/null +++ b/git_push_mirror/README.md @@ -0,0 +1,45 @@ +# git push mirror Admin Manual Manual +This job does a git push to a remote git repo. + +This job provides the following badge: + +- None + +## Dependencies + +- None + +## your .gitlab-ci.yml changes +To use this job add the following to your `.gitlab-ci.yml` file + +``` yaml +stages: + - sync + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/git_push_mirror/.gitlab-ci.yml + +Github (Push --mirror): + variables: + GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git" + extends: + - .git_push_mirror + +``` + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| GIT_SYNC_URL | this is the remote git repositories https clone address.
***Note:** if the remote repository requires authentication, you will need to build the url. like above.* | + + +## Job Workflow + + +## Artifacts + + - + +## License +To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)