generated from canonical/template-operator
-
Notifications
You must be signed in to change notification settings - Fork 7
/
charmcraft.yaml
54 lines (50 loc) · 1.79 KB
/
charmcraft.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
type: charm
bases:
- name: ubuntu
channel: "22.04"
architectures: [amd64]
- name: ubuntu
channel: "22.04"
architectures: [arm64]
parts:
files:
plugin: dump
source: .
build-packages:
- git
override-build: |
# Workaround to add unique identifier (git hash) to charm version while specification
# DA053 - Charm versioning
# (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1)
# is pending review.
python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'
craftctl default
stage:
# Exclude requirements.txt file during staging
# Workaround for https://github.com/canonical/charmcraft/issues/1389 on charmcraft 2
- -requirements.txt
prime:
- charm_version
- workload_version
- scripts
charm:
build-snaps:
- rustup
build-packages:
- libffi-dev
- libssl-dev
- pkg-config
override-build: |
rustup default stable
# Convert subset of poetry.lock to requirements.txt
curl -sSL https://install.python-poetry.org | python3 -
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
craftctl default
stage:
# Exclude charm_version file during staging
- -charm_version
charm-strict-dependencies: true
charm-requirements: [requirements.txt]
charm-entrypoint: src/kubernetes_charm.py