From ed5c04393ea7be2dd468ecb17e8fd75891da9c1a Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 26 Aug 2025 16:23:44 +0530 Subject: [PATCH 1/5] snap: update tag and fix build with latest snapcraft version Signed-off-by: Abhishek Kumar --- snap/snapcraft.yaml | 67 ++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e068632a..8b198bc9 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,45 +1,56 @@ name: cloudmonkey -version: git +# define the tag anchor on the allowed 'version' field +version: &release_tag 6.4.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}" + FULL_SHA="$(git ls-remote "${REPO}" "refs/tags/${TAG}" | awk '{print $1}')" + 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 From d36fabb50754af620a203b64bce3042b14bb0bf9 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 27 Aug 2025 12:10:07 +0530 Subject: [PATCH 2/5] get dereferenced commit for the tag first MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 a6699e3b438f53d56dcdac4c2d2a0dd1506d28c6 refs/tags/6.4.0 df65df7cfe331c5af5d39743717e3d58df921a48 refs/tags/6.4.0^{} 2d641ae9bfab101f7009b22ca6b2a5764224238d refs/tags/6.4.0-rc1 Signed-off-by: Abhishek Kumar --- snap/snapcraft.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8b198bc9..7484955e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -37,7 +37,12 @@ parts: craftctl default REPO="${CMK_REPO}" TAG="${CMK_TAG}" - FULL_SHA="$(git ls-remote "${REPO}" "refs/tags/${TAG}" | awk '{print $1}')" + # 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" From 2569d51fea5928e93eff9b8514fddbc784fb07d2 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 27 Aug 2025 13:44:56 +0530 Subject: [PATCH 3/5] snap button for readme Signed-off-by: Abhishek Kumar --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 613dfaec..9c0777ca 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ can be used with Apache CloudStack 4.0-incubating and above. For documentation, kindly see the [wiki](https://github.com/apache/cloudstack-cloudmonkey/wiki). +[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/cloudmonkey) + ### Development To develop CloudMonkey, you need Go 1.11 or later and a unix-like From e62e05e78863bad3d4b9c0c737d4e827454399f1 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 1 Sep 2025 16:06:47 +0530 Subject: [PATCH 4/5] fix Signed-off-by: Abhishek Kumar --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 9c0777ca..be285a10 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## CloudMonkey [![Build Status](https://travis-ci.com/apache/cloudstack-cloudmonkey.svg?branch=main)](https://travis-ci.com/apache/cloudstack-cloudmonkey)[![](https://images.microbadger.com/badges/version/apache/cloudstack-cloudmonkey.svg)](https://hub.docker.com/r/apache/cloudstack-cloudmonkey)[![cloudmonkey](https://snapcraft.io/cloudmonkey/badge.svg)](https://snapcraft.io/cloudmonkey) +## CloudMonkey [![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) [![RAT Check](https://github.com/apache/cloudstack-cloudmonkey/actions/workflows/rat.yaml/badge.svg?branch=main)](https://github.com/apache/cloudstack-cloudmonkey/actions/workflows/rat.yamll) [![Lint Check](https://github.com/apache/cloudstack-cloudmonkey/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack-cloudmonkey/actions/workflows/lint.yml) [![](https://images.microbadger.com/badges/version/apache/cloudstack-cloudmonkey.svg)](https://hub.docker.com/r/apache/cloudstack-cloudmonkey) [![cloudmonkey](https://snapcraft.io/cloudmonkey/badge.svg)](https://snapcraft.io/cloudmonkey) `cloudmonkey` :cloud::monkey_face: is a command line interface (CLI) for [Apache CloudStack](http://cloudstack.apache.org). @@ -10,8 +10,6 @@ can be used with Apache CloudStack 4.0-incubating and above. For documentation, kindly see the [wiki](https://github.com/apache/cloudstack-cloudmonkey/wiki). -[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/cloudmonkey) - ### Development To develop CloudMonkey, you need Go 1.11 or later and a unix-like From bdb474974722978ec0d4fa22ecc1f534ff69ea00 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 1 Sep 2025 16:07:32 +0530 Subject: [PATCH 5/5] bump version Signed-off-by: Abhishek Kumar --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7484955e..374fb691 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: cloudmonkey # define the tag anchor on the allowed 'version' field -version: &release_tag 6.4.0 +version: &release_tag 6.5.0 summary: Apache CloudStack CLI description: | A CLI and interactive shell that simplifies configuration and management of