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
diff --git a/Makefile b/Makefile
index 5416279..76f44ce 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ PYTHON := /usr/bin/python3
22
3PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))3PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))
4ifndef CHARM_BUILD_DIR4ifndef CHARM_BUILD_DIR
5 CHARM_BUILD_DIR=${PROJECTPATH}.build5 CHARM_BUILD_DIR=${PROJECTPATH}/build
6endif6endif
7ifndef CHARM_LAYERS_DIR7ifndef CHARM_LAYERS_DIR
8 CHARM_LAYERS_DIR=${PROJECTPATH}/layers8 CHARM_LAYERS_DIR=${PROJECTPATH}/layers
@@ -10,6 +10,9 @@ endif
10ifndef CHARM_INTERFACES_DIR10ifndef CHARM_INTERFACES_DIR
11 CHARM_INTERFACES_DIR=${PROJECTPATH}/interfaces11 CHARM_INTERFACES_DIR=${PROJECTPATH}/interfaces
12endif12endif
13ifdef CONTAINER
14 BUILD_ARGS="--destructive-mode"
15endif
13METADATA_FILE="src/metadata.yaml"16METADATA_FILE="src/metadata.yaml"
14CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}')17CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}')
1518
@@ -34,7 +37,9 @@ clean:
34 @echo "Cleaning files"37 @echo "Cleaning files"
35 @git clean -ffXd -e '!.idea'38 @git clean -ffXd -e '!.idea'
36 @echo "Cleaning existing build"39 @echo "Cleaning existing build"
37 @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME}40 @rm -rf ${PROJECTPATH}/${CHARM_NAME}.charm
41 @rm -rf ${CHARM_BUILD_DIR}/*
42 @charmcraft clean
3843
39submodules:44submodules:
40 @echo "Cloning submodules"45 @echo "Cloning submodules"
@@ -47,11 +52,14 @@ submodules-update:
47build:52build:
48 @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"53 @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}"
49 @-git rev-parse --abbrev-ref HEAD > ./src/repo-info54 @-git rev-parse --abbrev-ref HEAD > ./src/repo-info
50 @CHARM_LAYERS_DIR=${CHARM_LAYERS_DIR} CHARM_INTERFACES_DIR=${CHARM_INTERFACES_DIR} \55 @charmcraft -v pack ${BUILD_ARGS}
51 TERM=linux CHARM_BUILD_DIR=${CHARM_BUILD_DIR} charm build src/56 @bash -c ./rename.sh
57 @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}
58 @unzip ${PROJECTPATH}/${CHARM_NAME}.charm -d ${CHARM_BUILD_DIR}/${CHARM_NAME}
5259
53release: clean build60release: clean build
54 @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}"61 @echo "Charm is built at ${PROJECTPATH}/${CHARM_NAME}.charm"
62 @charmcraft upload ${PROJECTPATH}/${CHARM_NAME}.charm --release edge
5563
56lint:64lint:
57 @echo "Running lint checks"65 @echo "Running lint checks"
diff --git a/charmcraft.yaml b/charmcraft.yaml
58new file mode 10064466new file mode 100644
index 0000000..1f750bc
--- /dev/null
+++ b/charmcraft.yaml
@@ -0,0 +1,25 @@
1type: charm
2parts:
3 charm:
4 source: src
5 plugin: reactive
6 build-snaps: [charm]
7bases:
8 - build-on:
9 - name: ubuntu
10 channel: "20.04"
11 architectures: ["amd64"]
12 run-on:
13 - name: ubuntu
14 channel: "20.04"
15 architectures:
16 - amd64
17 - name: ubuntu
18 channel: "18.04"
19 architectures:
20 - amd64
21 - name: ubuntu
22 channel: "16.04"
23 architectures:
24 - amd64
25
diff --git a/metadata.yaml b/metadata.yaml
0new file mode 12000026new file mode 120000
index 0000000..0768683
--- /dev/null
+++ b/metadata.yaml
@@ -0,0 +1 @@
1src/metadata.yaml
0\ No newline at end of file2\ No newline at end of file
diff --git a/rename.sh b/rename.sh
1new file mode 1007553new file mode 100755
index 0000000..bc8697f
--- /dev/null
+++ b/rename.sh
@@ -0,0 +1,13 @@
1#!/bin/bash
2charm=$(grep -E "^name:" src/metadata.yaml | awk '{print $2}')
3echo "renaming ${charm}_*.charm to ${charm}.charm"
4echo -n "pwd: "
5pwd
6ls -al
7echo "Removing previous charm if it exists"
8if [[ -e "${charm}.charm" ]];
9then
10 rm "${charm}.charm"
11fi
12echo "Renaming charm here."
13mv ${charm}_*.charm ${charm}.charm
diff --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
index da7d731..319de18 100644
--- a/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
+++ b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
@@ -1,3 +1,3 @@
1applications:1applications:
2 prometheus-openstack-exporter:2 prometheus-openstack-exporter:
3 charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"3 charm: "{{ PROJECTPATH }}/{{ charm_name }}.charm"

Subscribers

People subscribed via source and target branches

to all changes: