From c71e9a18a2e87fdf73b84619269f134c996a7b54 Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Fri, 10 Nov 2023 11:29:09 -0500 Subject: [PATCH] wip: always generate kurl installer --- .../kurl-addon-kots-generate/action.yml | 7 +- .github/workflows/build-test.yaml | 104 ++++++++++++++---- 2 files changed, 91 insertions(+), 20 deletions(-) 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/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 30b03bb8af..6e24fdc028 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,63 @@ 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: actions/checkout@v3 + with: + fetch-depth: 0 + - name: create installer + id: create-installer + run: | + set +e + + 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: ${{ needs.generate-kurl-addon.outputs.addon_version }} + s3Override: ${{ needs.generate-kurl-addon.outputs.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_OUTPUT + outputs: + installer_id: ${{ steps.create-installer.outputs.installer_id }} + + + echo-kurl-installer-id: + runs-on: ubuntu-20.04 + needs: [ can-run-ci, enable-tests, create-kurl-installer ] + steps: + - name: echo installer id + run: | + echo "installer_id=${{ needs.create-kurl-installer.outputs.installer_id }}" + cmx-versions: runs-on: ubuntu-20.04