Merge ~xavpaice/charm-glance-sync:add_charmcraft into charm-glance-sync:master

Proposed by Xav Paice
Status: Merged
Approved by: Przemyslaw Lal
Approved revision: 0ffaf1a88656e3b041b6788a604a0091aab8476b
Merged at revision: b6440a4692cf8a3feed489a17d869443fe414389
Proposed branch: ~xavpaice/charm-glance-sync:add_charmcraft
Merge into: charm-glance-sync:master
Diff against target: 136 lines (+51/-8)
6 files modified
Makefile (+15/-6)
charmcraft.yaml (+20/-0)
metadata.yaml (+1/-0)
rename.sh (+13/-0)
src/tests/unit/requirements.txt (+0/-1)
src/tox.ini (+2/-1)
Reviewer Review Type Date Requested Status
Przemyslaw Lal Approve
🤖 prod-jenkaas-bootstack continuous-integration Approve
BootStack Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+419987@code.launchpad.net

Commit message

add charmcraft.yaml

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: Approve (continuous-integration)
Revision history for this message
Przemyslaw Lal (przemeklal) wrote :

LGTM

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

Change successfully merged at revision b6440a4692cf8a3feed489a17d869443fe414389

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 53f7685..c5f192e 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -10,6 +10,9 @@ endif
6 ifndef CHARM_INTERFACES_DIR
7 CHARM_INTERFACES_DIR=${PROJECTPATH}/interfaces
8 endif
9+ifdef CONTAINER
10+ BUILD_ARGS="--destructive-mode"
11+endif
12 METADATA_FILE="src/metadata.yaml"
13 CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}')
14
15@@ -35,20 +38,26 @@ clean:
16 @git clean -ffXd -e '!.idea'
17 @echo "Cleaning existing build"
18 @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
19+ @rm -rf ${PROJECTPATH}/${CHARM_NAME}.charm
20+ @charmcraft clean
21
22 submodules:
23+ # @echo "Cloning submodules"
24 # @git submodule update --init --recursive
25 @echo "No submodules. Skipping."
26
27 submodules-update:
28+ # @echo "Pulling latest updates for submodules"
29 # @git submodule update --init --recursive --remote --merge
30 @echo "No submodules. Skipping."
31
32-build:
33+build: clean
34 @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
35 @-git rev-parse --abbrev-ref HEAD > ./src/repo-info
36- @CHARM_LAYERS_DIR=${CHARM_LAYERS_DIR} CHARM_INTERFACES_DIR=${CHARM_INTERFACES_DIR} \
37- TERM=linux CHARM_BUILD_DIR=${CHARM_BUILD_DIR} charm build src/
38+ @charmcraft -v pack ${BUILD_ARGS}
39+ @bash -c ./rename.sh
40+ @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
41+ @unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}
42
43 release: clean build
44 @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
45@@ -66,12 +75,12 @@ proof: build
46 @charm proof ${CHARM_BUILD_DIR}/${CHARM_NAME}
47
48 unittests:
49- #@-cd src && tox -e unit
50- @echo "No unit tests. Skipping."
51+ @echo "No unit tests"
52+ # @cd src && tox -e unit
53
54 functional: build
55 @echo "Executing functional tests in ${CHARM_BUILD_DIR}"
56- @cd src && CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func
57+ @cd src && CHARM_BUILD_DIR=${CHARM_BUILD_DIR} CHARM_LOCATION=${PROJECTPATH} tox -e func
58
59 test: lint proof unittests functional
60 @echo "Tests completed for charm ${CHARM_NAME}."
61diff --git a/charmcraft.yaml b/charmcraft.yaml
62new file mode 100644
63index 0000000..7d9c002
64--- /dev/null
65+++ b/charmcraft.yaml
66@@ -0,0 +1,20 @@
67+type: charm
68+parts:
69+ charm:
70+ source: src
71+ plugin: reactive
72+ build-snaps: [charm]
73+bases:
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
87diff --git a/metadata.yaml b/metadata.yaml
88new file mode 120000
89index 0000000..0768683
90--- /dev/null
91+++ b/metadata.yaml
92@@ -0,0 +1 @@
93+src/metadata.yaml
94\ No newline at end of file
95diff --git a/rename.sh b/rename.sh
96new file mode 100755
97index 0000000..bc8697f
98--- /dev/null
99+++ b/rename.sh
100@@ -0,0 +1,13 @@
101+#!/bin/bash
102+charm=$(grep -E "^name:" src/metadata.yaml | awk '{print $2}')
103+echo "renaming ${charm}_*.charm to ${charm}.charm"
104+echo -n "pwd: "
105+pwd
106+ls -al
107+echo "Removing previous charm if it exists"
108+if [[ -e "${charm}.charm" ]];
109+then
110+ rm "${charm}.charm"
111+fi
112+echo "Renaming charm here."
113+mv ${charm}_*.charm ${charm}.charm
114diff --git a/src/tests/unit/requirements.txt b/src/tests/unit/requirements.txt
115index be9b2a5..2936edb 100644
116--- a/src/tests/unit/requirements.txt
117+++ b/src/tests/unit/requirements.txt
118@@ -5,4 +5,3 @@ flake8
119 charms.reactive
120 pytest
121 pytest-cov
122--e git+https://git.launchpad.net/~jjo/layer-snap@cab2b604695f39a81abe47b22b8426e44e66df8f#egg=charms.layer
123diff --git a/src/tox.ini b/src/tox.ini
124index e7d8263..7aa45dc 100644
125--- a/src/tox.ini
126+++ b/src/tox.ini
127@@ -10,7 +10,8 @@ setenv =
128 passenv =
129 HOME
130 PATH
131- CHARM_BUILD_DIR
132+ CHARM_*
133+ OS_*
134 PYTEST_KEEP_MODEL
135 PYTEST_CLOUD_NAME
136 PYTEST_CLOUD_REGION

Subscribers

People subscribed via source and target branches

to all changes: