Skip to content
.gitlab-ci.yml 2.12 KiB
Newer Older
# renku: v1.dev20180723

variables:
  GIT_STRATEGY: fetch
  GIT_SSL_NO_VERIFY: "true"
  GIT_LFS_SKIP_SMUDGE: 1
  GIT_SUBMODULE_STRATEGY: recursive 
  GIT_SUBMODULE_REMOTE_STRATEGY: "true"
Anthony Sonrel's avatar
Anthony Sonrel committed
  PROJECT_SCRIPT: src/load_dataset.sh
Anthony Sonrel's avatar
Anthony Sonrel committed
  - update

image_build:
  stage: build
  image: docker:stable
  except:
    - triggers
  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
  tags:
    - image-build

default: 
  tags:
    - image-build
  before_script:
    - git submodule sync --recursive
    - git submodule update --init --recursive --remote
    - git add -A
    - git commit -m 'Update utils.'
    - git push
Anthony Sonrel's avatar
Anthony Sonrel committed

update_build:
  stage: build
  image: docker:stable
Anthony Sonrel's avatar
Anthony Sonrel committed
  rules:
    - if: '$CI_PIPELINE_SOURCE == "pipeline" && $CI_UPSTREAM_PROJECT == "anthony.sonrel/orchestrator-test"'
Anthony Sonrel's avatar
Anthony Sonrel committed
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN http://$CI_REGISTRY
  script: 
    - docker pull $CI_REGISTRY_IMAGE:latest || true
    - docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
    - docker push $CI_REGISTRY_IMAGE:latest

run_udpate:
  stage: update
  image: 
    name: ${CI_REGISTRY_IMAGE}:latest
    entrypoint: [""]
Anthony Sonrel's avatar
Anthony Sonrel committed
  rules:
    - if: '$CI_PIPELINE_SOURCE == "pipeline" && $CI_UPSTREAM_PROJECT == "anthony.sonrel/orchestrator-test"'
Anthony Sonrel's avatar
Anthony Sonrel committed
  before_script:
    - git config --global user.name "Anthony Sonrel"
    - git config --global user.email "anthony.sonrel@uzh.ch"
    - url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
    - cd /tmp/
    - git clone "https://oauth2:${CI_PUSH_TOKEN}@${url_host}"
    - cd ${CI_PROJECT_NAME}
    - chmod +x ./$PROJECT_SCRIPT
    - git lfs install --local
  script:
    #- cd src
    #- git clone https://renkulab.io/gitlab/omnibenchmark/utils.git
    #- cd ..
    #- renku save -m  'Clone submodule'
Anthony Sonrel's avatar
Anthony Sonrel committed
    - ./$PROJECT_SCRIPT