Skip to content

Commit 5c44c4b

Browse files
committed
Pull request 2731: ADG-12585-fix-ci
Squashed commit of the following: commit 7abc4da Merge: cafaf7d e8e3287 Author: Maksim Kazantsev <m.kazantsev@adguard.com> Date: Fri Jul 24 15:12:47 2026 +0300 Merge branch 'master' into ADG-12585-fix-ci commit cafaf7d Author: Maksim Kazantsev <m.kazantsev@adguard.com> Date: Fri Jul 24 14:45:51 2026 +0300 bamboo-specs: fmt; commit 5c1cb2b Author: Maksim Kazantsev <m.kazantsev@adguard.com> Date: Fri Jul 24 14:15:46 2026 +0300 bamboo-specs: fmt; commit 0497ddf Author: Maksim Kazantsev <m.kazantsev@adguard.com> Date: Fri Jul 24 13:54:20 2026 +0300 bamboo-specs: fmt; commit 52ab575 Author: Maksim Kazantsev <m.kazantsev@adguard.com> Date: Fri Jul 24 13:44:28 2026 +0300 bamboo-specs: imp docs; commit 04b004a Author: Maksim Kazantsev <m.kazantsev@adguard.com> Date: Fri Jul 24 13:40:49 2026 +0300 bamboo-specs: fix ci;
1 parent e8e3287 commit 5c44c4b

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

bamboo-specs/test.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,17 @@
174174
# The version.sh script queries the current state of the git
175175
# repository, so we must explicitly checkout the revision that
176176
# triggered the build to prevent race conditions when the master
177-
# branch changes while this build is running.
177+
# branch changes while this build is running. Also, pass BRANCH
178+
# so that version.sh can determine the branch name even in
179+
# detached HEAD states.
178180
git checkout "${bamboo_repository_revision_number}"
179181
180-
version="$(env CHANNEL=${bamboo_channel} sh ./scripts/make/version.sh)"
182+
version="$(
183+
env \
184+
BRANCH=${bamboo_planRepository_branchName} \
185+
CHANNEL=${bamboo_channel} \
186+
sh ./scripts/make/version.sh
187+
)"
181188
readonly version
182189
183190
docker info

scripts/make/version.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ case "$channel" in
147147
last_tag="$(git describe --abbrev=0)"
148148
readonly last_tag
149149

150-
# current_branch is the name of the branch currently checked out.
151-
current_branch="$(git rev-parse --abbrev-ref HEAD)"
150+
# current_branch is the name of the branch. Prefer the BRANCH
151+
# environment variable when set, since 'git rev-parse --abbrev-ref HEAD'
152+
# returns 'HEAD' in detached HEAD states (e.g. after 'git checkout
153+
# <commit>').
154+
current_branch="${BRANCH:-$(git rev-parse --abbrev-ref HEAD)}"
152155
readonly current_branch
153156

154157
# The branch should be named like:

0 commit comments

Comments
 (0)