Skip to content

Commit

Permalink
fix(snap): use tag for snap version when present in the build metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsgruk committed Sep 19, 2024
1 parent c1986c9 commit a3fefff
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ parts:
- jq
- libjq1
override-build: |
# Set the version of Parca Agent snap based on goreleaser build
craftctl set version="$(cat metadata.json | jq -r '.version')"
# Set the version of Parca Agent snap based on goreleaser build. Use the tag if one is
# present, otherwise use the version field which produces a string like "HEAD-c1986c91"
tag="$(cat metadata.json | jq -r '.tag')"
if [[ "$tag" == "v0.0.0" ]]; then
craftctl set version="$(cat metadata.json | jq -r '.version')"
else
craftctl set version="$tag"
fi
# Copy the binary and wrapper into place
cp parca-agent $CRAFT_PART_INSTALL/
Expand Down

0 comments on commit a3fefff

Please sign in to comment.