.gitlab-ci.yml 1.31 KB
Newer Older
1
2
3
4
5
6
7
variables:
  GIT_STRATEGY: fetch
  GIT_SSL_NO_VERIFY: "true"
  GIT_LFS_SKIP_SMUDGE: 1

stages:
  - build
8
  - pull_upstream
9
10
11
12
13
14
15
16
17

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 .
18
19
20
21
22
23
24
25
26
27
    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"
28
    git config user.email "cyril.matthey-doret@epfl.ch"
29
30
31
32
33
34
35

    # 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
36
    git commit -m "sync: jupytext@$(git submodule status | cut -c2-9)"
37
38
39
40
41
42
43
44
45
46
47
48
49
50

    # 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