Merge ~sudeephb/charm-prometheus-blackbox-exporter:22.10 into charm-prometheus-blackbox-exporter:master

Proposed by Sudeep Bhandari
Status: Merged
Approved by: Eric Chen
Approved revision: e21a9b650bdbcd8c54b65d879ea631e2ccab0882
Merged at revision: dc85d679b6a74a4c67756130227270e27efadd4e
Proposed branch: ~sudeephb/charm-prometheus-blackbox-exporter:22.10
Merge into: charm-prometheus-blackbox-exporter:master
Diff against target: 310 lines (+73/-35)
17 files modified
Makefile (+13/-6)
charmcraft.yaml (+24/-0)
dev/null (+0/-16)
metadata.yaml (+1/-0)
rename.sh (+13/-0)
src/metadata.yaml (+1/-4)
src/tests/functional/requirements.txt (+1/-0)
src/tests/functional/tests/bundles/base.yaml (+2/-3)
src/tests/functional/tests/bundles/bionic.yaml (+1/-0)
src/tests/functional/tests/bundles/focal.yaml (+1/-0)
src/tests/functional/tests/bundles/jammy.yaml (+1/-0)
src/tests/functional/tests/bundles/overlays/bionic.yaml.j2 (+1/-0)
src/tests/functional/tests/bundles/overlays/focal.yaml.j2 (+1/-0)
src/tests/functional/tests/bundles/overlays/jammy.yaml.j2 (+4/-0)
src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 (+1/-1)
src/tests/functional/tests/tests.yaml (+3/-3)
src/tox.ini (+5/-2)
Reviewer Review Type Date Requested Status
Eric Chen Approve
Tianqi Xiao (community) Approve
Review via email: mp+429938@code.launchpad.net

Commit message

Added charmcraft, support for jammy

To post a comment you must log in.
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
Sudeep Bhandari (sudeephb) wrote :
Revision history for this message
Tianqi Xiao (txiao) wrote :

LGTM

