Merge ~xavpaice/charm-rsyslog-forwarder-ha:add_charmcraft into charm-rsyslog-forwarder-ha:master

Proposed by Xav Paice
Status: Merged
Approved by: James Troup
Approved revision: 9c2622f3372aba1b5ebc00c0fde1572a39df8697
Merged at revision: f859d0f0389762c725d5ccbef910249b6824ea58
Proposed branch: ~xavpaice/charm-rsyslog-forwarder-ha:add_charmcraft
Merge into: charm-rsyslog-forwarder-ha:master
Diff against target: 165 lines (+69/-16)
6 files modified
.gitignore (+3/-1)
Makefile (+15/-12)
charmcraft.yaml (+35/-0)
rename.sh (+13/-0)
tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 (+2/-2)
tox.ini (+1/-1)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
James Troup (community) Needs Fixing
BootStack Reviewers Pending
Review via email: mp+416446@code.launchpad.net

Commit message

add 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
🤖 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 :
review: Needs Fixing (continuous-integration)
Revision history for this message
James Troup (elmo) wrote :

CI failure ('unzip not found') looks related to the change.

review: Needs Fixing
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: Approve (continuous-integration)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision f859d0f0389762c725d5ccbef910249b6824ea58

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..43df031 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -38,4 +38,6 @@ dist/
6 *.snap
7
8 # Builds
9-.build/
10\ No newline at end of file
11+.build/
12+build/
13+*.charm
14diff --git a/Makefile b/Makefile
15index a2cd1cb..497cba8 100644
16--- a/Makefile
17+++ b/Makefile
18@@ -2,7 +2,10 @@ PYTHON := /usr/bin/python3
19
20 PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))
21 ifndef CHARM_BUILD_DIR
22- CHARM_BUILD_DIR=${PROJECTPATH}.build
23+ CHARM_BUILD_DIR=${PROJECTPATH}/build
24+endif
25+ifdef CONTAINER
26+ BUILD_ARGS="--destructive-mode"
27 endif
28 METADATA_FILE="metadata.yaml"
29 CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E '^name:' | awk '{print $$2}')
30@@ -28,7 +31,9 @@ clean:
31 @echo "Cleaning files"
32 @git clean -ffXd -e '!.idea'
33 @echo "Cleaning existing build"
34- @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
35+ @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}.charm
36+ @rm -rf ${CHARM_BUILD_DIR}/*
37+ @charmcraft clean
38
39 submodules:
40 @echo "Cloning submodules"
41@@ -38,15 +43,17 @@ submodules-update:
42 @echo "Pulling latest updates for submodules"
43 @git submodule update --init --recursive --remote --merge
44
45-build: submodules
46- @echo "Building charm to base directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
47+build: clean submodules-update
48+ @echo "Building charm to base directory ${CHARM_BUILD_DIR}/${CHARM_NAME}.charm"
49 @-git rev-parse --abbrev-ref HEAD > ./repo-info
50 @-git describe --always > ./version
51+ @charmcraft -v pack ${BUILD_ARGS}
52+ @bash -c ./rename.sh
53 @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
54- @cp -a ./* ${CHARM_BUILD_DIR}/${CHARM_NAME}
55+ @unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}
56
57 release: clean build
58- @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
59+ @charmcraft upload ${CHARM_NAME}.charm --release edge
60
61 lint:
62 @echo "Running lint checks"
63@@ -60,17 +67,13 @@ proof:
64 @echo "Running charm proof"
65 @-charm proof
66
67-unittests: submodules
68+unittests: submodules-update
69 @echo "Running unit tests"
70 @tox -e unit
71
72 functional: build
73 @echo "Executing functional tests in ${CHARM_BUILD_DIR}"
74- @CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func
75-
76-functional-ci: build
77- @echo "Executing functional tests in ${CHARM_BUILD_DIR}"
78- @CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func -- --keep-faulty-model
79+ @CHARM_LOCATION=${PROJECTPATH} CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func
80
81 test: lint proof unittests functional
82 @echo "Charm ${CHARM_NAME} has been tested"
83diff --git a/charmcraft.yaml b/charmcraft.yaml
84new file mode 100644
85index 0000000..a888bc2
86--- /dev/null
87+++ b/charmcraft.yaml
88@@ -0,0 +1,35 @@
89+type: charm
90+
91+parts:
92+ charm:
93+ plugin: dump
94+ source: .
95+ prime:
96+ - hooks/*
97+ - charm-helpers/*
98+ - templates/*
99+ - config.yaml
100+ - copyright
101+ - icon.svg
102+ - metadata.yaml
103+ - README.md
104+
105+bases:
106+ - build-on:
107+ - name: ubuntu
108+ channel: "20.04"
109+ architectures: ["amd64"]
110+ run-on:
111+ - name: ubuntu
112+ channel: "20.04"
113+ architectures:
114+ - amd64
115+ - name: ubuntu
116+ channel: "18.04"
117+ architectures:
118+ - amd64
119+ - name: ubuntu
120+ channel: "16.04"
121+ architectures:
122+ - amd64
123+
124diff --git a/rename.sh b/rename.sh
125new file mode 100755
126index 0000000..956a76b
127--- /dev/null
128+++ b/rename.sh
129@@ -0,0 +1,13 @@
130+#!/bin/bash
131+charm=$(grep -E "^name:" metadata.yaml | awk '{print $2}')
132+echo "renaming ${charm}_*.charm to ${charm}.charm"
133+echo -n "pwd: "
134+pwd
135+ls -al
136+echo "Removing previous charm if it exists"
137+if [[ -e "${charm}.charm" ]];
138+then
139+ rm "${charm}.charm"
140+fi
141+echo "Renaming charm here."
142+mv ${charm}_*.charm ${charm}.charm
143diff --git a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
144index 1f92d36..45065bc 100644
145--- a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
146+++ b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
147@@ -1,3 +1,3 @@
148 applications:
149- rsyslog-forwarder-ha:
150- charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"
151+ {{ charm_name }}:
152+ charm: "{{ CHARM_LOCATION }}/{{ charm_name }}.charm"
153diff --git a/tox.ini b/tox.ini
154index 7848956..4c8edb9 100644
155--- a/tox.ini
156+++ b/tox.ini
157@@ -10,7 +10,7 @@ setenv =
158 passenv =
159 HOME
160 PATH
161- CHARM_BUILD_DIR
162+ CHARM_*
163 PYTEST_KEEP_MODEL
164 PYTEST_CLOUD_NAME
165 PYTEST_CLOUD_REGION

Subscribers

People subscribed via source and target branches

to all changes: