Skip to content

Check if single.Dockerfile is the same as the X.Y.Dockerfile

Achilleas Pipinellis requested to merge axil-dockerfile-check-template into main

What does this MR do and why?

Adds a test that checks if single.Dockerfile is the same as the X.Y.Dockerfile, where X.Y the stable branch name.

This added test is helpful when we make changes to single.Dockerfile that we then want to backport to one of the stable branches. Sometimes we forget to change the Dockerfile in question, which is X.Y.Dockerfile (case in point).

Since the tests only run in the stable branches, I opened an MR to backport this into 16.6 !4409 (merged) and test things there. This MR targets the main branch.

How to set up and validate locally

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.

  2. On macOS, make sure you replace sed with gsed. See https://gitlab.com/gitlab-org/gitlab-docs/-/blob/0b1fb0eea614b7253516c39d80a68654ef993595/scripts/normalize-links.sh#L10-25

  3. Get a Dockerfile from another branch and test it with single.Dockerfile, you should get OK as an output:

    export CI_COMMIT_REF_NAME=16.6
    git checkout $CI_COMMIT_REF_NAME -- $CI_COMMIT_REF_NAME.Dockerfile
    sed -i '/ARG VER/d' $CI_COMMIT_REF_NAME.Dockerfile dockerfiles/single.Dockerfile
    difference=$(diff $CI_COMMIT_REF_NAME.Dockerfile dockerfiles/single.Dockerfile)
    if [ -z $difference ]; then echo OK; else exit 1; fi
  4. Clean up the files:

    git checkout .
    git restore --staged .
    git clean -df

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Achilleas Pipinellis

Merge request reports