Prometheus integration via control socket #124
Workflow file for this run
This file contains 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
name: "CI" | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
- name: Install dependencies for testing | |
run: | | |
pip install -r requirements-dev.txt | |
- name: Run tests | |
run: | | |
./run_tests | |
build: | |
name: Build charms | |
needs: unit-tests | |
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v4 | |
with: | |
artifact-name: charm-packed | |
bootstrap: | |
name: "Bootstrap" | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
cloud: ["lxd", "microk8s"] | |
env: | |
LOCAL_CHARM_PATH: ${{ github.workspace }}/controller.charm | |
CHARMHUB_NAME: juju-qa-controller | |
CHARMHUB_CHANNEL: latest/edge/${{ github.run_id }} | |
steps: | |
- name: Download packed charm | |
id: download | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ needs.build.outputs.artifact-name }} | |
- name: Rename charm file | |
run: | | |
mv ${{ steps.download.outputs.download-path }}/*.charm \ | |
$LOCAL_CHARM_PATH | |
# Currently the only way to get charms on k8s is via Charmhub. | |
- name: Upload charm to Charmhub | |
id: charmcraft | |
if: matrix.cloud == 'microk8s' | |
env: | |
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }} | |
run: | | |
sudo snap install charmcraft --classic | |
charmcraft upload $LOCAL_CHARM_PATH \ | |
--name $CHARMHUB_NAME --release $CHARMHUB_CHANNEL | |
- name: Save charmcraft logs as artifact | |
if: always() && steps.charmcraft.outcome != 'skipped' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: charmcraft-upload-logs | |
path: ~/.local/state/charmcraft/log/ | |
continue-on-error: true | |
- name: Set up LXD | |
if: matrix.cloud == 'lxd' | |
uses: canonical/setup-lxd@90d76101915da56a42a562ba766b1a77019242fd | |
- name: Set up MicroK8s | |
if: matrix.cloud == 'microk8s' | |
uses: balchua/[email protected] | |
with: | |
channel: "1.25-strict/stable" | |
addons: '["dns", "hostpath-storage"]' | |
- name: Install Juju | |
run: | | |
sudo snap install juju --channel 3.3/beta | |
- name: Bootstrap on LXD | |
if: matrix.cloud == 'lxd' | |
run: | | |
juju bootstrap lxd c \ | |
--controller-charm-path=$LOCAL_CHARM_PATH | |
- name: Bootstrap on MicroK8s | |
if: matrix.cloud == 'microk8s' | |
run: | | |
sg snap_microk8s <<EOF | |
juju bootstrap microk8s c \ | |
--controller-charm-path=$CHARMHUB_NAME \ | |
--controller-charm-channel=$CHARMHUB_CHANNEL | |
EOF | |
- name: Check charm status | |
run: | | |
juju switch controller | |
juju wait-for application controller --timeout 1m | |
juju status | |
# TODO: test integration with dashboard / ha-proxy | |
release: | |
name: "Release to edge" | |
runs-on: ubuntu-latest | |
needs: [build, bootstrap] | |
if: github.event_name == 'push' | |
steps: | |
- name: Download packed charm | |
id: download | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ needs.build.outputs.artifact-name }} | |
- name: Select Charmhub channel | |
id: channel | |
shell: bash | |
run: | | |
set -x | |
case ${{ github.ref_name }} in | |
3.* | 4.*) | |
TRACK="${{ github.ref_name }}" | |
;; | |
master) | |
TRACK="latest" | |
;; | |
esac | |
echo "track=$TRACK" >> "$GITHUB_OUTPUT" | |
if [[ -z $TRACK ]]; then | |
echo "upload=false" >> "$GITHUB_OUTPUT" | |
else | |
echo "upload=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Upload to Charmhub | |
if: steps.channel.outputs.upload == 'true' | |
env: | |
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }} | |
run: | | |
sudo snap install charmcraft --classic | |
charmcraft upload ${{ steps.download.outputs.download-path }}/*.charm \ | |
--release ${{ steps.channel.outputs.track }}/edge |