add pipeline for building docker images
The pipeline contains two different build jobs, building a standalone or a cms/cvmfs version. In addition it contains a job for checking which files have been modified, enabling to trigger the build of the cms/cvmfs version that was changed. Only reason for there to be a separate script check.sh
and not just a multi line script is because I didn't get the multi line syntax to work with a for loop
script:
- >
If you know how to fix it we can transfer the code in check.sh
to the pipeline!
The two build jobs:
-
A standalone build is triggered when the variables
CMSSW_VERSION
,SCRAM_ARCH
andBASE_IMAGE
is passed, could be passed with a webhook. -
A cms/cvmfs version is built when there has been a change in the directory containing the Dockerfile corresponding to the image. Since there is only one job but five directories, before building, the job has to set the IMAGE_NAME variable to indicate which image to build (cc7-cms/cvmfs, slc6-cms/cvmfs, slc5-cms). This is set with the job
check changed files
The file check.sh
calls
files=$(git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA)
which returns a list of all files that has been modified. The directory of the file is checked and the pipeline is triggered again, this time with the variable IMAGE_NAME set to the directory name. (The reason why the job tags docker is because the runner has git installed).