Skip to content

Use rocks for operator and webhook #57

Use rocks for operator and webhook

Use rocks for operator and webhook #57

Workflow file for this run

name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
schedule:
- cron: '0 8 * * TUE'
# Triggered on push by .github/workflows/release.yaml
workflow_call:
outputs:
artifact-prefix:
description: build_charm.yaml `artifact-prefix` output
value: ${{ jobs.build.outputs.artifact-prefix }}
charm-paths:
description: paths for all charms in this repo
value: ${{ jobs.get-charm-paths-channel.outputs.charm-paths }}
channel:
description: Charmhub channel the charms are released to
value: ${{ jobs.get-charm-paths-channel.outputs.charm-channel }}
jobs:
get-charm-paths-channel:
name: Get charm paths and charmhub channel
runs-on: ubuntu-latest
outputs:
charm-paths: ${{ steps.get-charm-paths.outputs.charm-paths }}
charm-channel: ${{ steps.select-channel.outputs.name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get paths for all charms in this repo
id: get-charm-paths
uses: canonical/kubeflow-ci/actions/get-charm-paths@main
- name: Select charmhub channel
uses: canonical/charming-actions/channel@2.6.2
id: select-channel
lib-check:
name: Check libraries
needs:
- get-charm-paths-channel
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
uses: canonical/charmed-kubeflow-workflows/.github/workflows/_quality-checks.yaml@main
secrets: inherit
with:
charm-path: ${{ matrix.charm }}
lint:
name: Lint Code
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
charm: [operator, serving, eventing]
steps:
- uses: actions/checkout@v4
- run: pip install tox
- run: tox -e ${{ matrix.charm }}-lint
unit:
name: Unit Test
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
charm: [operator, serving, eventing]
steps:
- uses: actions/checkout@v4
- run: pip install tox
- run: tox -e ${{ matrix.charm }}-unit
terraform-checks:
name: Terraform
needs:
- get-charm-paths-channel
uses: canonical/charmed-kubeflow-workflows/.github/workflows/terraform-checks.yaml@main
strategy:
fail-fast: false
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
with:
charm-path: ${{ matrix.charm }}
# Skipping the Terraform apply check as knative-eventing and knative-serving
# go to Error when knative-operator is not deployed, instead of the expected
# Blocked or Active. This is currently a limitation of the Terraform re-usable
# workflows in canonical/charmed-kubeflow-workflows
# See https://github.com/canonical/charmed-kubeflow-workflows/issues/65
# See https://github.com/canonical/knative-operators/issues/156
apply: false
build:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
name: Build charm | ${{ matrix.charm }}
needs:
- get-charm-paths-channel
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v29.0.0
with:
path-to-charm-directory: ${{ matrix.charm }}
integration:
name: Integration tests
needs:
- build
strategy:
fail-fast: false
matrix:
charm: [operator]
runs-on: ubuntu-20.04
steps:
# Ideally we'd use self-hosted runners, but this effort is still not stable
# This action will remove unused software (dotnet, haskell, android libs, codeql,
# and docker images) from the GH runner.
# This leaves ~45GB free as of 2024-04-10, but this amount has varied as GH changed their
# runners
- name: Maximise GH runner space
uses: jlumbroso/free-disk-space@v1.3.1
- name: Check out repo
uses: actions/checkout@v4
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: 1.31-strict/stable
juju-channel: 3.6/stable
microk8s-addons: "dns storage rbac metallb:10.64.140.43-10.64.140.49"
- name: Download packed charm(s)
id: download-charms
timeout-minutes: 5
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.build.outputs.artifact-prefix }}-*
merge-multiple: true
- name: Run integration tests
run: |
sg snap_microk8s -c "tox -e ${{ matrix.charm }}-integration -- --model knative-test --charm-path=${{ github.workspace }}/charms/knative-${{ matrix.charm }}/knative-${{ matrix.charm }}_ubuntu@20.04-amd64.charm"
- name: Run kubectl get all
run: kubectl get all -A
if: failure()
- name: Print list of crds
run: kubectl get crds
if: failure()
- name: Get juju status
run: juju status
if: failure()
- name: Collect charm debug artifacts
uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main
if: failure()
bundle-integration:
name: Bundle integration tests
needs:
- build
strategy:
matrix:
environment: [ "integration", "cos-integration" ]
runs-on: ubuntu-20.04
steps:
# Ideally we'd use self-hosted runners, but this effort is still not stable
# This action will remove unused software (dotnet, haskell, android libs, codeql,
# and docker images) from the GH runner.
# This leaves ~45GB free as of 2024-04-10, but this amount has varied as GH changed their
# runners
- name: Maximise GH runner space
uses: jlumbroso/free-disk-space@v1.3.1
- name: Check out repo
uses: actions/checkout@v4
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: 1.31-strict/stable
juju-channel: 3.6/stable
microk8s-addons: "dns storage rbac metallb:10.64.140.43-10.64.140.49"
- name: Download packed charm(s)
id: download-charms
timeout-minutes: 5
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.build.outputs.artifact-prefix }}-*
merge-multiple: true
- name: Run integration tests
run: |
sg snap_microk8s -c "tox -vve ${{ matrix.environment }} -- --model knative-test --charms-path=${{ github.workspace }}/charms/"
- name: Run kubectl get all
run: kubectl get all -A
if: failure()
- name: Print list of crds
run: kubectl get crds
if: failure()
- name: Get juju status
run: juju status
if: failure()
- name: Collect charm debug artifacts
uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main
if: failure()
release:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
name: Release charm to Charmhub branch | ${{ matrix.charm }}
if: ${{ github.event_name == 'pull_request' }}
needs:
- get-charm-paths-channel
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v29.0.0
with:
channel: ${{ needs.get-charm-paths-channel.outputs.charm-channel }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
path-to-charm-directory: ${{ matrix.charm }}
create-git-tags: false
secrets:
charmhub-token: ${{ secrets.CHARMCRAFT_CREDENTIALS }}