Add smoke tests to main

This commit is contained in:
Matt Pryor 2023-06-19 17:16:36 +01:00
parent 3a87df91a0
commit d54f6ca089
4 changed files with 56 additions and 26 deletions

33
.github/workflows/main.yaml vendored Normal file
View File

@ -0,0 +1,33 @@
name: test main
on:
push:
branches:
- main
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
lint:
uses: ./.github/workflows/lint.yaml
sync_images:
needs: [lint]
uses: ./.github/workflows/sync-images.yaml
secrets: inherit
ensure_capi_images:
needs: [lint]
uses: ./.github/workflows/ensure-capi-images.yaml
secrets: inherit
test:
needs: [sync_images, ensure_capi_images]
uses: ./.github/workflows/test.yaml
secrets: inherit
with:
# Pass the images as JSON
images: ${{ toJSON(needs.ensure_capi_images.outputs) }}
# Only run the smoke tests on main
tests-full: false

View File

@ -34,4 +34,7 @@ jobs:
with:
# Pass the images as JSON
images: ${{ toJSON(needs.ensure_capi_images.outputs) }}
# If the PR is in draft, just run smoke tests
# If the PR is in review, run the full test suite
tests-full: ${{ !github.event.pull_request.draft }}
if: github.repository == 'stackhpc/capi-helm-charts'

View File

@ -6,6 +6,11 @@ on:
type: string
description: JSON-encoded dictionary of images and versions
required: true
tests-full:
type: boolean
description: Indicates whether to run the full test suite or just a smoke test
required: true
default: false
env:
HELM_VERSION: v3.11.3
@ -160,7 +165,7 @@ jobs:
name: test-group1
#####
# On draft PRs, just run the smoke test on a clean deployment of the latest supported version
# For the smoke test, we do a clean deployment of the latest supported version
#####
- name: Test clean Kubernetes 1.27 deployment
@ -170,14 +175,14 @@ jobs:
kubernetes-version: ${{ fromJson(inputs.images).kube-1-27-version }}
image-id: ${{ fromJson(inputs.images).kube-1-27-image }}
sonobuoy-upload: "yes"
if: ${{ github.event.pull_request.draft }}
if: ${{ !inputs.tests-full }}
- name: Delete Kubernetes 1.27 deployment
run: helm delete ci-${{ github.run_id }}-kube-latest --wait
if: ${{ github.event.pull_request.draft && always() }}
if: ${{ !inputs.tests-full && always() }}
#####
# On a reviewable PR, test that we can upgrade from a cluster deployed using the latest tag
# On a full test, first test that we can upgrade from a cluster deployed using the latest tag
#####
- name: Get latest tag
@ -186,7 +191,7 @@ jobs:
set -eo pipefail
TAG_NAME="$(curl -fsSL "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest" | jq -r '.tag_name')"
echo "tag-name=${TAG_NAME}" >> "$GITHUB_OUTPUT"
if: ${{ !github.event.pull_request.draft }}
if: ${{ inputs.tests-full }}
- name: Deploy Kubernetes 1.27 with latest tag for chart upgrade test
uses: ./.github/actions/upgrade-and-test
@ -195,7 +200,7 @@ jobs:
kubernetes-version: ${{ fromJson(inputs.images).kube-1-27-version }}
image-id: ${{ fromJson(inputs.images).kube-1-27-image }}
chart-version: ${{ steps.latest-tag.outputs.tag-name }}
if: ${{ !github.event.pull_request.draft }}
if: ${{ inputs.tests-full }}
- name: Upgrade to current chart
uses: ./.github/actions/upgrade-and-test
@ -203,14 +208,14 @@ jobs:
name: ci-${{ github.run_id }}-chart-upgrade
kubernetes-version: ${{ fromJson(inputs.images).kube-1-27-version }}
image-id: ${{ fromJson(inputs.images).kube-1-27-image }}
if: ${{ !github.event.pull_request.draft }}
if: ${{ inputs.tests-full }}
- name: Delete chart upgrade deployment
run: helm delete ci-${{ github.run_id }}-chart-upgrade --wait
if: ${{ !github.event.pull_request.draft && always() }}
if: ${{ inputs.tests-full && always() }}
#####
# On a reviewable PR, run a full upgrade test
# On a full test, next run a full upgrade test
# This will run a sonobuoy smoke test after every step with a full test at the end
#####
@ -220,7 +225,7 @@ jobs:
name: ci-${{ github.run_id }}-kube-upgrade
kubernetes-version: ${{ fromJson(inputs.images).kube-1-25-version }}
image-id: ${{ fromJson(inputs.images).kube-1-25-image }}
if: ${{ !github.event.pull_request.draft }}
if: ${{ inputs.tests-full }}
- name: Upgrade to Kubernetes 1.26
uses: ./.github/actions/upgrade-and-test
@ -228,7 +233,7 @@ jobs:
name: ci-${{ github.run_id }}-kube-upgrade
kubernetes-version: ${{ fromJson(inputs.images).kube-1-26-version }}
image-id: ${{ fromJson(inputs.images).kube-1-26-image }}
if: ${{ !github.event.pull_request.draft }}
if: ${{ inputs.tests-full }}
- name: Upgrade to Kubernetes 1.27
uses: ./.github/actions/upgrade-and-test
@ -238,11 +243,11 @@ jobs:
image-id: ${{ fromJson(inputs.images).kube-1-27-image }}
sonobuoy-mode: full
sonobuoy-upload: "yes"
if: ${{ !github.event.pull_request.draft }}
if: ${{ inputs.tests-full }}
- name: Delete Kubernetes upgrade deployment
run: helm delete ci-${{ github.run_id }}-kube-upgrade --wait
if: ${{ !github.event.pull_request.draft && always() }}
if: ${{ inputs.tests-full && always() }}
- name: Output controller logs
if: ${{ always() }}

View File

@ -1,7 +1,6 @@
# capi-helm-charts
![Lint](https://github.com/stackhpc/capi-helm-charts/actions/workflows/lint.yaml/badge.svg?branch=main)
![Test Helm](https://github.com/stackhpc/capi-helm-charts/actions/workflows/install.yaml/badge.svg?branch=main)
![Publish Charts](https://github.com/stackhpc/capi-helm-charts/actions/workflows/publish-artifacts.yaml/badge.svg?branch=main)
![Test](https://github.com/stackhpc/capi-helm-charts/actions/workflows/main.yaml/badge.svg?branch=main)
![Publish](https://github.com/stackhpc/capi-helm-charts/actions/workflows/publish-artifacts.yaml/badge.svg?branch=main)
This repository contains [Helm charts](https://helm.sh/) for deploying [Kubernetes](https://kubernetes.io/)
clusters using [Cluster API](https://cluster-api.sigs.k8s.io/).
@ -19,16 +18,6 @@ To list the available versions for the charts:
helm search repo capi --devel --versions
```
> **WARNING**
>
> The `openstack-cluster` chart depends on features in
> [cluster-api-provider-openstack](https://github.com/kubernetes-sigs/cluster-api-provider-openstack)
> that are not yet in a release.
>
> StackHPC maintain custom builds of `cluster-api-provider-openstack` for use with these charts.
> You can find these in [the StackHPC fork](https://github.com/stackhpc/cluster-api-provider-openstack/releases)
> of `cluster-api-provider-openstack`.
Currently, the following charts are available:
| Chart | Description |