Merge ~xavpaice/charm-prometheus-openstack-exporter:add_charmcraft into charm-prometheus-openstack-exporter:master

Proposed by Xav Paice
Status: Merged
Approved by: James Troup
Approved revision: 1daa1d4ce5c51967739269a45e7cc8281ce27f3a
Merged at revision: 4456fe083de197aae19a919e60be5538ba88f4a5
Proposed branch: ~xavpaice/charm-prometheus-openstack-exporter:add_charmcraft
Merge into: charm-prometheus-openstack-exporter:master
Diff against target: 119 lines (+53/-6)
5 files modified
Makefile (+13/-5)
charmcraft.yaml (+25/-0)
metadata.yaml (+1/-0)
rename.sh (+13/-0)
src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 (+1/-1)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
BootStack Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+416431@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: Approve (continuous-integration)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 4456fe083de197aae19a919e60be5538ba88f4a5

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 5416279..76f44ce 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@@ -34,7 +37,9 @@ clean:
25 @echo "Cleaning files"
26 @git clean -ffXd -e '!.idea'
27 @echo "Cleaning existing build"
28- @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}
29+ @rm -rf ${PROJECTPATH}/${CHARM_NAME}.charm
30+ @rm -rf ${CHARM_BUILD_DIR}/*
31+ @charmcraft clean
32
33 submodules:
34 @echo "Cloning submodules"
35@@ -47,11 +52,14 @@ submodules-update:
36 build:
37 @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
38 @-git rev-parse --abbrev-ref HEAD > ./src/repo-info
39- @CHARM_LAYERS_DIR=${CHARM_LAYERS_DIR} CHARM_INTERFACES_DIR=${CHARM_INTERFACES_DIR} \
40- TERM=linux CHARM_BUILD_DIR=${CHARM_BUILD_DIR} charm build src/
41+ @charmcraft -v pack ${BUILD_ARGS}
42+ @bash -c ./rename.sh
43+ @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
44+ @unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}
45
46 release: clean build
47- @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"
48+ @echo "Charm is built at ${PROJECTPATH}/${CHARM_NAME}.charm"
49+ @charmcraft upload ${PROJECTPATH}/${CHARM_NAME}.charm --release edge
50
51 lint:
52 @echo "Running lint checks"
53diff --git a/charmcraft.yaml b/charmcraft.yaml
54new file mode 100644
55index 0000000..1f750bc
56--- /dev/null
57+++ b/charmcraft.yaml
58@@ -0,0 +1,25 @@
59+type: charm
60+parts:
61+ charm:
62+ source: src
63+ plugin: reactive
64+ build-snaps: [charm]
65+bases:
66+ - build-on:
67+ - name: ubuntu
68+ channel: "20.04"
69+ architectures: ["amd64"]
70+ run-on:
71+ - name: ubuntu
72+ channel: "20.04"
73+ architectures:
74+ - amd64
75+ - name: ubuntu
76+ channel: "18.04"
77+ architectures:
78+ - amd64
79+ - name: ubuntu
80+ channel: "16.04"
81+ architectures:
82+ - amd64
83+
84diff --git a/metadata.yaml b/metadata.yaml
85new file mode 120000
86index 0000000..0768683
87--- /dev/null
88+++ b/metadata.yaml
89@@ -0,0 +1 @@
90+src/metadata.yaml
91\ No newline at end of file
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/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
112index da7d731..319de18 100644
113--- a/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
114+++ b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
115@@ -1,3 +1,3 @@
116 applications:
117 prometheus-openstack-exporter:
118- charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"
119+ charm: "{{ PROJECTPATH }}/{{ charm_name }}.charm"

Subscribers

People subscribed via source and target branches

to all changes: