Merge ~afreiberger/charm-kubernetes-service-checks:update-operator-build into charm-kubernetes-service-checks:master

Proposed by Drew Freiberger
Status: Merged
Merged at revision: 200cfd582fadc81de780ffd71de3437e8fb92999
Proposed branch: ~afreiberger/charm-kubernetes-service-checks:update-operator-build
Merge into: charm-kubernetes-service-checks:master
Diff against target: 196 lines (+36/-15)
8 files modified
.gitignore (+2/-1)
Makefile (+19/-9)
dev/null (+0/-1)
requirements.txt (+2/-0)
tests/functional/tests/bundles/base.yaml (+1/-2)
tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 (+3/-0)
tests/functional/tests/tests.yaml (+3/-2)
tox.ini (+6/-0)
Reviewer Review Type Date Requested Status
Drew Freiberger (community) Approve
Alvaro Uria (community) Approve
Review via email: mp+392543@code.launchpad.net

Commit message

Refactored Makefile and functional tests to use charmcraft build

Removed submodules in favor of charmcraft venv requirements.txt
Also updated nrpe expected blocked status to tests.yaml

To post a comment you must log in.
Revision history for this message
Drew Freiberger (afreiberger) wrote :

tests all pass with this merged.

Suggest a pass by Alvaro to review this commit in particular and get a +1 from Jeremy to officially release the charm as a whole.

Revision history for this message
Alvaro Uria (aluria) wrote :

All testing passed (in serverstack, since bundles have cpu/mem resources contraints), and code lgtm. +1.

review: Approve
Revision history for this message
Drew Freiberger (afreiberger) wrote :

Approved. testing passes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 6f1f367..5237a11 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -38,4 +38,5 @@ dist/
6 *.snap
7
8 # Builds
9-.build/
10\ No newline at end of file
11+.build/
12+build/
13diff --git a/.gitmodules b/.gitmodules
14deleted file mode 100644
15index 2970f9f..0000000
16--- a/.gitmodules
17+++ /dev/null
18@@ -1,6 +0,0 @@
19-[submodule "mod/operator"]
20- path = mod/operator
21- url = https://github.com/canonical/operator.git
22-[submodule "mod/charm-helpers"]
23- path = mod/charm-helpers
24- url = https://github.com/juju/charm-helpers.git
25diff --git a/Makefile b/Makefile
26index c8be267..cb7ac8b 100644
27--- a/Makefile
28+++ b/Makefile
29@@ -42,15 +42,25 @@ build:
30 @echo "Building charm to base directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
31 @-git rev-parse --abbrev-ref HEAD > ./repo-info
32 @-git describe --always > ./version
33- @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
34- @cp -a ./* ${CHARM_BUILD_DIR}/${CHARM_NAME}
35- @echo "Installing/updating env if requirements.txt exists"
36- @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}/env/
37- @if [ -f requirements.txt ] ; then pip3 install --target=${CHARM_BUILD_DIR}/${CHARM_NAME}/env -r requirements.txt --upgrade ; fi
38+ @mkdir -p ${CHARM_BUILD_DIR}
39+ @tox -e build
40+ @mv ${CHARM_NAME}.charm ${CHARM_BUILD_DIR}
41+
42
43-release: clean build
44+release: clean build unpack
45 @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
46
47+unpack: build
48+ @-rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
49+ @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
50+ @echo "Unpacking built .charm into ${CHARM_BUILD_DIR}/${CHARM_NAME}"
51+ @cd ${CHARM_BUILD_DIR}/${CHARM_NAME} && unzip -q ${CHARM_BUILD_DIR}/${CHARM_NAME}.charm
52+ # until charmcraft copies READMEs in, we need to publish charms with readmes in them.
53+ @cp ${PROJECTPATH}/README.md ${CHARM_BUILD_DIR}/${CHARM_NAME}
54+ @cp ${PROJECTPATH}/copyright ${CHARM_BUILD_DIR}/${CHARM_NAME}
55+ @cp ${PROJECTPATH}/repo-info ${CHARM_BUILD_DIR}/${CHARM_NAME}
56+ @cp ${PROJECTPATH}/version ${CHARM_BUILD_DIR}/${CHARM_NAME}
57+
58 lint:
59 @echo "Running lint checks"
60 @tox -e lint
61@@ -59,9 +69,9 @@ black:
62 @echo "Reformat files with black"
63 @tox -e black
64
65-proof: build
66+proof: unpack
67 @echo "Running charm proof"
68- @-charm proof ${CHARM_BUILD_DIR}/${CHARM_NAME}
69+ @charm proof ${CHARM_BUILD_DIR}/${CHARM_NAME}
70
71 unittests:
72 @echo "Running unit tests"
73@@ -75,4 +85,4 @@ test: lint proof unittests functional
74 @echo "Tests completed for charm ${CHARM_NAME}."
75
76 # The targets below don't depend on a file
77-.PHONY: help submodules submodules-update clean build release lint black proof unittests functional test
78+.PHONY: help submodules submodules-update clean build release lint black proof unittests functional test unpack
79diff --git a/lib/charmhelpers b/lib/charmhelpers
80deleted file mode 120000
81index cedc09e..0000000
82--- a/lib/charmhelpers
83+++ /dev/null
84@@ -1 +0,0 @@
85-../mod/charm-helpers/charmhelpers
86\ No newline at end of file
87diff --git a/lib/ops b/lib/ops
88deleted file mode 120000
89index d934193..0000000
90--- a/lib/ops
91+++ /dev/null
92@@ -1 +0,0 @@
93-../mod/operator/ops
94\ No newline at end of file
95diff --git a/mod/charm-helpers b/mod/charm-helpers
96deleted file mode 160000
97index 4b3602e..0000000
98--- a/mod/charm-helpers
99+++ /dev/null
100@@ -1 +0,0 @@
101-Subproject commit 4b3602e2bdf101bf58cc808264ec0c8092a67cd0
102diff --git a/mod/operator b/mod/operator
103deleted file mode 160000
104index 16da522..0000000
105--- a/mod/operator
106+++ /dev/null
107@@ -1 +0,0 @@
108-Subproject commit 16da522186980d42bb41ab55abd62e163ece9ed4
109diff --git a/requirements.txt b/requirements.txt
110new file mode 100644
111index 0000000..b12b148
112--- /dev/null
113+++ b/requirements.txt
114@@ -0,0 +1,2 @@
115+charmhelpers
116+ops
117diff --git a/tests/functional/tests/bundles/base.yaml b/tests/functional/tests/bundles/base.yaml
118index 962bdfd..0625b73 100644
119--- a/tests/functional/tests/bundles/base.yaml
120+++ b/tests/functional/tests/bundles/base.yaml
121@@ -1,7 +1,5 @@
122-series: xenial
123 applications:
124 kubernetes-service-checks:
125- charm: ../../../../
126 num_units: 1
127 containerd:
128 charm: cs:~containers/containerd
129@@ -49,6 +47,7 @@ applications:
130 constraints: cores=4 mem=4G root-disk=16G
131 options:
132 channel: 1.18/stable
133+ kubelet-extra-config: '{protectKernelDefaults: false}'
134 resources:
135 cni-amd64: 645
136 cni-arm64: 636
137diff --git a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
138new file mode 100644
139index 0000000..7f59ee2
140--- /dev/null
141+++ b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
142@@ -0,0 +1,3 @@
143+applications:
144+ {{ charm_name }}:
145+ charm: {{ CHARM_BUILD_DIR }}/{{ charm_name }}.charm
146diff --git a/tests/functional/tests/tests.yaml b/tests/functional/tests/tests.yaml
147index a195bb2..756adf1 100644
148--- a/tests/functional/tests/tests.yaml
149+++ b/tests/functional/tests/tests.yaml
150@@ -1,3 +1,4 @@
151+charm_name: kubernetes-service-checks
152 tests:
153 - tests.kubernetes_service_checks.TestChecks
154 - tests.kubernetes_service_checks.TestRelations
155@@ -24,8 +25,8 @@ target_deploy_status:
156 workload-status: active
157 workload-status-message: "Healthy with 1 known peer"
158 nrpe:
159- workload-status: active
160- workload-status-message: "ready"
161+ workload-status: blocked
162+ workload-status-message: Nagios server not configured or related
163 gate_bundles:
164 - xenial
165 - bionic
166diff --git a/tox.ini b/tox.ini
167index 4214c14..80b7f57 100644
168--- a/tox.ini
169+++ b/tox.ini
170@@ -22,6 +22,10 @@ passenv =
171 SNAP_HTTP_PROXY
172 SNAP_HTTPS_PROXY
173
174+[testenv:build]
175+deps = charmcraft
176+commands = charmcraft build
177+
178 [testenv:lint]
179 commands =
180 flake8
181@@ -41,6 +45,7 @@ exclude =
182 .tox,
183 charmhelpers,
184 mod,
185+ build,
186 .build
187
188 max-line-length = 88
189@@ -58,6 +63,7 @@ commands =
190 coverage report --omit tests/*,mod/*,.tox/*
191 coverage html --omit tests/*,mod/*,.tox/*
192 deps = -r{toxinidir}/tests/unit/requirements.txt
193+ -r{toxinidir}/requirements.txt
194
195 [testenv:func]
196 changedir = {toxinidir}/tests/functional

Subscribers

People subscribed via source and target branches

to all changes: