Merge ~xavpaice/charm-kubernetes-service-checks:add_charmcraft into charm-kubernetes-service-checks:master

Proposed by Xav Paice
Status: Merged
Approved by: James Troup
Approved revision: 33c97e92865b11359da61eb978c1ecd8471fee51
Merged at revision: c692111c9a061d0fa12a56e56210aea0869b5177
Proposed branch: ~xavpaice/charm-kubernetes-service-checks:add_charmcraft
Merge into: charm-kubernetes-service-checks:master
Diff against target: 131 lines (+42/-9)
6 files modified
.gitignore (+1/-0)
Makefile (+11/-6)
charmcraft.yaml (+15/-0)
rename.sh (+13/-0)
tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 (+1/-1)
tox.ini (+1/-2)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
BootStack Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+417008@code.launchpad.net

Commit message

add/update charmcraft.yaml

To post a comment you must log in.
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision c692111c9a061d0fa12a56e56210aea0869b5177

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 5237a11..43df031 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -40,3 +40,4 @@ dist/
6 # Builds
7 .build/
8 build/
9+*.charm
10diff --git a/Makefile b/Makefile
11index cb7ac8b..a99dd3b 100644
12--- a/Makefile
13+++ b/Makefile
14@@ -4,6 +4,9 @@ PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))
15 ifndef CHARM_BUILD_DIR
16 CHARM_BUILD_DIR=${PROJECTPATH}.build
17 endif
18+ifdef CONTAINER
19+ BUILD_ARGS="--destructive-mode"
20+endif
21 METADATA_FILE="metadata.yaml"
22 CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E '^name:' | awk '{print $$2}')
23
24@@ -29,6 +32,8 @@ clean:
25 @git clean -ffXd -e '!.idea'
26 @echo "Cleaning existing build"
27 @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
28+ @charmcraft clean
29+ @rm -rf ${PROJECTPATH}/${CHARM_NAME}.charm
30
31 submodules:
32 @echo "Cloning submodules"
33@@ -38,14 +43,14 @@ submodules-update:
34 @echo "Pulling latest updates for submodules"
35 @git submodule update --init --recursive --remote --merge
36
37-build:
38+build: clean submodules-update
39 @echo "Building charm to base directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
40 @-git rev-parse --abbrev-ref HEAD > ./repo-info
41 @-git describe --always > ./version
42- @mkdir -p ${CHARM_BUILD_DIR}
43- @tox -e build
44- @mv ${CHARM_NAME}.charm ${CHARM_BUILD_DIR}
45-
46+ @charmcraft -v pack ${BUILD_ARGS}
47+ @bash -c ./rename.sh
48+ @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
49+ @unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}
50
51 release: clean build unpack
52 @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
53@@ -79,7 +84,7 @@ unittests:
54
55 functional: build
56 @echo "Executing functional tests in ${CHARM_BUILD_DIR}"
57- @CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func
58+ @CHARM_LOCATION=${PROJECTPATH} tox -e func
59
60 test: lint proof unittests functional
61 @echo "Tests completed for charm ${CHARM_NAME}."
62diff --git a/charmcraft.yaml b/charmcraft.yaml
63new file mode 100644
64index 0000000..3e89d20
65--- /dev/null
66+++ b/charmcraft.yaml
67@@ -0,0 +1,15 @@
68+type: charm
69+bases:
70+ - build-on:
71+ - name: ubuntu
72+ channel: "20.04"
73+ architectures: ["amd64"]
74+ run-on:
75+ - name: ubuntu
76+ channel: "20.04"
77+ architectures:
78+ - amd64
79+ - name: ubuntu
80+ channel: "18.04"
81+ architectures:
82+ - amd64
83diff --git a/rename.sh b/rename.sh
84new file mode 100755
85index 0000000..956a76b
86--- /dev/null
87+++ b/rename.sh
88@@ -0,0 +1,13 @@
89+#!/bin/bash
90+charm=$(grep -E "^name:" metadata.yaml | awk '{print $2}')
91+echo "renaming ${charm}_*.charm to ${charm}.charm"
92+echo -n "pwd: "
93+pwd
94+ls -al
95+echo "Removing previous charm if it exists"
96+if [[ -e "${charm}.charm" ]];
97+then
98+ rm "${charm}.charm"
99+fi
100+echo "Renaming charm here."
101+mv ${charm}_*.charm ${charm}.charm
102diff --git a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
103index 7f59ee2..d380e43 100644
104--- a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
105+++ b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
106@@ -1,3 +1,3 @@
107 applications:
108 {{ charm_name }}:
109- charm: {{ CHARM_BUILD_DIR }}/{{ charm_name }}.charm
110+ charm: {{ CHARM_LOCATION }}/{{ charm_name }}.charm
111diff --git a/tox.ini b/tox.ini
112index a435b08..4dc1420 100644
113--- a/tox.ini
114+++ b/tox.ini
115@@ -10,7 +10,7 @@ setenv =
116 passenv =
117 HOME
118 PATH
119- CHARM_BUILD_DIR
120+ CHARM_*
121 PYTEST_KEEP_MODEL
122 PYTEST_CLOUD_NAME
123 PYTEST_CLOUD_REGION
124@@ -33,7 +33,6 @@ passenv =
125 OS_IDENTITY_API_VERSION
126
127 [testenv:build]
128-deps = charmcraft<1.1.0
129 commands = charmcraft build
130
131 [testenv:lint]

Subscribers

People subscribed via source and target branches

to all changes: