From 53a73b3d5dda5f776e31ef19b9eeb53b6fd086cf Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph.weston08@gmail.com> Date: Thu, 3 Nov 2016 23:39:34 +0100 Subject: [PATCH] CI: add mirroring between kwant gitlab, gitlab.com and github.com --- .gitlab-ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5b6afdc..8ce3bbbc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,24 @@ stages: - test - deploy +mirror repository: + stage: build + only: + - branches@kwant/kwant + variables: + REPOS: "git@github.com:kwant-project/kwant.git git@gitlab.com:kwant/kwant.git" + before_script: + - HOSTS=$(for REPO in $REPOS; do echo ${REPO%:*} | cut -d'@' -f2; done) + - mkdir ~/.ssh && chmod 700 ~/.ssh + - for HOST in $HOSTS; do ssh-keyscan $HOST >> ~/.ssh/known_hosts; done + - echo "$DEPLOY_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + after_script: + - rm -rf ~/.ssh + script: + - ORIGIN_URL=$(git config --get remote.origin.url) + - cd $(mktemp -d); git clone --bare $ORIGIN_URL . + - for REPO in $REPOS; do git push --mirror $REPO; done + build package: stage: build script: -- GitLab