From a6e6b0fb88b16b0861473fdd7c05bc561e3abc8b Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Tue, 7 Nov 2023 17:11:27 -0500 Subject: [PATCH] create kurl installer for ci run --- .../kurl-addon-kots-generate/action.yml | 7 ++- .../actions/kurl-create-installer/action.yml | 54 +++++++++++++++++ .github/workflows/build-test.yaml | 60 +++++++++++++------ 3 files changed, 101 insertions(+), 20 deletions(-) create mode 100644 .github/actions/kurl-create-installer/action.yml diff --git a/.github/actions/kurl-addon-kots-generate/action.yml b/.github/actions/kurl-addon-kots-generate/action.yml index b1c914cef3..1eb629418f 100644 --- a/.github/actions/kurl-addon-kots-generate/action.yml +++ b/.github/actions/kurl-addon-kots-generate/action.yml @@ -21,6 +21,9 @@ inputs: type: string description: "S3 key prefix." outputs: + s3_uri: + description: "S3 URI" + value: ${{ steps.s3-upload.outputs.s3_uri }} addon_package_url: description: "S3 package url" value: ${{ steps.s3-upload.outputs.addon_package_url }} @@ -73,5 +76,7 @@ runs: shell: bash run: | out=${{ inputs.s3_prefix }}kotsadm-${{ inputs.addon_version }}-${GITHUB_SHA:0:7}.tar.gz - aws s3 cp kotsadm-${{ inputs.addon_version }}.tar.gz s3://kots-kurl-addons-production-1658439274/$out + s3_uri=s3://kots-kurl-addons-production-1658439274/$out + echo "s3_uri=$s3_uri" >> "$GITHUB_OUTPUT" + aws s3 cp kotsadm-${{ inputs.addon_version }}.tar.gz $s3_uri echo "addon_package_url=https://kots-kurl-addons-production-1658439274.s3.amazonaws.com/$out" >> "$GITHUB_OUTPUT" diff --git a/.github/actions/kurl-create-installer/action.yml b/.github/actions/kurl-create-installer/action.yml new file mode 100644 index 0000000000..03dc86025b --- /dev/null +++ b/.github/actions/kurl-create-installer/action.yml @@ -0,0 +1,54 @@ +name: kurl-create-installer +description: "Create a kURL installer for a KOTS version" + +inputs: + addon_version: + description: "Kots version (without the 'v')." + required: true + addon_package_url: + description: "S3 package url." + required: true +outputs: + installer_id: + description: "ID of the installer" + value: ${{ steps.create-installer.outputs.installer_id }} + +runs: + using: "composite" + steps: + - name: create installer + id: create-installer + shell: bash + run: | + echo "apiVersion: cluster.kurl.sh/v1beta1 + kind: Installer + metadata: + name: kots-ci-installer + spec: + kubernetes: + version: 1.28.x + flannel: + version: latest + minio: + version: latest + openebs: + version: latest + isLocalPVEnabled: true + localPVStorageClassName: default + isCstorEnabled: false + contour: + version: latest + containerd: + version: latest + registry: + version: latest + kotsadm: + version: ${{ inputs.addon_version }} + s3Override: ${{ inputs.addon_package_url }} + ekco: + version: latest + enableInternalLoadBalancer: true" > installer.yaml + + installer_url=$(curl -s -X POST https://k8s.kurl.sh/installer -H 'Content-Type: text/yaml' --data-binary @installer.yaml) + installer_id=${installer_url:#"https://kurl.sh/"} + echo "installer_id=$installer_id" >> $GITHUB_ENV diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 30b03bb8af..3718ab016f 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -537,25 +537,12 @@ jobs: docker push ttl.sh/automated-${{ github.run_id }}/dex:${{ steps.dotenv.outputs.DEX_TAG }} - # only run validate-kurl-addon if changes to "deploy/kurl/kotsadm/template/**" - kurl-addon-changes-filter: + generate-kurl-addon: runs-on: ubuntu-20.04 - needs: [ can-run-ci, enable-tests ] + needs: [ can-run-ci, enable-tests, generate-tag, build-kots, build-push-kotsadm-image, build-kurl-proxy, build-migrations, push-dex ] outputs: - ok-to-test: ${{ steps.filter.outputs.kurl-addon }} - steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - kurl-addon: - - 'deploy/kurl/kotsadm/template/**' - - 'deploy/kurl/kotsadm/testgrid-os-spec.yaml' - validate-kurl-addon: - runs-on: ubuntu-20.04 - if: ${{ needs.kurl-addon-changes-filter.outputs.ok-to-test == 'true' }} - needs: [ can-run-ci, enable-tests, generate-tag, kurl-addon-changes-filter, build-kots, build-push-kotsadm-image, build-kurl-proxy, build-migrations, push-dex ] + addon_version: ${{ steps.vars.outputs.addon_version }} + addon_package_url: ${{ steps.addon-generate.outputs.addon_package_url }} steps: - name: checkout uses: actions/checkout@v3 @@ -586,12 +573,34 @@ jobs: kotsadm_image_namespace: automated-${{ github.run_id }} kotsadm_image_tag: 24h kotsadm_binary_override: bin/kots.tar.gz + # only run validate-kurl-addon if changes to "deploy/kurl/kotsadm/template/**" + kurl-addon-changes-filter: + runs-on: ubuntu-20.04 + needs: [ can-run-ci, enable-tests ] + outputs: + ok-to-test: ${{ steps.filter.outputs.kurl-addon }} + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + kurl-addon: + - 'deploy/kurl/kotsadm/template/**' + - 'deploy/kurl/kotsadm/testgrid-os-spec.yaml' + validate-kurl-addon: + runs-on: ubuntu-20.04 + if: ${{ needs.kurl-addon-changes-filter.outputs.ok-to-test == 'true' }} + needs: [ can-run-ci, enable-tests, kurl-addon-changes-filter, generate-kurl-addon ] + steps: + - name: checkout + uses: actions/checkout@v3 - name: test kurl add-on id: addon-test uses: ./.github/actions/kurl-addon-kots-test with: - addon_version: ${{ steps.vars.outputs.addon_version }} - addon_package_url: ${{ steps.addon-generate.outputs.addon_package_url }} + addon_version: ${{ needs.generate-kurl-addon.outputs.addon_version }} + addon_package_url: ${{ needs.generate-kurl-addon.outputs.addon_package_url }} testgrid_api_token: ${{ secrets.TESTGRID_PROD_API_TOKEN }} - name: comment testgrid url uses: mshick/add-pr-comment@v2 @@ -600,6 +609,19 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} allow-repeats: false + + create-kurl-installer: + runs-on: ubuntu-20.04 + needs: [ can-run-ci, enable-tests, generate-kurl-addon ] + steps: + - uses: ./.github/actions/kurl-create-installer + id: create-installer + with: + addon_version: ${{ needs.generate-kurl-addon.outputs.addon_version }} + addon_package_url: ${{ needs.generate-kurl-addon.outputs.addon_package_url }} + outputs: + installer_id: ${{ steps.create-installer.outputs.installer_id }} + cmx-versions: runs-on: ubuntu-20.04