Add tasks to test upgrade from latest tag

This commit is contained in:
Matt Pryor 2023-06-19 13:36:46 +01:00
parent 3885e4129f
commit 45b83f5b49
2 changed files with 78 additions and 39 deletions

View File

@ -16,6 +16,12 @@ inputs:
description: The name of the cloud within the OpenStack clouds file
required: true
default: openstack
chart-version:
description: >-
Use the specified chart version from the repo if given. If not,
use the chart from the directory in the current checkout.
required: true
default: ""
values-common-path:
description: The path to a file containing common values
required: true
@ -38,7 +44,7 @@ inputs:
runs:
using: "composite"
steps:
- name: Install or upgrade cluster
- name: Install or upgrade cluster from directory
shell: bash
run: |-
helm upgrade ${{ inputs.name }} ./charts/openstack-cluster \
@ -49,6 +55,21 @@ runs:
--set cloudName=${{ inputs.os-cloud }} \
--set kubernetesVersion=${{ inputs.kubernetes-version }} \
--set machineImageId=${{ inputs.image-id }}
if: "${{ inputs.chart-version == '' }}"
- name: Install or upgrade cluster from repository
shell: bash
run: |-
helm upgrade ${{ inputs.name }} openstack-cluster \
--repo https://stackhpc.github.io/capi-helm-charts \
--version ${{ inputs.chart-version }} \
--install \
--values ${{ inputs.os-client-config-file }} \
--values ${{ inputs.values-common-path }} \
--set cloudName=${{ inputs.os-cloud }} \
--set kubernetesVersion=${{ inputs.kubernetes-version }} \
--set machineImageId=${{ inputs.image-id }}
if: "${{ inputs.chart-version != '' }}"
# Wait for the upgrade to start before checking if it is complete
# This is to make sure the controller has actioned the update before

View File

@ -19,17 +19,6 @@ jobs:
test-chart:
runs-on: ubuntu-latest
steps:
- name: Get latest tag
id: latest-tag
run: |
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"
- run: echo "${{ steps.latest-tag.outputs.tag-name }}"
- run: "false"
- name: Checkout
uses: actions/checkout@v3
@ -192,41 +181,70 @@ jobs:
# This will run a sonobuoy smoke test after every step with a full test at the end
#####
- name: Deploy Kubernetes 1.25 for Kubernetes upgrade test
uses: ./.github/actions/upgrade-and-test
with:
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 }}
# - name: Deploy Kubernetes 1.25 for Kubernetes upgrade test
# uses: ./.github/actions/upgrade-and-test
# with:
# 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 }}
- name: Upgrade to Kubernetes 1.26
uses: ./.github/actions/upgrade-and-test
with:
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 }}
# - name: Upgrade to Kubernetes 1.26
# uses: ./.github/actions/upgrade-and-test
# with:
# 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 }}
- name: Upgrade to Kubernetes 1.27
uses: ./.github/actions/upgrade-and-test
with:
name: ci-${{ github.run_id }}-kube-upgrade
kubernetes-version: ${{ fromJson(inputs.images).kube-1-27-version }}
image-id: ${{ fromJson(inputs.images).kube-1-27-image }}
sonobuoy-mode: full
sonobuoy-upload: "yes"
if: ${{ !github.event.pull_request.draft }}
# - name: Upgrade to Kubernetes 1.27
# uses: ./.github/actions/upgrade-and-test
# with:
# name: ci-${{ github.run_id }}-kube-upgrade
# kubernetes-version: ${{ fromJson(inputs.images).kube-1-27-version }}
# image-id: ${{ fromJson(inputs.images).kube-1-27-image }}
# sonobuoy-mode: full
# sonobuoy-upload: "yes"
# if: ${{ !github.event.pull_request.draft }}
- name: Delete upgrade deployment
run: helm delete ci-${{ github.run_id }}-kube-upgrade --wait
if: ${{ !github.event.pull_request.draft && always() }}
# - name: Delete Kubernetes upgrade deployment
# run: helm delete ci-${{ github.run_id }}-kube-upgrade --wait
# if: ${{ !github.event.pull_request.draft && always() }}
#####
# On a reviewable PR, we also test that we can upgrade from a cluster deployed
# using the latest tag
#####
- name: Get latest tag
id: latest-tag
run: |
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 }}
- name: Deploy Kubernetes 1.27 with latest tag for chart upgrade test
uses: ./.github/actions/upgrade-and-test
with:
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 }}
chart-version: ${{ steps.latest-tag.outputs.tag-name }}
if: ${{ !github.event.pull_request.draft }}
- name: Upgrade to current chart
uses: ./.github/actions/upgrade-and-test
with:
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 }}
- name: Delete chart upgrade deployment
run: helm delete ci-${{ github.run_id }}-chart-upgrade --wait
if: ${{ !github.event.pull_request.draft && always() }}
- name: Output controller logs
if: ${{ always() }}
run: |