Skip to content
Snippets Groups Projects
Verified Commit 83784ba7 authored by Quentin Duchemin's avatar Quentin Duchemin
Browse files

[CI] Remove absolute bullshit set-variables step

More seriously, this step was useful once upon a time because it also used to build the base image for each commit. Now that we have pica-ci-base, this step was only useful to determine what folder have been modified and export some environement variable in a cached file. But Gitlab has race conditions with cache and it will randomly fail, annoying the users of the CI. We will execute the script to set these environment variables at each step of the CI, with a really minimal overhead.
parent 7c138048
No related branches found
No related tags found
No related merge requests found
......@@ -21,12 +21,14 @@ stages:
- push
# Hidden key meant to be included in other jobs, for factorization
# Login to registry and pull built image
.pull-modified-image: &pull-modified-image
image: $REGISTRY_PROD/pica-ci-base
tags: [build]
before_script:
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USERNAME --password-stdin
- sh image_modified_last_commit.sh
- source variables
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USERNAME --password-stdin
- docker pull $MODIFIED_IMAGE_FULL_TEST
# Build the base image used for all further steps : this is done only when pica-ci's Dockerfile is modified
......@@ -48,33 +50,16 @@ pica-ci-base:
allow_failure: true
- when: never
# Create a file a few environment variables added (which Dockerfile has been modified, the complete name of the image...)
# The file will be an artifact shared with further steps
set-variables:
stage: ci-base
tags: [build]
image: $REGISTRY_PROD/pica-ci-base
script:
- chmod +x ./get-modified-image.sh
- ./get-modified-image.sh
# If there are changes in any of the files and folders of 'pica-*' or
# 'meta-*', then propose a manual build
rules:
- changes:
- "pica-*/**"
when: always
allow_failure: true
- when: never
# Build the image that was modified
build:
stage: build
tags: [build]
image: $REGISTRY_PROD/pica-ci-base
before_script:
- sh image_modified_last_commit.sh
- source variables
# First login on the production registry, in case the image is based on another registry image
- echo $REGISTRY_PROD_PASSWORD | docker login $REGISTRY_PROD -u $REGISTRY_PROD_USERNAME --password-stdin
- source variables
script:
# Build the image
- docker build -f $MODIFIED_IMAGE/Dockerfile $MODIFIED_IMAGE -t $MODIFIED_IMAGE_FULL_TEST
......@@ -159,7 +144,9 @@ docker-bench-security:
- "meta-*/**"
when: manual
allow_failure: true
- when: never
# Push the generated image on the production registry,
# once it passed all security tests and has been successfully built
# and run on the test virtual machine
......@@ -178,3 +165,4 @@ push-prod:
changes:
- "pica-*/**"
when: manual
- when: never
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment