2023-06-19 10:21:48 +01:00

125 lines
3.7 KiB
YAML

name: Upgrade and test cluster
description: >-
Run a Helm upgrade using the specified values, wait for the cluster to
become ready and run Sonobuoy against it
inputs:
name:
description: The name of the cluster
required: true
os-client-config-file:
description: The path of the OpenStack clouds file
required: true
default: ./clouds.yml
os-cloud:
description: The name of the cloud within the OpenStack clouds file
required: true
default: openstack
values-common-path:
description: The path to a file containing common values
required: true
default: ./values-common.yaml
kubernetes-version:
description: The Kubernetes version in the image
required: true
image-id:
description: The ID of the image to use
required: true
sonobuoy-mode:
description: Specify "full" to do a full Sonobuoy run, anything else runs a smoke test only
required: true
default: smoke
sonobuoy-upload:
description: Specify "yes" to upload the Sonobuoy run as an artifact
required: true
default: "no"
runs:
using: "composite"
steps:
- name: Install or upgrade cluster
shell: bash
run: |-
helm upgrade ${{ inputs.name }} ./charts/openstack-cluster \
--install \
--dependency-update \
--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 }}
# Wait for the upgrade to start before checking if it is complete
# This is to make sure the controller has actioned the update before
# progressing to wait for ready
- name: Wait for cluster not ready
shell: bash
run: |-
kubectl wait clusters/${{ inputs.name }} \
--for=condition=ready=false \
--timeout 30m
- name: Wait for cluster ready
shell: bash
run: |-
kubectl wait clusters/${{ inputs.name }} \
--for=condition=ready \
--timeout 30m
- name: Wait for machine deployments to be running
shell: bash
run: |-
kubectl wait machinedeployments \
--all \
--for=jsonpath='{.status.phase}'=Running \
--timeout 30m
- name: Wait for addons to deploy
shell: bash
run: |-
kubectl wait manifests \
--all \
--for=jsonpath='{.status.phase}'=Deployed \
--timeout 20m \
&& \
kubectl wait helmreleases \
--all \
--for=jsonpath='{.status.phase}'=Deployed \
--timeout 20m
- name: Write kubeconfig
shell: bash
run: |-
kubectl get secret ${{ inputs.name }}-kubeconfig \
-o go-template='{{ .data.value | base64decode }}' \
> kubeconfig
- name: Run sonobuoy [smoke]
shell: bash
run: sonobuoy run --mode quick --wait
env:
KUBECONFIG: ./kubeconfig
if: "${{ inputs.sonobuoy-mode != 'full' }}"
- name: Run sonobuoy [full]
shell: bash
run: sonobuoy run --wait
env:
KUBECONFIG: ./kubeconfig
if: "${{ inputs.sonobuoy-mode == 'full' }}"
- name: Retrieve sonobuoy results
shell: bash
run: ./scripts/sonobuoy-retrieve.sh --filename ./sonobuoy-results-${{ inputs.name }}.tar.gz
env:
KUBECONFIG: ./kubeconfig
if: "${{ inputs.sonobuoy-upload == 'yes' }}"
- name: Upload sonobuoy results artifact
uses: actions/upload-artifact@v3
with:
name: sonobuoy-results-${{ inputs.name }}
path: ./sonobuoy-results-${{ inputs.name }}.tar.gz
if: "${{ inputs.sonobuoy-upload == 'yes' }}"