gitlab-github-mirror/.gitlab-ci.yml

48 lines
1.3 KiB
YAML
Raw Normal View History

2018-03-09 17:07:58 +01:00
#before_script:
# - ssh-keyscan -t rsa,dsa,ecdsa github.com > /etc/ssh/ssh_known_hosts
2018-03-10 11:34:52 +01:00
stages:
- mirror
2018-03-09 17:05:19 +01:00
variables:
2018-03-10 11:34:52 +01:00
MIRROR_REPOSITORY: "git@github.com:h44z/atestproject.git"
MIRROR_BRANCH: "master"
mirror-github:
stage: mirror
cache: {}
script:
# run ssh-agent
#- eval $(ssh-agent -s)
# add appropriate private key to the agent store
#- ssh-add <(echo "$MIRROR_KEY")
# set known hosts list
# WARNING: use only in docker container, if you use it with shell you will
# overwrite your user's ssh config
#- mkdir -p ~/.ssh
#- cp deploy/known_hosts ~/.ssh/known_hosts
2018-03-10 11:35:47 +01:00
# Do a mirror clone of the repository
2018-03-10 11:34:52 +01:00
- git clone --mirror $CI_REPOSITORY_URL
# Mirror push it to the destination
- cd $CI_PROJECT_NAME.git
- git push --mirror $MIRROR_REPOSITORY
2018-03-10 11:35:47 +01:00
# Cleanup
- cd ..; rm -rf $CI_PROJECT_NAME.git
2018-03-09 17:05:19 +01:00
2018-03-10 11:34:52 +01:00
#mirror-master:
# stage: deploy
2018-03-09 17:13:23 +01:00
# only:
# - master
2018-03-10 11:34:52 +01:00
# script:
# - git remote add --mirror=push github $UPSTREAM_REPOSITORY || true
# - git push --quiet github
2018-03-09 17:13:23 +01:00
# - git fetch upstream
# - git push --progress upstream HEAD:$UPSTREAM_BRANCH
2018-03-09 17:05:19 +01:00
2018-03-09 17:13:23 +01:00
#mirror-tags:
# stage: deploy
# only:
# - tags
# script:
# - git remote add upstream $UPSTREAM_REPOSITORY || true
# - git fetch upstream
# - git push --progress --tags upstream