Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
schedule:
- cron: '0 8 * * TUE'
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-track.outputs.charm-paths }}
track:
description: Charmhub track determined from branch name
value: ${{ jobs.get-charm-paths-track.outputs.track }}

jobs:
get-charm-paths-track:
name: Get charm paths and track
runs-on: ubuntu-latest
outputs:
charm-paths: ${{ steps.get-charm-paths.outputs.charm-paths }}
track: ${{ steps.determine-track.outputs.track }}
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: Determine track
id: determine-track
shell: python
run: |
import os

if "${{ github.event_name }}" == "pull_request":
ref = "${{ github.base_ref }}"
else:
ref = "${{ github.ref_name }}"

if ref.startswith("track/"):
track = ref.removeprefix("track/")
else:
track = "latest"

with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"track={track}\n")

print(f"Track: {track}")

lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: python3 -m pipx install tox
- run: tox -e lint

unit:
name: Unit tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: python3 -m pipx install tox
- run: tox -e unit

terraform-checks:
name: Terraform
needs:
- get-charm-paths-track
uses: canonical/charmed-kubeflow-workflows/.github/workflows/terraform-checks.yaml@main
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }}
with:
charm-path: ${{ matrix.charm }}

build:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }}
name: Build charm | ${{ matrix.charm }}
needs:
- get-charm-paths-track
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v49.0.1
with:
path-to-charm-directory: ${{ matrix.charm }}
cache: true
permissions:
actions: read
contents: read

release:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }}
name: Release charm to Charmhub branch | ${{ matrix.charm }}
if: ${{ github.event_name == 'pull_request' }}
needs:
- get-charm-paths-track
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm_pr.yaml@v49.0.1
with:
track: ${{ needs.get-charm-paths-track.outputs.track }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
path-to-charm-directory: ${{ matrix.charm }}
secrets:
charmhub-token: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
permissions:
actions: read
contents: read

integration:
name: Integration tests
needs:
- build
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
charm: [envoy]
test-type: [integration, integration-ambient]
steps:
- name: Maximise GH runner space
uses: jlumbroso/free-disk-space@v1.3.1

- uses: actions/checkout@v4

- name: Install dependencies
run: pipx install tox

- name: Setup environment
run: |
sudo apt-get remove -y docker-ce docker-ce-cli containerd.io
sudo rm -rf /run/containerd
sudo snap install concierge --classic
sudo concierge prepare --trace

- name: Configure Cilium for Canonical K8s
if: matrix.test-type == 'integration-ambient'
run: |
# for context, see https://docs.cilium.io/en/stable/network/servicemesh/istio/
kubectl -n kube-system patch configmap cilium-config --type merge --patch '{"data":{"bpf-lb-sock-hostns-only":"true"}}'
kubectl -n kube-system patch configmap cilium-config --type merge --patch '{"data":{"cni-exclusive":"false"}}'
kubectl -n kube-system rollout restart daemonset cilium

- 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: Integration tests
run: |
tox -vve ${{ matrix.test-type }} -- --model testing --charm-path=${{ github.workspace }}/${{ matrix.charm }}_ubuntu@24.04-amd64.charm

- name: Get all
run: kubectl get all -A
if: failure()

- name: Get juju status
run: juju status
if: always()

- name: Get envoy workload logs
run: kubectl logs --tail 100 -n testing -l app.kubernetes.io/name=envoy -c envoy
if: failure()

- name: Get envoy operator logs
run: kubectl logs --tail 100 -n testing -l app.kubernetes.io/name=envoy -c charm
if: failure()

- name: Get mlmd workload logs
run: kubectl logs --tail 100 -n testing -l app.kubernetes.io/name=mlmd -c mlmd-grpc-server
if: failure()

- name: Get mlmd operator logs
run: kubectl logs --tail 100 -n testing -l app.kubernetes.io/name=mlmd -c charm
if: failure()

- name: Get istio-pilot workload logs
run: kubectl logs --tail 100 -ntesting -ljuju-app=istio-pilot
if: failure()

- name: Get istio-pilot operator logs
run: kubectl logs --tail 100 -n testing -l app.kubernetes.io/name=istio-pilot -c charm
if: failure()

- name: Collect charm debug artifacts
uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main
if: failure()
30 changes: 0 additions & 30 deletions .github/workflows/get-charm-paths.sh

This file was deleted.

112 changes: 0 additions & 112 deletions .github/workflows/integrate.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: On Pull Request

# On pull_request, we:
# * create backport labels if it is against main, only when the PR is opened/reopened
# * always publish to charmhub at latest/edge/branchname
# * always run tests

on:
pull_request:
Expand All @@ -19,13 +17,3 @@ jobs:
track_file_path: ".github/automatic_backport_tracks.yaml"
label_prefix: "backport "

tests:
name: Run Tests
uses: ./.github/workflows/integrate.yaml
secrets: inherit

# publish runs in parallel with tests, as we always publish in this situation
publish-charm:
name: Publish Charm
uses: ./.github/workflows/publish.yaml
secrets: inherit
29 changes: 0 additions & 29 deletions .github/workflows/on_push.yaml

This file was deleted.

Loading
Loading