From 124521d9840b619a404d16e2bf5eaa8d83335925 Mon Sep 17 00:00:00 2001 From: "Adam D. Cornett" Date: Wed, 10 Apr 2024 10:08:42 -0700 Subject: [PATCH] adding new release action to send release information to pyxis Signed-off-by: Adam D. Cornett --- .../workflows/add-release-info-to-pyxis.yml | 51 +++++++++++++++++++ .github/workflows/build-release.yml | 17 ++++++- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/add-release-info-to-pyxis.yml diff --git a/.github/workflows/add-release-info-to-pyxis.yml b/.github/workflows/add-release-info-to-pyxis.yml new file mode 100644 index 00000000..6e4e8877 --- /dev/null +++ b/.github/workflows/add-release-info-to-pyxis.yml @@ -0,0 +1,51 @@ +name: Add Release Info to Pyxis + +on: + workflow_call: + inputs: + tag: + required: true + type: string + commit: + required: true + type: string + host: + required: true + type: string + secrets: + certificate: + required: true + key: + required: true + certificatePassword: + required: true + +env: + CERT_FILE_LOCATION: '/tmp/preflight-release.crt' + KEY_FILE_LOCATION: '/tmp/preflight-release.key' + +jobs: + call-pyxis-endpoint: + name: Add Release Info + runs-on: ubuntu-latest + steps: + - name: Save Certificate and Key + run: | + echo -en "${{ secrets.certificate }}" > ${{ env.CERT_FILE_LOCATION }} + echo -en "${{ secrets.key }}" > ${{ env.KEY_FILE_LOCATION }} + + - name: Call Pyxis API + run: | + curl -s \ + --cert '${{ env.CERT_FILE_LOCATION }}' \ + --key '${{ env.KEY_FILE_LOCATION }}' \ + --pass '${{ secrets.certificatePassword }}' \ + -H 'Content-Type: application/json' \ + -d '{"commit":"${{ inputs.commit }}","enabled_for_testing":true,"name":"github.com/redhat-openshift-ecosystem/openshift-preflight","version":"${{ inputs.tag }}"}' \ + -X POST \ + 'https://${{ inputs.host }}/v1/tools' | jq + + - name: Cleanup + if: always() + run: | + rm -f ${{ env.CERT_FILE_LOCATION }} ${{ env.KEY_FILE_LOCATION }} || true diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 500a25ec..9bcf806f 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -13,7 +13,7 @@ env: jobs: build-release: name: Build and push tag images - strategy: + strategy: matrix: architecture: [amd64,ppc64le,arm64,s390x] platform: [linux] @@ -55,6 +55,8 @@ jobs: outputs: imageName: ${{ env.IMAGE_NAME }} imageVersion: ${{ env.RELEASE_TAG }} + commitSHA: ${{ github.sha }} + pyxisHost: ${{ vars.PYXIS_HOST }} build-multiarch: permissions: @@ -87,6 +89,19 @@ jobs: password: ${{ secrets.REGISTRY_PASSWORD }} token: ${{ secrets.GITHUB_TOKEN }} + add-release-info-to-pyxis: + needs: [build-release, extract-assets] + uses: ./.github/workflows/add-release-info-to-pyxis.yml + if: "!github.event.release.prerelease" + with: + tag: ${{ needs.build-release.outputs.imageVersion }} + commit: ${{ needs.build-release.outputs.commitSHA }} + host: ${{ needs.build-release.outputs.pyxisHost }} + secrets: + certificate: ${{ secrets.PREFLIGHT_RELEASE_CERTIFICATE }} + key: ${{ secrets.PREFLIGHT_RELEASE_KEY }} + certificatePassword: ${{ secrets.PREFLIGHT_RELEASE_PASSWORD }} + copy-to-rhisv: needs: [build-release, build-multiarch] uses: ./.github/workflows/copy-to-rhisv.yml