review: Approve
Revision history for this message
Eric Chen (eric-chen) :
review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision dc85d679b6a74a4c67756130227270e27efadd4e

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index a3b073d..6259dbc 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -2,7 +2,7 @@ PYTHON := /usr/bin/python3
6
7 PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))
8 ifndef CHARM_BUILD_DIR
9- CHARM_BUILD_DIR=${PROJECTPATH}.build
10+ CHARM_BUILD_DIR=${PROJECTPATH}/build
11 endif
12 ifndef CHARM_LAYERS_DIR
13 CHARM_LAYERS_DIR=${PROJECTPATH}/layers
14@@ -10,6 +10,9 @@ endif
15 ifndef CHARM_INTERFACES_DIR
16 CHARM_INTERFACES_DIR=${PROJECTPATH}/interfaces
17 endif
18+ifdef CONTAINER
19+ BUILD_ARGS="--destructive-mode"
20+endif
21 METADATA_FILE="src/metadata.yaml"
22 CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}')
23
24@@ -35,6 +38,8 @@ clean:
25 @git clean -ffXd -e '!.idea'
26 @echo "Cleaning existing build"
27 @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
28+ @rm -rf ${PROJECTPATH}/${CHARM_NAME}.charm
29+ @charmcraft clean
30
31 submodules:
32 # @git submodule update --init --recursive
33@@ -44,11 +49,13 @@ submodules-update:
34 # @git submodule update --init --recursive --remote --merge
35 @echo "No submodules. Skipping."
36
37-build:
38- @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
39+build: clean
40+ @echo "Building charm"
41 @-git rev-parse --abbrev-ref HEAD > ./src/repo-info
42- @CHARM_LAYERS_DIR=${CHARM_LAYERS_DIR} CHARM_INTERFACES_DIR=${CHARM_INTERFACES_DIR} \
43- TERM=linux CHARM_BUILD_DIR=${CHARM_BUILD_DIR} charm build src/
44+ @charmcraft -v pack ${BUILD_ARGS}
45+ @bash -c ./rename.sh
46+ @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
47+ @unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}
48
49 release: clean build
50 @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
51@@ -71,7 +78,7 @@ unittests:
52
53 functional: build
54 @echo "Executing functional tests in ${CHARM_BUILD_DIR}"
55- @cd src && CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func
56+ @cd src && CHARM_LOCATION=${PROJECTPATH} tox -e func
57
58 test: lint proof unittests functional
59 @echo "Tests completed for charm ${CHARM_NAME}."
60diff --git a/charmcraft.yaml b/charmcraft.yaml
61new file mode 100644
62index 0000000..7e84403
63--- /dev/null
64+++ b/charmcraft.yaml
65@@ -0,0 +1,24 @@
66+type: charm
67+parts:
68+ charm:
69+ source: src
70+ plugin: reactive
71+ build-snaps: [charm]
72+bases:
73+ - build-on:
74+ - name: ubuntu
75+ channel: "22.04"
76+ architectures: ["amd64"]
77+ run-on:
78+ - name: ubuntu
79+ channel: "22.04"
80+ architectures:
81+ - amd64
82+ - name: ubuntu
83+ channel: "20.04"
84+ architectures:
85+ - amd64
86+ - name: ubuntu
87+ channel: "18.04"
88+ architectures:
89+ - amd64
90diff --git a/metadata.yaml b/metadata.yaml
91new file mode 120000
92index 0000000..0768683
93--- /dev/null
94+++ b/metadata.yaml
95@@ -0,0 +1 @@
96+src/metadata.yaml
97\ No newline at end of file
98diff --git a/rename.sh b/rename.sh
99new file mode 100755
100index 0000000..bc8697f
101--- /dev/null
102+++ b/rename.sh
103@@ -0,0 +1,13 @@
104+#!/bin/bash
105+charm=$(grep -E "^name:" src/metadata.yaml | awk '{print $2}')
106+echo "renaming ${charm}_*.charm to ${charm}.charm"
107+echo -n "pwd: "
108+pwd
109+ls -al
110+echo "Removing previous charm if it exists"
111+if [[ -e "${charm}.charm" ]];
112+then
113+ rm "${charm}.charm"
114+fi
115+echo "Renaming charm here."
116+mv ${charm}_*.charm ${charm}.charm
117diff --git a/src/metadata.yaml b/src/metadata.yaml
118index 6a9436b..aed47d5 100644
119--- a/src/metadata.yaml
120+++ b/src/metadata.yaml
121@@ -6,10 +6,7 @@ description: |
122 endpoints over HTTP, HTTPS, DNS, TCP and ICMP.
123 tags:
124 - monitoring
125-series:
126- - xenial
127- - bionic
128- - focal
129+series: []
130 subordinate: false
131 provides:
132 blackbox-exporter:
133diff --git a/src/tests/functional/requirements.txt b/src/tests/functional/requirements.txt
134index b7c9112..48e28b2 100644
135--- a/src/tests/functional/requirements.txt
136+++ b/src/tests/functional/requirements.txt
137@@ -1 +1,2 @@
138 git+https://github.com/openstack-charmers/zaza.git#egg=zaza
139+python-openstackclient
140\ No newline at end of file
141diff --git a/src/tests/functional/tests/bundles/bionic.yaml b/src/tests/functional/tests/bundles/base.yaml
142similarity index 83%
143rename from src/tests/functional/tests/bundles/bionic.yaml
144rename to src/tests/functional/tests/bundles/base.yaml
145index 4b510f1..6a6be3e 100644
146--- a/src/tests/functional/tests/bundles/bionic.yaml
147+++ b/src/tests/functional/tests/bundles/base.yaml
148@@ -1,13 +1,12 @@
149-series: bionic
150 applications:
151 prometheus-blackbox-exporter:
152 options:
153 snap_channel: stable
154 num_units: 1
155 nrpe:
156- charm: cs:nrpe
157+ charm: ch:nrpe
158 prometheus:
159- charm: cs:prometheus2
160+ charm: ch:prometheus2
161 num_units: 1
162 relations:
163 - - prometheus-blackbox-exporter:nrpe-external-master
164diff --git a/src/tests/functional/tests/bundles/bionic.yaml b/src/tests/functional/tests/bundles/bionic.yaml
165new file mode 120000
166index 0000000..f81f6ff
167--- /dev/null
168+++ b/src/tests/functional/tests/bundles/bionic.yaml
169@@ -0,0 +1 @@
170+base.yaml
171\ No newline at end of file
172diff --git a/src/tests/functional/tests/bundles/focal.yaml b/src/tests/functional/tests/bundles/focal.yaml
173new file mode 120000
174index 0000000..f81f6ff
175--- /dev/null
176+++ b/src/tests/functional/tests/bundles/focal.yaml
177@@ -0,0 +1 @@
178+base.yaml
179\ No newline at end of file
180diff --git a/src/tests/functional/tests/bundles/focal.yaml b/src/tests/functional/tests/bundles/focal.yaml
181deleted file mode 100644
182index 2f3dc6c..0000000
183--- a/src/tests/functional/tests/bundles/focal.yaml
184+++ /dev/null
185@@ -1,16 +0,0 @@
186-series: focal
187-applications:
188- prometheus-blackbox-exporter:
189- options:
190- snap_channel: stable
191- num_units: 1
192- nrpe:
193- charm: cs:nrpe
194- prometheus:
195- charm: cs:prometheus2
196- num_units: 1
197-relations:
198- - - prometheus-blackbox-exporter:nrpe-external-master
199- - nrpe:nrpe-external-master
200- - - prometheus-blackbox-exporter:blackbox-exporter
201- - prometheus:target
202\ No newline at end of file
203diff --git a/src/tests/functional/tests/bundles/jammy.yaml b/src/tests/functional/tests/bundles/jammy.yaml
204new file mode 120000
205index 0000000..f81f6ff
206--- /dev/null
207+++ b/src/tests/functional/tests/bundles/jammy.yaml
208@@ -0,0 +1 @@
209+base.yaml
210\ No newline at end of file
211diff --git a/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2 b/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
212new file mode 100644
213index 0000000..65b2826
214--- /dev/null
215+++ b/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
216@@ -0,0 +1 @@
217+series: bionic
218diff --git a/src/tests/functional/tests/bundles/overlays/focal.yaml.j2 b/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
219new file mode 100644
220index 0000000..d3f46ab
221--- /dev/null
222+++ b/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
223@@ -0,0 +1 @@
224+series: focal
225diff --git a/src/tests/functional/tests/bundles/overlays/jammy.yaml.j2 b/src/tests/functional/tests/bundles/overlays/jammy.yaml.j2
226new file mode 100644
227index 0000000..63f8d44
228--- /dev/null
229+++ b/src/tests/functional/tests/bundles/overlays/jammy.yaml.j2
230@@ -0,0 +1,4 @@
231+series: jammy
232+applications:
233+ prometheus:
234+ series: focal
235\ No newline at end of file
236diff --git a/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
237index df81abd..14ace0e 100644
238--- a/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
239+++ b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
240@@ -1,3 +1,3 @@
241 applications:
242 prometheus-blackbox-exporter:
243- charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"
244+ charm: "{{ CHARM_LOCATION }}/{{ charm_name }}.charm"
245diff --git a/src/tests/functional/tests/bundles/xenial.yaml b/src/tests/functional/tests/bundles/xenial.yaml
246deleted file mode 100644
247index be4f6dc..0000000
248--- a/src/tests/functional/tests/bundles/xenial.yaml
249+++ /dev/null
250@@ -1,16 +0,0 @@
251-series: xenial
252-applications:
253- prometheus-blackbox-exporter:
254- options:
255- snap_channel: stable
256- num_units: 1
257- nrpe:
258- charm: cs:nrpe
259- prometheus:
260- charm: cs:prometheus2
261- num_units: 1
262-relations:
263- - - prometheus-blackbox-exporter:nrpe-external-master
264- - nrpe:nrpe-external-master
265- - - prometheus-blackbox-exporter:blackbox-exporter
266- - prometheus:target
267\ No newline at end of file
268diff --git a/src/tests/functional/tests/tests.yaml b/src/tests/functional/tests/tests.yaml
269index 3922dd1..bbb8e8b 100644
270--- a/src/tests/functional/tests/tests.yaml
271+++ b/src/tests/functional/tests/tests.yaml
272@@ -1,12 +1,12 @@
273 charm_name: prometheus-blackbox-exporter
274 gate_bundles:
275+ - jammy
276 - focal
277 - bionic
278- - xenial
279 smoke_bundles:
280- - bionic
281+ - jammy
282 dev_bundles:
283- - bionic
284+ - jammy
285 tests:
286 - tests.test_prometheus_blackbox_exporter.CharmOperationTest
287 target_deploy_status:
288diff --git a/src/tox.ini b/src/tox.ini
289index 4214c14..5ae440a 100644
290--- a/src/tox.ini
291+++ b/src/tox.ini
292@@ -10,7 +10,10 @@ setenv =
293 passenv =
294 HOME
295 PATH
296- CHARM_BUILD_DIR
297+ PROJECTPATH
298+ OS_*
299+ CHARM_*
300+ ZAZA_*
301 PYTEST_KEEP_MODEL
302 PYTEST_CLOUD_NAME
303 PYTEST_CLOUD_REGION
304@@ -61,5 +64,5 @@ deps = -r{toxinidir}/tests/unit/requirements.txt
305
306 [testenv:func]
307 changedir = {toxinidir}/tests/functional
308-commands = functest-run-suite {posargs}
309+commands = functest-run-suite --keep-faulty-model {posargs}
310 deps = -r{toxinidir}/tests/functional/requirements.txt

Subscribers

People subscribed via source and target branches

to all changes: