Merge ~xavpaice/charm-hw-health:update_charmcraft into charm-hw-health:master

Proposed by Xav Paice
Status: Merged
Approved by: James Troup
Approved revision: cb2d0b672fcb218607449746b9dc94c76bb75404
Merged at revision: dc935e5e83bae8f7a5d46dde6b395710a91a6328
Proposed branch: ~xavpaice/charm-hw-health:update_charmcraft
Merge into: charm-hw-health:master
Diff against target: 135 lines (+48/-15)
5 files modified
Makefile (+15/-8)
charmcraft.yaml (+18/-6)
rename.sh (+13/-0)
src/tests/functional/requirements.txt (+1/-1)
src/tox.ini (+1/-0)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack continuous-integration Approve
BootStack Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+416230@code.launchpad.net

Commit message

Update build to use charmcraft

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
🤖 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: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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 :

Change successfully merged at revision dc935e5e83bae8f7a5d46dde6b395710a91a6328

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index d83cfff..c13a65d 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -1,8 +1,10 @@
6 PYTHON := /usr/bin/python3
7
8 PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))
9+METADATA_FILE="src/metadata.yaml"
10+CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}')
11 ifndef CHARM_BUILD_DIR
12- CHARM_BUILD_DIR=${PROJECTPATH}.build
13+ CHARM_BUILD_DIR=${PROJECTPATH}/build
14 endif
15 ifndef CHARM_LAYERS_DIR
16 CHARM_LAYERS_DIR=${PROJECTPATH}/layers
17@@ -10,8 +12,9 @@ endif
18 ifndef CHARM_INTERFACES_DIR
19 CHARM_INTERFACES_DIR=${PROJECTPATH}/interfaces
20 endif
21-METADATA_FILE="src/metadata.yaml"
22-CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}')
23+ifdef CONTAINER
24+ BUILD_ARGS="--destructive-mode"
25+endif
26
27 help:
28 @echo "This project supports the following targets"
29@@ -34,7 +37,9 @@ clean:
30 @echo "Cleaning files"
31 @git clean -ffXd -e '!.idea' -e '!tools.zip'
32 @echo "Cleaning existing build"
33- @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
34+ @rm -rf ${PROJECTPATH}/${CHARM_NAME}.charm
35+ @rm -rf ${CHARM_BUILD_DIR}/*
36+ @charmcraft clean
37
38 submodules:
39 @echo "Cloning submodules"
40@@ -47,13 +52,15 @@ submodules-update:
41 @cp ./check_ipmi_sensor_v3/check_ipmi_sensor ./src/files/ipmi/check_ipmi_sensor
42
43 build: clean
44- @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
45 @-git rev-parse --abbrev-ref HEAD > ./src/repo-info
46- @CHARM_LAYERS_DIR=${CHARM_LAYERS_DIR} CHARM_INTERFACES_DIR=${CHARM_INTERFACES_DIR} \
47- TERM=linux CHARM_BUILD_DIR=${CHARM_BUILD_DIR} charm build src/
48+ @-git describe --always > ./src/version
49+ @charmcraft -v pack ${BUILD_ARGS}
50+ @bash -c ./rename.sh
51+ @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
52+ @unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}
53
54 release: build
55- @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
56+ @charmcraft upload hw-health.charm --release edge
57
58 lint:
59 @echo "Running lint checks"
60diff --git a/charmcraft.yaml b/charmcraft.yaml
61index f0ffdaa..1f750bc 100644
62--- a/charmcraft.yaml
63+++ b/charmcraft.yaml
64@@ -5,9 +5,21 @@ parts:
65 plugin: reactive
66 build-snaps: [charm]
67 bases:
68- - name: ubuntu
69- channel: "20.04"
70- architectures: ["amd64"]
71- - name: ubuntu
72- channel: "18.04"
73- architectures: ["amd64"]
74+ - build-on:
75+ - name: ubuntu
76+ channel: "20.04"
77+ architectures: ["amd64"]
78+ run-on:
79+ - name: ubuntu
80+ channel: "20.04"
81+ architectures:
82+ - amd64
83+ - name: ubuntu
84+ channel: "18.04"
85+ architectures:
86+ - amd64
87+ - name: ubuntu
88+ channel: "16.04"
89+ architectures:
90+ - amd64
91+
92diff --git a/rename.sh b/rename.sh
93new file mode 100755
94index 0000000..bc8697f
95--- /dev/null
96+++ b/rename.sh
97@@ -0,0 +1,13 @@
98+#!/bin/bash
99+charm=$(grep -E "^name:" src/metadata.yaml | awk '{print $2}')
100+echo "renaming ${charm}_*.charm to ${charm}.charm"
101+echo -n "pwd: "
102+pwd
103+ls -al
104+echo "Removing previous charm if it exists"
105+if [[ -e "${charm}.charm" ]];
106+then
107+ rm "${charm}.charm"
108+fi
109+echo "Renaming charm here."
110+mv ${charm}_*.charm ${charm}.charm
111diff --git a/src/tests/functional/requirements.txt b/src/tests/functional/requirements.txt
112index d5f7955..a10cbae 100644
113--- a/src/tests/functional/requirements.txt
114+++ b/src/tests/functional/requirements.txt
115@@ -2,7 +2,7 @@ flake8
116 juju
117 mock
118 pytest<6
119-pytest-asyncio
120+pytest-asyncio<0.17.*
121 requests
122 charmhelpers
123 charms.reactive
124diff --git a/src/tox.ini b/src/tox.ini
125index b392f62..44f1913 100644
126--- a/src/tox.ini
127+++ b/src/tox.ini
128@@ -21,6 +21,7 @@ passenv =
129 NO_PROXY
130 SNAP_HTTP_PROXY
131 SNAP_HTTPS_PROXY
132+ OS_*
133
134 [testenv:lint]
135 commands =

Subscribers

People subscribed via source and target branches

to all changes: