From 508bab907d5b1a8cb7581cb6c50967831dd528f9 Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph@weston.cloud> Date: Wed, 28 Nov 2018 15:08:42 +0100 Subject: [PATCH] build testing images as part of Kwant's CI pipeline Only builds testing images when the relevant dockerfile/conda envs have changed. --- .gitlab-ci.yml | 70 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afc41535..d016ddce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ -image: gitlab.kwant-project.org:5005/kwant/testing +image: gitlab.kwant-project.org:5005/kwant/kwant stages: + - build-env - build - test - deploy @@ -11,6 +12,69 @@ variables: # secret information, and using 'ssh-keyscan' causes the CI server's IP to be blacklisted IGNORE_HOSTKEY: "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" +## Building Docker environments +## Only runs when docker specifications change + +.build-env: &build-env + stage: build-env + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + artifacts: + untracked: true + expire_in: 1 hour + before_script: + - mkdir -p /root/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /root/.docker/config.json + +build-env:ubuntu: + <<: *build-env + only: + changes: + - docker/Dockerfile.ubuntu + script: + - /kaniko/executor + --context $CI_PROJECT_DIR/docker + --dockerfile $CI_PROJECT_DIR/docker/Dockerfile.ubuntu + --destination $CI_REGISTRY_IMAGE/ubuntu + +build-env:debian: + <<: *build-env + only: + changes: + - docker/Dockerfile.debian + script: + - /kaniko/executor + --context $CI_PROJECT_DIR/docker + --dockerfile $CI_PROJECT_DIR/docker/Dockerfile.debian + --destination $CI_REGISTRY_IMAGE/debian + +build-env:conda: + <<: *build-env + only: + changes: + - docker/Dockerfile.conda + - docker/*.yml + script: + - /kaniko/executor + --context $CI_PROJECT_DIR/docker + --dockerfile $CI_PROJECT_DIR/docker/Dockerfile.conda + --destination $CI_REGISTRY_IMAGE/conda + +build-env:default: + <<: *build-env + only: + changes: + - docker/Dockerfile.conda + - docker/*.yml + script: + - /kaniko/executor + --context $CI_PROJECT_DIR/docker + --dockerfile $CI_PROJECT_DIR/docker/Dockerfile.conda + --destination $CI_REGISTRY_IMAGE + + +## Build environment specifications .build: &build stage: build @@ -49,10 +113,10 @@ variables: - source activate kwant-latest .ubuntu-env: &ubuntu_env - image: gitlab.kwant-project.org:5005/kwant/testing/ubuntu + image: gitlab.kwant-project.org:5005/kwant/kwant/ubuntu .debian-env: &debian_env - image: gitlab.kwant-project.org:5005/kwant/testing/debian + image: gitlab.kwant-project.org:5005/kwant/kwant/debian ## Build Jobs -- GitLab