Commit c691bf41 authored by Rémy Coutable's avatar Rémy Coutable

Use the (merge) commit sha when building CNG components

- The assets cache image is built against the merge commit (aka
  `$CI_COMMIT_SHA`): https://gitlab.com/gitlab-org/gitlab/-/blob/db839bf23e216b43e8b920265d7dc814a9365cc9/.gitlab/ci/frontend.gitlab-ci.yml#L58-63
- The CNG images are built against the branch: https://gitlab.com/gitlab-org/gitlab/-/blob/db839bf23e216b43e8b920265d7dc814a9365cc9/scripts/trigger-build#L181
- The problem is that the branch `HEAD` commit isn't the same as the
  merge commit, thus assets in the assets image have a high chance of
  having a different hash than the actual assets that would be
  generated from the branch `HEAD`.
- The correct assets are the ones generated from the merge commit, so
  we're changing the CNG trigger variables to pass
  `GITLAB_VERSION=$CI_COMMIT_SHA` instead of
  `GITLAB_VERSION=$CI_COMMIT_REF_NAME` so that the components are
  built from the same commit as the assets image.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 7974883f
...@@ -176,11 +176,9 @@ module Trigger ...@@ -176,11 +176,9 @@ module Trigger
edition = Trigger.ee? ? 'EE' : 'CE' edition = Trigger.ee? ? 'EE' : 'CE'
{ {
# Back-compatibility until https://gitlab.com/gitlab-org/build/CNG/merge_requests/189 is merged "GITLAB_VERSION" => ENV['CI_COMMIT_SHA'],
"GITLAB_#{edition}_VERSION" => ENV['CI_COMMIT_REF_NAME'],
"GITLAB_VERSION" => ENV['CI_COMMIT_REF_NAME'],
"GITLAB_TAG" => ENV['CI_COMMIT_TAG'], "GITLAB_TAG" => ENV['CI_COMMIT_TAG'],
"GITLAB_ASSETS_TAG" => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : ENV['CI_COMMIT_REF_SLUG'], "GITLAB_ASSETS_TAG" => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : ENV['CI_COMMIT_SHA'],
"FORCE_RAILS_IMAGE_BUILDS" => 'true', "FORCE_RAILS_IMAGE_BUILDS" => 'true',
"#{edition}_PIPELINE" => 'true' "#{edition}_PIPELINE" => 'true'
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment