This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git
The following commit(s) were added to refs/heads/main by this push:
new 742c676 snap: update tag and fix build with newer snapcraft version
(#191)
742c676 is described below
commit 742c676653ece0bd0a309c1166da24955055173e
Author: Abhishek Kumar <[email protected]>
AuthorDate: Mon Sep 1 20:39:56 2025 +0530
snap: update tag and fix build with newer snapcraft version (#191)
Signed-off-by: Abhishek Kumar <[email protected]>
---
README.md | 2 +-
snap/snapcraft.yaml | 72 ++++++++++++++++++++++++++++++++---------------------
2 files changed, 45 insertions(+), 29 deletions(-)
diff --git a/README.md b/README.md
index 613dfae..be285a1 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## CloudMonkey [](https://travis-ci.com/apache/cloudstack-cloudmonkey)[](https://hub.docker.com/r/apache/cloudstack-cloudmonkey)[](https://snapcraft.io/cloudmonkey)
+## CloudMonkey [](https://github.com/apache/cloudstack/actions/workflows/build.yml)
[](https://github.com/apache/cloudstack-cloudmonkey/actions/workflows/rat.yamll)
[
[...]
`cloudmonkey` :cloud::monkey_face: is a command line interface (CLI) for
[Apache CloudStack](http://cloudstack.apache.org).
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index e068632..374fb69 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,45 +1,61 @@
name: cloudmonkey
-version: git
+# define the tag anchor on the allowed 'version' field
+version: &release_tag 6.5.0
summary: Apache CloudStack CLI
description: |
- An CLI and interactive shell that simplifies configuration and management of
+ A CLI and interactive shell that simplifies configuration and management of
Apache CloudStack, the opensource IAAS cloud computing platform.
-base: core18
+base: core22
license: Apache-2.0
grade: stable
confinement: strict
+adopt-info: cloudmonkey
apps:
cloudmonkey:
command: bin/cmk
- plugs:
- - home
- - network
+ plugs: [home, network]
parts:
cloudmonkey:
- source: .
- source-type: git
- source-tag: 6.1.0
plugin: go
- go-importpath: github.com/apache/cloudstack-cloudmonkey
- build-packages:
- - gcc
- - make
- - file
- - git
+ source: &cmk_repo https://github.com/apache/cloudstack-cloudmonkey.git
+ source-type: git
+ source-tag: *release_tag
+ source-depth: 1
+
+ build-snaps: [go]
+ build-packages: [git, file, binutils]
+
+ build-environment:
+ - CMK_REPO: *cmk_repo
+ - CMK_TAG: *release_tag
+
+ override-pull: |
+ set -euo pipefail
+ craftctl default
+ REPO="${CMK_REPO}"
+ TAG="${CMK_TAG}"
+ # Try to get the dereferenced commit for annotated tags first
+ FULL_SHA="$(git ls-remote "${REPO}" "refs/tags/${TAG}^{}" | awk '{print
$1}')"
+ # If not found, fall back to the tag object itself
+ if [ -z "${FULL_SHA}" ]; then
+ FULL_SHA="$(git ls-remote "${REPO}" "refs/tags/${TAG}" | awk '{print
$1}')"
+ fi
+ SHORT_SHA="${FULL_SHA:0:7}"
+ : "${SHORT_SHA:=unknown}"
+ echo "${SHORT_SHA}" > "$CRAFT_PART_SRC/.remote-sha"
+ craftctl set version="${TAG}-${SHORT_SHA}"
+
override-build: |
- set -eu
- go version
- go mod vendor
- git checkout -- .
- git status
- git rev-parse HEAD
- go build -mod=vendor -ldflags="-s -w -X main.GitSHA=$(git rev-parse
--short HEAD) -X main.BuildDate=$(date +%FT%T%z)" -o cmk cmk.go
- file cmk
- chmod +x cmk
- ./cmk -v
- mkdir -p $SNAPCRAFT_PART_INSTALL/bin
- mv cmk $SNAPCRAFT_PART_INSTALL/bin/
- strip --remove-section=.comment --remove-section=.note
$SNAPCRAFT_PART_INSTALL/bin/cmk
+ set -euo pipefail
+ cd "$CRAFT_PART_SRC"
+ SHORT_SHA="$(cat .remote-sha 2>/dev/null || echo unknown)"
+ BUILD_DATE="$(date +%FT%T%z)"
+ go mod vendor || true
+ go build -trimpath \
+ -ldflags "-s -w -X main.GitSHA=${SHORT_SHA} -X
main.BuildDate=${BUILD_DATE}" \
+ -o cmk cmk.go
+ install -Dm0755 cmk "$CRAFT_PART_INSTALL/bin/cmk"
+ strip --remove-section=.comment --remove-section=.note
"$CRAFT_PART_INSTALL/bin/cmk" || true