name: Test OpenStack cluster chart on: workflow_call: inputs: images: 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 sanity check required: true default: false jobs: # This job tests a clean deployment against the latest version # It is the only job that runs when tests-full=false # For tests-full=true it creates an internal network + router and runs Sonobuoy in conformance mode # For tests-full=false it uses a pre-existing internal network and runs Sonobuoy in quick mode latest: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Create kind cluster uses: helm/kind-action@v1.8.0 - name: Set up test environment uses: ./.github/actions/setup - name: Write cloud credential run: echo "$CLOUD" > ./clouds.yaml env: CLOUD: ${{ secrets.CLOUD }} - name: Write Helm values run: echo "$VALUES" > ./values.yaml env: VALUES: | clouds: openstack: auth: project_id: ${{ secrets.PROJECT_ID }} verify: false registryMirrors: docker.io: - ${{ secrets.DOCKER_HUB_MIRROR_URL }} controlPlane: machineFlavor: ${{ secrets.CONTROL_PLANE_FLAVOR }} machineCount: 1 nodeGroups: - name: md-0 machineFlavor: ${{ secrets.NODE_GROUP_FLAVOR }} machineCount: 2 - name: Apply network configuration run: echo "$NETWORKING" >> ./values.yaml env: NETWORKING: | clusterNetworking: internalNetwork: networkFilter: tags: capi-helm-chart-ci if: ${{ !inputs.tests-full }} - name: Test clean Kubernetes 1.28 deployment uses: ./.github/actions/upgrade-and-test with: name: ci-${{ github.run_id }}-${{ github.job }} kubernetes-version: ${{ fromJson(inputs.images).kube-1-28-version }} image-id: ${{ fromJson(inputs.images).kube-1-28-image }} sonobuoy-mode: ${{ inputs.tests-full && 'certified-conformance' || 'quick' }} sonobuoy-upload: ${{ inputs.tests-full && 'yes' || 'no' }} - name: Delete Kubernetes 1.28 deployment run: helm delete ci-${{ github.run_id }}-${{ github.job }} --wait if: ${{ always() }} - name: Upload logs uses: ./.github/actions/upload-logs with: name-suffix: ${{ github.job }} if: ${{ always() }} # This job tests Kubernetes upgrade # It only runs for non-draft PRs # It uses a pre-existing internal network kube-upgrade: runs-on: ubuntu-latest if: ${{ inputs.tests-full }} steps: - name: Checkout uses: actions/checkout@v3 - name: Create kind cluster uses: helm/kind-action@v1.8.0 - name: Set up test environment uses: ./.github/actions/setup - name: Write cloud credential run: echo "$CLOUD" > ./clouds.yaml env: CLOUD: ${{ secrets.CLOUD }} - name: Write Helm values run: echo "$VALUES" > ./values.yaml env: VALUES: | clouds: openstack: auth: project_id: ${{ secrets.PROJECT_ID }} verify: false registryMirrors: docker.io: - ${{ secrets.DOCKER_HUB_MIRROR_URL }} clusterNetworking: internalNetwork: networkFilter: tags: capi-helm-chart-ci controlPlane: machineFlavor: ${{ secrets.CONTROL_PLANE_FLAVOR }} machineCount: 1 nodeGroups: - name: md-0 machineFlavor: ${{ secrets.NODE_GROUP_FLAVOR }} machineCount: 2 - name: Deploy Kubernetes 1.26 for Kubernetes upgrade test uses: ./.github/actions/upgrade-and-test with: name: ci-${{ github.run_id }}-${{ github.job }} kubernetes-version: ${{ fromJson(inputs.images).kube-1-26-version }} image-id: ${{ fromJson(inputs.images).kube-1-26-image }} - name: Upgrade to Kubernetes 1.27 uses: ./.github/actions/upgrade-and-test with: name: ci-${{ github.run_id }}-${{ github.job }} kubernetes-version: ${{ fromJson(inputs.images).kube-1-27-version }} image-id: ${{ fromJson(inputs.images).kube-1-27-image }} - name: Upgrade to Kubernetes 1.28 uses: ./.github/actions/upgrade-and-test with: name: ci-${{ github.run_id }}-${{ github.job }} kubernetes-version: ${{ fromJson(inputs.images).kube-1-28-version }} image-id: ${{ fromJson(inputs.images).kube-1-28-image }} - name: Delete Kubernetes upgrade deployment run: helm delete ci-${{ github.run_id }}-${{ github.job }} --wait if: ${{ always() }} - name: Upload logs uses: ./.github/actions/upload-logs with: name-suffix: ${{ github.job }} if: ${{ always() }} # This jobs tests upgrading the chart + dependencies from the latest tag # It only runs for non-draft PRs # It uses a pre-existing internal network # It installs ALL of the addons so that we test upgrading them chart-upgrade: runs-on: ubuntu-latest if: ${{ inputs.tests-full }} steps: - name: Checkout current uses: actions/checkout@v3 with: path: current - 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" - name: Checkout latest tag uses: actions/checkout@v3 with: ref: ${{ steps.latest-tag.outputs.tag-name }} path: latest-tag - name: Write cloud credential run: echo "$CLOUD" > ./clouds.yaml env: CLOUD: ${{ secrets.CLOUD }} - name: Write Helm values run: echo "$VALUES" > ./values.yaml env: VALUES: | clouds: openstack: auth: project_id: ${{ secrets.PROJECT_ID }} verify: false registryMirrors: docker.io: - ${{ secrets.DOCKER_HUB_MIRROR_URL }} clusterNetworking: internalNetwork: networkFilter: tags: capi-helm-chart-ci controlPlane: machineFlavor: ${{ secrets.CONTROL_PLANE_FLAVOR }} machineCount: 1 nodeGroups: - name: md-0 machineFlavor: ${{ secrets.NODE_GROUP_FLAVOR }} machineCount: 2 addons: kubernetesDashboard: enabled: true monitoring: enabled: true - name: Create kind cluster uses: helm/kind-action@v1.8.0 # For the setup, we use a merged dependencies file in case new dependencies # are added by the code under test, ensuring that the older dependencies are # used where they are specified - name: Create merged dependencies file run: > jq -s '.[0] * .[1]' \ current/dependencies.json \ latest-tag/dependencies.json \ > dependencies-merged.json - name: Set up test environment with dependencies from latest tag uses: ./current/.github/actions/setup with: dependencies-path: dependencies-merged.json - name: Deploy cluster with chart from latest tag uses: ./current/.github/actions/upgrade-and-test with: chart-directory: latest-tag/charts/openstack-cluster name: ci-${{ github.run_id }}-${{ github.job }} kubernetes-version: ${{ fromJson(inputs.images).kube-1-28-version }} image-id: ${{ fromJson(inputs.images).kube-1-28-image }} # TODO(mkjpryor) remove this once calico csi-node-driver is fixed in a tagged version skip-workload-status: "yes" - name: Update test environment with current dependencies uses: ./current/.github/actions/setup with: dependencies-path: current/dependencies.json - name: Upgrade cluster to current chart uses: ./current/.github/actions/upgrade-and-test with: chart-directory: current/charts/openstack-cluster name: ci-${{ github.run_id }}-${{ github.job }} kubernetes-version: ${{ fromJson(inputs.images).kube-1-28-version }} image-id: ${{ fromJson(inputs.images).kube-1-28-image }} - name: Delete chart upgrade deployment run: helm delete ci-${{ github.run_id }}-${{ github.job }} --wait if: ${{ always() }} - name: Upload logs uses: ./current/.github/actions/upload-logs with: name-suffix: ${{ github.job }} if: ${{ always() }}