From 156fa38e5598fbad1db5291e33924b55199b04ec Mon Sep 17 00:00:00 2001 From: Matt Pryor Date: Wed, 14 Jun 2023 16:04:34 -0700 Subject: [PATCH] Try a local action for ensure-image --- .github/actions/ensure-image/action.yml | 37 +++++++ .github/workflows/ensure-capi-images.yaml | 35 +++---- .github/workflows/pr.yaml | 116 +++++++++++----------- 3 files changed, 108 insertions(+), 80 deletions(-) create mode 100644 .github/actions/ensure-image/action.yml diff --git a/.github/actions/ensure-image/action.yml b/.github/actions/ensure-image/action.yml new file mode 100644 index 0000000..1b956ea --- /dev/null +++ b/.github/actions/ensure-image/action.yml @@ -0,0 +1,37 @@ +name: Ensure OpenStack image + +description: >- + Ensures that the specified image exists in the target OpenStack cloud. + +inputs: + 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 + images-base-url: + description: The base URL to use for downloading images + required: true + default: https://object.arcus.openstack.hpc.cam.ac.uk/swift/v1/AUTH_f0dc9cb312144d0aa44037c9149d2513/azimuth-images-prerelease/ + image-name: + description: The name of the image to use + required: true + +outputs: + image-id: + description: The ID of the image + value: ${{ steps.ensure-image.outputs.image-id }} + +runs: + using: "composite" + steps: + - id: ensure-image + run: ./scripts/ensure-image.sh + env: + OS_CLIENT_CONFIG_FILE: ${{ inputs.os-client-config-file }} + OS_CLOUD: ${{ inputs.os-cloud }} + IMAGES_BASE_URL: ${{ inputs.images-base-url }} + IMAGE_NAME: ${{ inputs.image-name }} diff --git a/.github/workflows/ensure-capi-images.yaml b/.github/workflows/ensure-capi-images.yaml index 3f6f778..8cfaf5b 100644 --- a/.github/workflows/ensure-capi-images.yaml +++ b/.github/workflows/ensure-capi-images.yaml @@ -19,9 +19,6 @@ on: kube-1-27-version: value: ${{ jobs.ensure-capi-images.outputs.kube-1-27-version }} -env: - IMAGES_BASE_URL: https://object.arcus.openstack.hpc.cam.ac.uk/swift/v1/AUTH_f0dc9cb312144d0aa44037c9149d2513/azimuth-images-prerelease/ - jobs: ensure-capi-images: runs-on: ubuntu-latest @@ -56,35 +53,27 @@ jobs: - name: Ensure Kubernetes 1.24 image id: kube-1-24 - run: ./scripts/ensure-image.sh - env: - OS_CLOUD: openstack - OS_CLIENT_CONFIG_FILE: ./clouds.yml - IMAGE_NAME: ubuntu-focal-kube-v1.24.14-230602-1702 + uses: ./.github/actions/ensure-image + with: + image-name: ubuntu-focal-kube-v1.24.14-230602-1702 if: ${{ !github.event.pull_request.draft }} - name: Ensure Kubernetes 1.25 image id: kube-1-25 - run: ./scripts/ensure-image.sh - env: - OS_CLOUD: openstack - OS_CLIENT_CONFIG_FILE: ./clouds.yml - IMAGE_NAME: ubuntu-focal-kube-v1.25.10-230602-1732 + uses: ./.github/actions/ensure-image + with: + image-name: ubuntu-focal-kube-v1.25.10-230602-1732 if: ${{ !github.event.pull_request.draft }} - name: Ensure Kubernetes 1.26 image id: kube-1-26 - run: ./scripts/ensure-image.sh - env: - OS_CLOUD: openstack - OS_CLIENT_CONFIG_FILE: ./clouds.yml - IMAGE_NAME: ubuntu-focal-kube-v1.26.5-230602-1757 + uses: ./.github/actions/ensure-image + with: + image-name: ubuntu-focal-kube-v1.26.5-230602-1757 if: ${{ !github.event.pull_request.draft }} - name: Ensure Kubernetes 1.27 image id: kube-1-27 - run: ./scripts/ensure-image.sh - env: - OS_CLOUD: openstack - OS_CLIENT_CONFIG_FILE: ./clouds.yml - IMAGE_NAME: ubuntu-focal-kube-v1.27.2-230602-1824 + uses: ./.github/actions/ensure-image + with: + image-name: ubuntu-focal-kube-v1.27.2-230602-1824 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7edbe57..90d2797 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -27,63 +27,65 @@ jobs: secrets: inherit if: github.repository == 'stackhpc/capi-helm-charts' - test_kube_1_24: - needs: [sync_images, ensure_capi_images] - uses: ./.github/workflows/test.yaml - secrets: inherit - with: - name: kube-1-24 - image: ${{ needs.ensure_capi_images.outputs.kube-1-24-image }} - version: ${{ needs.ensure_capi_images.outputs.kube-1-24-version }} - upgrade-image: ${{ needs.ensure_capi_images.outputs.kube-1-25-image }} - upgrade-version: ${{ needs.ensure_capi_images.outputs.kube-1-25-version }} - if: >- - ${{ - github.repository == 'stackhpc/capi-helm-charts' && - !github.event.pull_request.draft - }} + # This job tests that each of the supported versions can deploy from scratch - test_kube_1_25: - needs: [sync_images, ensure_capi_images, test_kube_1_24] - uses: ./.github/workflows/test.yaml - secrets: inherit - with: - name: kube-1-25 - image: ${{ needs.ensure_capi_images.outputs.kube-1-25-image }} - version: ${{ needs.ensure_capi_images.outputs.kube-1-25-version }} - upgrade-image: ${{ needs.ensure_capi_images.outputs.kube-1-26-image }} - upgrade-version: ${{ needs.ensure_capi_images.outputs.kube-1-26-version }} - if: >- - ${{ - github.repository == 'stackhpc/capi-helm-charts' && - !github.event.pull_request.draft - }} + # test_kube_1_24: + # needs: [sync_images, ensure_capi_images] + # uses: ./.github/workflows/test.yaml + # secrets: inherit + # with: + # name: kube-1-24 + # image: ${{ needs.ensure_capi_images.outputs.kube-1-24-image }} + # version: ${{ needs.ensure_capi_images.outputs.kube-1-24-version }} + # upgrade-image: ${{ needs.ensure_capi_images.outputs.kube-1-25-image }} + # upgrade-version: ${{ needs.ensure_capi_images.outputs.kube-1-25-version }} + # if: >- + # ${{ + # github.repository == 'stackhpc/capi-helm-charts' && + # !github.event.pull_request.draft + # }} - test_kube_1_26: - needs: [sync_images, ensure_capi_images, test_kube_1_25] - uses: ./.github/workflows/test.yaml - secrets: inherit - with: - name: kube-1-26 - image: ${{ needs.ensure_capi_images.outputs.kube-1-26-image }} - version: ${{ needs.ensure_capi_images.outputs.kube-1-26-version }} - upgrade-image: ${{ needs.ensure_capi_images.outputs.kube-1-27-image }} - upgrade-version: ${{ needs.ensure_capi_images.outputs.kube-1-27-version }} - if: >- - ${{ - github.repository == 'stackhpc/capi-helm-charts' && - !github.event.pull_request.draft - }} + # test_kube_1_25: + # needs: [sync_images, ensure_capi_images, test_kube_1_24] + # uses: ./.github/workflows/test.yaml + # secrets: inherit + # with: + # name: kube-1-25 + # image: ${{ needs.ensure_capi_images.outputs.kube-1-25-image }} + # version: ${{ needs.ensure_capi_images.outputs.kube-1-25-version }} + # upgrade-image: ${{ needs.ensure_capi_images.outputs.kube-1-26-image }} + # upgrade-version: ${{ needs.ensure_capi_images.outputs.kube-1-26-version }} + # if: >- + # ${{ + # github.repository == 'stackhpc/capi-helm-charts' && + # !github.event.pull_request.draft + # }} - test_kube_1_27: - needs: [sync_images, ensure_capi_images, test_kube_1_26] - uses: ./.github/workflows/test.yaml - secrets: inherit - with: - name: kube-1-27 - image: ${{ needs.ensure_capi_images.outputs.kube-1-27-image }} - version: ${{ needs.ensure_capi_images.outputs.kube-1-27-version }} - # We only run full Sonobuoy on the latest version, and never on draft PRs - # The latest version will not have an upgrade image - sonobuoy-full: ${{ !github.event.pull_request.draft }} - if: ${{ github.repository == 'stackhpc/capi-helm-charts' }} + # test_kube_1_26: + # needs: [sync_images, ensure_capi_images, test_kube_1_25] + # uses: ./.github/workflows/test.yaml + # secrets: inherit + # with: + # name: kube-1-26 + # image: ${{ needs.ensure_capi_images.outputs.kube-1-26-image }} + # version: ${{ needs.ensure_capi_images.outputs.kube-1-26-version }} + # upgrade-image: ${{ needs.ensure_capi_images.outputs.kube-1-27-image }} + # upgrade-version: ${{ needs.ensure_capi_images.outputs.kube-1-27-version }} + # if: >- + # ${{ + # github.repository == 'stackhpc/capi-helm-charts' && + # !github.event.pull_request.draft + # }} + + # test_kube_1_27: + # needs: [sync_images, ensure_capi_images, test_kube_1_26] + # uses: ./.github/workflows/test.yaml + # secrets: inherit + # with: + # name: kube-1-27 + # image: ${{ needs.ensure_capi_images.outputs.kube-1-27-image }} + # version: ${{ needs.ensure_capi_images.outputs.kube-1-27-version }} + # # We only run full Sonobuoy on the latest version, and never on draft PRs + # # The latest version will not have an upgrade image + # sonobuoy-full: ${{ !github.event.pull_request.draft }} + # if: ${{ github.repository == 'stackhpc/capi-helm-charts' }}