Skip to content

Commit 9857760

Browse files
committed
snapcraft: update with customised go binary building
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 407640f commit 9857760

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

snap/snapcraft.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
name: cloudmonkey
2-
base: core18
32
version: git
43
summary: Apache CloudStack CLI
54
description: |
65
An CLI and interactive shell that simplifies configuration and management of
76
Apache CloudStack, the opensource IAAS cloud computing platform.
8-
7+
license: Apache-2.0
98
grade: stable
109
confinement: strict
1110

12-
license: Apache-2.0
13-
1411
apps:
1512
cloudmonkey:
16-
command: bin/cloudstack-cloudmonkey
13+
command: bin/cmk
1714
plugs:
1815
- home
1916
- network
20-
#- personal-files
21-
22-
#plugs:
23-
# network:
24-
# personal-files:
25-
# read:
26-
# - $HOME/.cmk
27-
# write:
28-
# - $HOME/.cmk
2917

3018
parts:
19+
go:
20+
source-tag: go1.12.1
3121
cloudmonkey:
32-
source: .
22+
after: [go]
23+
source: https://github.com/apache/cloudstack-cloudmonkey
3324
source-type: git
25+
source-tag: 6.0.0
3426
plugin: go
3527
go-importpath: github.com/apache/cloudstack-cloudmonkey
3628
build-packages:
3729
- gcc
30+
- make
31+
- file
32+
override-build: |
33+
set -eu
34+
go version
35+
GIT_SHA=$(git rev-parse --short HEAD)
36+
DATE=$(date +%FT%T%z)
37+
go build -mod=vendor -ldflags='-s -w -X main.GitSHA=$(GIT_SHA) -X main.BuildDate=$(DATE)' -o cmk cmk.go
38+
file cmk
39+
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
40+
mv cmk $SNAPCRAFT_PART_INSTALL/bin/
41+
strip --remove-section=.comment --remove-section=.note $SNAPCRAFT_PART_INSTALL/bin/cmk

0 commit comments

Comments
 (0)