From d3cc6ed47b97a02b144345ec0961630b7f0c8344 Mon Sep 17 00:00:00 2001 From: Ian Young Date: Fri, 1 Dec 2017 10:36:53 +0000 Subject: [PATCH] Add CI job to mirror the repository --- .gitlab-ci.yml | 26 ++++++++++++++++++++++++++ deploy/known_hosts | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 deploy/known_hosts diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5dc8bf7..17889b2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,10 @@ image: maven:3.3.9-jdk-8 +stages: + - mirror + - test + variables: # # maven.repo.local points Maven at a local repository, which will @@ -24,7 +28,29 @@ cache: paths: - .m2 +mirror: + stage: mirror + tags: + - linux + 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 + # Do a bare clone of the repository + - git clone --bare $CI_REPOSITORY_URL + # Mirror push it to the destination + - cd $CI_PROJECT_NAME.git + - git push --mirror $MIRROR_DEST + test: + stage: test tags: - linux script: diff --git a/deploy/known_hosts b/deploy/known_hosts new file mode 100644 index 0000000..5e73028 --- /dev/null +++ b/deploy/known_hosts @@ -0,0 +1,2 @@ +gitlab.iay.org.uk,192.168.117.27 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI0a+I41I960iFba9mrCQHfLHd337Iydn2J5CXh6Low3wnzw0mc0osd707q3+K8WnIUWv3ZVmxv4g88gAL+GVnE= +github.internet2.edu,52.207.246.146 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCtCLiBoG1JxyHqSxLwnwj5GKBR888zMxbKYf9OR5l+DMiKuEVTyMmR7zvcE2USaK3Z639CcmcqnB8XyLKEowU8=