Using $GITLAB_REF_SLUG in gitlab-rails/Dockerfile.erb sometimes fail if the branch contains a `.`
Summary
In gitlab-org/build/CNG!189 (merged), we started using $GITLAB_REF_SLUG
in gitlab-rails/Dockerfile.erb
since it has the /
replaced by -
. The problem is that is also has .
replaced by -
.
This makes the mv ${GITLAB_EDITION}-${GITLAB_REF_SLUG}-* /srv/gitlab && \
command fail. For instance when GITLAB_VERSION=sh-bump-sidekiq-5.2.5
, then GITLAB_REF_SLUG=sh-bump-sidekiq-5-2-5
, but the extracted folder is named gitlab-ce-sh-bump-sidekiq-5.2.5-f7e8a89421cf7305d6b255702d84ca774bc31ff2
, thus mv gitlab-ce-sh-bump-sidekiq-5-2-5-* /srv/gitlab && \
fails.
We also have the same issue for REVISION=$(find -maxdepth 1 -name ${GITLAB_EDITION}-${GITLAB_REF_SLUG}-* -print | awk -F '-' '{print $NF}' | cut -c -8)
.
Steps to reproduce
This can be seen in https://gitlab.com/gitlab-org/build/CNG-mirror/-/jobs/151513009.
Solution
I'm wondering if we could simplify the command to just mv ${GITLAB_EDITION}-* /srv/gitlab && \
because it's unlikely that there is another folder beginning with ${GITLAB_EDITION}-
, or is it?
/cc @twk3