From c6aa2a5ced58264d05fe824dfeda9cbee4a5a9ab Mon Sep 17 00:00:00 2001 From: Julian Manns Date: Fri, 17 May 2024 14:51:29 +0200 Subject: [PATCH] Refactor folder structure of gitlab ci files --- .gitlab-ci.yml | 19 +++++++++---------- {ci => .gitlab}/docker/Dockerfile | 0 .gitlab/docker/dockerfile_hash.yml | 3 +++ {ci => .gitlab/jobs}/cmake_and_ctest.yml | 0 {ci => .gitlab/jobs}/linktest.yml | 0 {ci/docker => .gitlab/jobs}/prepare_image.yml | 10 +++++----- {ci => .gitlab/jobs}/russcip.yml | 0 {ci => .gitlab/jobs}/valgrind.yml | 0 ci/docker/image_hash.yml | 3 --- 9 files changed, 17 insertions(+), 18 deletions(-) rename {ci => .gitlab}/docker/Dockerfile (100%) create mode 100644 .gitlab/docker/dockerfile_hash.yml rename {ci => .gitlab/jobs}/cmake_and_ctest.yml (100%) rename {ci => .gitlab/jobs}/linktest.yml (100%) rename {ci/docker => .gitlab/jobs}/prepare_image.yml (71%) rename {ci => .gitlab/jobs}/russcip.yml (100%) rename {ci => .gitlab/jobs}/valgrind.yml (100%) delete mode 100644 ci/docker/image_hash.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 432489c843..6d0f402095 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,15 +5,14 @@ # Jobs should not be defined in this file but in their own file in the ci folder. # Similar jobs should be grouped in the same file and use inheritance to avoid code duplication. # The image custom image used in this pipeline is quite complex and large as it contains all the dependencies of SCIP. -# It is defined in ci/docker/Dockerfile. +# It is defined in .gitlab/docker/Dockerfile. # The image is built in the first stage of the pipeline and then used in all the other stages. # Jobs that do not require the dependecies inside the image should run on a smaller image like debian-slim. variables: IMAGE_NAME: ${CI_REGISTRY}/integer/scip/ci # combine IMAGE_NAME and current branch - IMAGE: ${IMAGE_NAME}:${IMAGE_HASH} - IMAGE_PATH: ${CI_PROJECT_DIR}/ci/docker/Dockerfile - DEPENDENCIES_PATH: ${CI_PROJECT_DIR}/ci/docker/dependencies.yml + IMAGE: ${IMAGE_NAME}:${DOCKERFILE_HASH} + IMAGE_PATH: ${CI_PROJECT_DIR}/.gitlab/docker/Dockerfile workflow: rules: @@ -27,9 +26,9 @@ stages: - release include: - - local: 'ci/docker/image_hash.yml' - - local: 'ci/docker/prepare_image.yml' - - local: 'ci/cmake_and_ctest.yml' - - local: 'ci/linktest.yml' - - local: 'ci/russcip.yml' - - local: 'ci/valgrind.yml' + - local: '.gitlab/docker/dockerfile_hash.yml' + - local: '.gitlab/jobs/prepare_image.yml' + - local: '.gitlab/jobs/cmake_and_ctest.yml' + - local: '.gitlab/jobs/linktest.yml' + - local: '.gitlab/jobs/russcip.yml' + - local: '.gitlab/jobs/valgrind.yml' diff --git a/ci/docker/Dockerfile b/.gitlab/docker/Dockerfile similarity index 100% rename from ci/docker/Dockerfile rename to .gitlab/docker/Dockerfile diff --git a/.gitlab/docker/dockerfile_hash.yml b/.gitlab/docker/dockerfile_hash.yml new file mode 100644 index 0000000000..8662b2fb8d --- /dev/null +++ b/.gitlab/docker/dockerfile_hash.yml @@ -0,0 +1,3 @@ +variables: + # use "md5sum .gitlab/docker/Dockerfile" to get the hash of the Dockerfile + DOCKERFILE_HASH: 1c85ceab9afc81ad147202548b0a781b diff --git a/ci/cmake_and_ctest.yml b/.gitlab/jobs/cmake_and_ctest.yml similarity index 100% rename from ci/cmake_and_ctest.yml rename to .gitlab/jobs/cmake_and_ctest.yml diff --git a/ci/linktest.yml b/.gitlab/jobs/linktest.yml similarity index 100% rename from ci/linktest.yml rename to .gitlab/jobs/linktest.yml diff --git a/ci/docker/prepare_image.yml b/.gitlab/jobs/prepare_image.yml similarity index 71% rename from ci/docker/prepare_image.yml rename to .gitlab/jobs/prepare_image.yml index 0da9d13f31..3b89a979d4 100644 --- a/ci/docker/prepare_image.yml +++ b/.gitlab/jobs/prepare_image.yml @@ -7,16 +7,16 @@ name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - # Error out of $IMAGE_HASH is not set - - if [ -z "$IMAGE_HASH" ]; then - echo "IMAGE_HASH is not set. Check that it is set in ci/docker/image_hash.yml and that the file is included in .gitlab-ci.yml"; + # Error out of $DOCKERFILE_HASH is not set + - if [ -z "$DOCKERFILE_HASH" ]; then + echo "DOCKERFILE_HASH is not set. Check that it is set in .gitlab/docker/dockerfile_hash.yml and that the file is included in .gitlab-ci.yml"; exit 1; fi # Calculate the MD5 hash of the file - computed_hash=$(md5sum ${IMAGE_PATH} | awk '{print $1}') # Compare the computed hash with the expected hash - - if [ $computed_hash != $IMAGE_HASH ]; then - echo Hashes do not match! IMAGE_HASH defined in .gitlab-ci.yml has to match the md5sum of ci/docker/Dockerfile.; + - if [ $computed_hash != $DOCKERFILE_HASH ]; then + echo Hashes do not match! DOCKERFILE_HASH defined in .gitlab-ci.yml has to match the md5sum of .gitlab/docker/Dockerfile.; exit 1; fi # Set gitlab registry credentials diff --git a/ci/russcip.yml b/.gitlab/jobs/russcip.yml similarity index 100% rename from ci/russcip.yml rename to .gitlab/jobs/russcip.yml diff --git a/ci/valgrind.yml b/.gitlab/jobs/valgrind.yml similarity index 100% rename from ci/valgrind.yml rename to .gitlab/jobs/valgrind.yml diff --git a/ci/docker/image_hash.yml b/ci/docker/image_hash.yml deleted file mode 100644 index bb2ab5c3cf..0000000000 --- a/ci/docker/image_hash.yml +++ /dev/null @@ -1,3 +0,0 @@ -variables: - # use "md5sum ci/docker/Dockerfile" to get the hash of the Dockerfile - IMAGE_HASH: 1c85ceab9afc81ad147202548b0a781b