forked from juju-solutions/charm-aws-integrator
-
Notifications
You must be signed in to change notification settings - Fork 1
Using charmcraft, build for jammy and focal #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.x/stable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
charmcraft-build: | ||
name: Build Charm | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Read charmcraft version file | ||
id: charmcraft | ||
run: echo "channel=$(cat .charmcraft-channel)" >> $GITHUB_OUTPUT | ||
- name: Install and prepare LXD snap environment | ||
run: | | ||
sudo apt-get remove -qy lxd lxd-client | true | ||
sudo snap list lxd | true | ||
sudo snap install lxd --channel=latest/stable | ||
sudo snap refresh lxd --channel=latest/stable | ||
sudo lxd waitready | ||
sudo lxd init --auto | ||
sudo chmod a+wr /var/snap/lxd/common/lxd/unix.socket | ||
sudo lxc network set lxdbr0 ipv6.address none | ||
sudo usermod -a -G lxd $USER | ||
sg lxd -c 'lxc version' | ||
- name: Remove Docker | ||
run: | | ||
# https://github.com/canonical/lxd-cloud/blob/f20a64a8af42485440dcbfd370faf14137d2f349/test/includes/lxd.sh#L13-L23 | ||
sudo rm -rf /etc/docker | ||
sudo apt-get purge moby-buildx moby-engine moby-cli moby-compose moby-containerd moby-runc -y | ||
sudo iptables -P FORWARD ACCEPT | ||
- name: Install Charmcraft | ||
run: | | ||
sudo snap install charmcraft --classic --channel=${{ steps.charmcraft.outputs.channel }} | ||
- name: Build Charm | ||
run: | | ||
sg lxd -c 'charmcraft pack -v' | ||
- name: Upload charm artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: aws-integrator.charm | ||
path: ./aws-integrator*.charm | ||
- name: Upload debug artifacts | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: charmcraft-logs | ||
path: ~/.local/state/charmcraft/log/charmcraft-*.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Charmed Kubernetes Reactive wheelhouse test | ||
on: | ||
- pull_request | ||
|
||
jobs: | ||
validate-wheelhouse: | ||
uses: charmed-kubernetes/workflows/.github/workflows/validate-wheelhouse.yaml@main | ||
with: | ||
python: "['3.10', '3.12']" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.tox/ | ||
__pycache__/ | ||
*.pyc | ||
.coverage | ||
*.charm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
type: charm | ||
|
||
bases: | ||
- build-on: | ||
- name: ubuntu | ||
channel: "22.04" | ||
architectures: ["amd64"] | ||
run-on: | ||
- name: ubuntu | ||
channel: "22.04" | ||
architectures: ["amd64", "arm64", "s390x"] | ||
- name: ubuntu | ||
channel: "24.04" | ||
architectures: ["amd64", "arm64", "s390x"] | ||
parts: | ||
charm: | ||
source: src | ||
plugin: reactive | ||
override-build: | | ||
./download_layers.sh | ||
git -C $CRAFT_PROJECT_DIR rev-parse --short HEAD > $CRAFT_PART_INSTALL/version | ||
craftctl default | ||
reactive-charm-build-arguments: | ||
- --layer-index | ||
- 'http://localhost/' # Fake layer index to force a local build | ||
- --debug | ||
- --force | ||
build-packages: | ||
- git | ||
- wget | ||
- python3-dev | ||
build-snaps: | ||
- charm/3.x/stable | ||
- yq | ||
build-environment: | ||
- CHARM_LAYERS_DIR: $CRAFT_STAGE/tmp/layers/ | ||
- CHARM_INTERFACES_DIR: $CRAFT_STAGE/tmp/interfaces/ | ||
- RELEASE_BRANCH: main |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/metadata.yaml |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# This script is used to download reactive layers for the charm build process. | ||
# It pulls the layers from the gh and place them in the tmp directory. | ||
set -eu | ||
|
||
# ensure we have environment variables set | ||
: "${RELEASE_BRANCH:?Environment variable RELEASE_BRANCH is not set.}" | ||
: "${CHARM_LAYERS_DIR:?Environment variable CHARM_LAYERS_DIR is not set.}" | ||
: "${CHARM_INTERFACES_DIR:?Environment variable CHARM_INTERFACES_DIR is not set.}" | ||
|
||
# Ensure the temporary directory was created successfully | ||
TMP_DIR=$(mktemp -d) | ||
if [ ! -d "$TMP_DIR" ]; then | ||
echo "Failed to create a temporary directory." | ||
exit 1 | ||
fi | ||
trap 'rm -rf "$TMP_DIR"' EXIT | ||
|
||
# ensure we have the right prerequisites | ||
for cmd in charm wget yq; do | ||
if ! command -v $cmd &> /dev/null; then | ||
echo "$cmd command not found. Please install $cmd." | ||
exit 1 | ||
fi | ||
done | ||
|
||
rm -rf $CHARM_LAYERS_DIR && mkdir -p $CHARM_LAYERS_DIR | ||
rm -rf $CHARM_INTERFACES_DIR && mkdir -p $CHARM_INTERFACES_DIR | ||
wget "https://raw.githubusercontent.com/charmed-kubernetes/jenkins/refs/heads/main/jobs/includes/charm-layer-list.inc" -O ${TMP_DIR}/layers.yaml | ||
for layer in $(cat ${TMP_DIR}/layers.yaml | yq '.[] | keys | .[]' - ); do | ||
if [[ ! "$layer" =~ ^(interface:|layer:) ]]; then continue; fi | ||
echo "Pulling layer: ${layer}" | ||
charm pull-source \ | ||
--layer-index ${LAYER_INDEX:-'https://raw.githubusercontent.com/charmed-kubernetes/layer-index/main/'} \ | ||
--branch ${RELEASE_BRANCH} \ | ||
${layer} & | ||
done | ||
wait |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: aws-integrator | ||
display-name: AWS-Integrator | ||
summary: | | ||
Charm to enable AWS integrations via Juju relations. | ||
description: | | ||
This charm can grant select permissions to instances of applications | ||
related to it which enable integration with AWS specific features, | ||
such as ELB, EBS, etc. | ||
docs: https://discourse.charmhub.io/t/aws-integrator-docs-index/6100 | ||
maintainers: ['Cory Johns <cory.johns@canonical.com>'] | ||
series: | ||
- jammy | ||
- noble | ||
tags: ['aws', 'native', 'integration'] | ||
provides: | ||
aws: | ||
interface: aws-integration | ||
rds-mysql: | ||
interface: mysql | ||
resources: | ||
aws-cli: | ||
type: file | ||
filename: aws-cli.snap | ||
description: | | ||
Resource to side-load aws-cli snap in network-restricted deployments. | ||
[DEPRECATED] in favor of using a Snap Store Proxy. | ||
See https://ubuntu.com/kubernetes/docs/proxies for more details. |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
setuptools==70.3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
build_dir="$(mktemp -d --tmpdir=${TOX_ENV_DIR}/tmp)" | ||
charm="$(egrep '^name\S*:' ./metadata.yaml | awk '{ print $2 }')" | ||
function cleanup { rm -rf "$build_dir"; } | ||
trap cleanup EXIT | ||
|
||
charm-build src --build-dir "$build_dir" --debug | ||
pip install -f "$build_dir/$charm/wheelhouse" --no-index --no-cache-dir "$build_dir"/$charm/wheelhouse/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,64 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
ignore = | ||
# line break before binary operator | ||
W503 | ||
# whitespace before ':' | ||
E203 | ||
|
||
[tox] | ||
envlist = lint,unit | ||
skipsdist = True | ||
minversion = 3.2.0 | ||
|
||
[pytest] | ||
filterwarnings = | ||
ignore::DeprecationWarning | ||
|
||
[testenv] | ||
basepython = python3 | ||
setenv = | ||
PYTHONPATH={toxinidir}:{toxinidir}/lib | ||
PYTHONPATH={toxinidir}/src:{toxinidir}/src/lib | ||
PYTHONBREAKPOINT=ipdb.set_trace | ||
|
||
[testenv:unit] | ||
deps = | ||
pytest | ||
pyyaml | ||
pytest-cov | ||
ipdb | ||
git+https://github.com/juju-solutions/charms.unit_test/#egg=charms.unit_test | ||
commands = pytest --tb native -s {posargs} {toxinidir}/tests/unit | ||
|
||
[testenv:integration] | ||
deps = | ||
pytest | ||
pytest-operator | ||
lightkube | ||
python-openstackclient | ||
-r src/wheelhouse.txt | ||
commands = | ||
pytest --tb native \ | ||
--asyncio-mode=auto \ | ||
--show-capture=no \ | ||
--log-cli-level=INFO \ | ||
-s {posargs} \ | ||
{toxinidir}/tests/integration | ||
|
||
pytest --tb native -s -vv \ | ||
--cov-report term-missing --cov=src \ | ||
{posargs} {toxinidir}/tests/unit | ||
|
||
[testenv:lint] | ||
deps = | ||
flake8 | ||
black | ||
commands = | ||
flake8 {toxinidir}/actions {toxinidir}/lib {toxinidir}/reactive {toxinidir}/tests | ||
black --check {toxinidir}/actions {toxinidir}/lib {toxinidir}/reactive {toxinidir}/tests | ||
commands = | ||
black --check {toxinidir}/src {toxinidir}/tests | ||
flake8 {toxinidir}/src {toxinidir}/tests | ||
|
||
[testenv:format] | ||
envdir = {toxworkdir}/lint | ||
deps = black | ||
commands = black {toxinidir}/actions {toxinidir}/lib {toxinidir}/reactive {toxinidir}/tests | ||
|
||
commands = | ||
black {toxinidir}/src {toxinidir}/tests | ||
|
||
[flake8] | ||
max-line-length = 88 | ||
extend-ignore = E203 | ||
[testenv:integration] | ||
deps = | ||
juju | ||
pytest | ||
pytest-operator | ||
lightkube | ||
ipdb | ||
commands = pytest --tb native --show-capture=no --log-cli-level=INFO -s {posargs} {toxinidir}/tests/integration | ||
|
||
[testenv:validate-wheelhouse] | ||
deps = | ||
git+https://github.com/juju/charm-tools.git | ||
path<17 | ||
allowlist_externals = {toxinidir}/tests/validate-wheelhouse.sh | ||
commands = {toxinidir}/tests/validate-wheelhouse.sh |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: Why do you explicitly disable IPv6 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no one likes ipv6. ipv5 was better
also, convention pushed me down a road maybe currently no longer necessary for building a charm
https://github.com/charmed-kubernetes/actions-operator/blob/main/src/bootstrap/index.ts#L301-L306