Skip to content
.gitlab-ci.yml 1.31 KiB
Newer Older
variables:
  GIT_STRATEGY: fetch
  GIT_SSL_NO_VERIFY: "true"
  GIT_LFS_SKIP_SMUDGE: 1

stages:
  - build

image_build:
  stage: build
  image: docker:stable
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN http://$CI_REGISTRY
  script: |
    CI_COMMIT_SHA_7=$(echo $CI_COMMIT_SHA | cut -c1-7)
    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
  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


  only:
    refs:
      - schedules
    variables:
      - $SCHEDULE_TYPE == "check_upstream"
  allow_failure: false