Commit 8624370a authored by Cyril Matthey-Doret's avatar Cyril Matthey-Doret
Browse files

add sheduled submodule update stage in .gitlab-ci.yml

parent 65c2a662
Pipeline #315995 passed with stage
in 11 seconds
......@@ -5,11 +5,13 @@ variables:
stages:
- build
- pull_upstream
- update
image_build:
stage: build
image: docker:stable
except:
- schedules
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN http://$CI_REGISTRY
script: |
......@@ -17,34 +19,36 @@ image_build:
docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7 .
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7
pull_jupytext_github:
stage: pull_upstream
image_build_for_update:
stage: build
image: docker:stable
only:
- schedules
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN http://$CI_REGISTRY
script: |
whoami
printenv
CI_PUSH_REPO=$(echo $CI_REPOSITORY_URL | perl -pe 's#.*@(.+?(\:\d+)?)/#git@\1:#')
git remote set-url --push origin "${CI_PUSH_REPO}"
git config user.name "Gitlab CI"
git config user.email "cyril.matthey-doret@epfl.ch"
# runner runs on a detached HEAD, create a temporary local branch for editing
git checkout -b ci_processing
# update jupytext submodule
git submodule foreach git pull origin main
git add jupytext
git commit -m "sync: jupytext@$(git submodule status | cut -c2-9)"
# push changes
# always return true so that the build does not fail if there are no changes
git push origin ci_processing:${CI_BUILD_REF_NAME} || true
docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
update_jupytext:
stage: update
image:
name: $$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
entrypoint: ['']
only:
- schedules
before_script:
- git config --global user.name ${GITLAB_USER_NAME}
- git config --global user.email ${GITLAB_USER_EMAIL}
- renku clone https://oauth2:${CI_PERSONAL_TOKEN}@renkulab.io/gitlab/${CI_PROJECT_PATH}.git /tmp/${CI_COMMIT_SHORT_SHA}
- cd /tmp/${CI_COMMIT_SHORT_SHA}
script: |
git submodule update --init --recursive
git submodule update --remote
after_script:
- cd /tmp/${CI_COMMIT_SHORT_SHA}
- renku save -m "sync jupytext@$(git submodule status | cut -c2-9)"
only:
refs:
- schedules
variables:
- $SCHEDULE_TYPE == "check_upstream"
allow_failure: false
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment