Skip to content

Commit d36fabb

Browse files
committed
get dereferenced commit for the tag first
Tag 6.4.0 was creating a mismatch ⇒ git ls-remote --tags https://github.com/apache/cloudstack-cloudmonkey.git | grep "refs/tags/6.4.0" 6.4.0|…6 a6699e3 refs/tags/6.4.0 df65df7 refs/tags/6.4.0^{} 2d641ae refs/tags/6.4.0-rc1 Signed-off-by: Abhishek Kumar <[email protected]>
1 parent ed5c043 commit d36fabb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

snap/snapcraft.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ parts:
3737
craftctl default
3838
REPO="${CMK_REPO}"
3939
TAG="${CMK_TAG}"
40-
FULL_SHA="$(git ls-remote "${REPO}" "refs/tags/${TAG}" | awk '{print $1}')"
40+
# Try to get the dereferenced commit for annotated tags first
41+
FULL_SHA="$(git ls-remote "${REPO}" "refs/tags/${TAG}^{}" | awk '{print $1}')"
42+
# If not found, fall back to the tag object itself
43+
if [ -z "${FULL_SHA}" ]; then
44+
FULL_SHA="$(git ls-remote "${REPO}" "refs/tags/${TAG}" | awk '{print $1}')"
45+
fi
4146
SHORT_SHA="${FULL_SHA:0:7}"
4247
: "${SHORT_SHA:=unknown}"
4348
echo "${SHORT_SHA}" > "$CRAFT_PART_SRC/.remote-sha"

0 commit comments

Comments
 (0)