CI add comments and test buidling
Added comments to gitlab-ci.yml and check.sh as well as added a test template.
How it works:
The job check_changes_pipeline is triggered at push or merge request. It has two jobs
- to trigger the build of "production images" if on master (
--form ref=$CI_DEFAULT_BRANCH) - to trigger "testing images" if on non-master branch (
--form ref=$CI_COMMIT_BRANCH)
The job test_all_pipeline is triggered only on non-master branches and expects a variable $TEST in addition to $IMAGE_NAME. (The variable $TEST is probably unnecessary since it only runs on non-master branches and check.sh only triggers the build of "testing images" only on non-master branches.) The test images are pushed to https://gitlab.cern.ch/cms-cloud/cmssw-docker/test.
The jobs build_cms_cvmfs_pipeline and build_standalone_pipeline are only triggered on master.
One issue:
It seems like the first line of check.sh (git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA) is empty if the commit came from a merge request. This means that in a scenario like
- Changes are pushed to a branch
-
check.shtriggers the build of "testing images" - If everything looks good we merge the branch into master
-
check.shis triggered however it doesn't find any changed files - No "production images" are built
I haven't found a way around this yet.