From e8a7e340f8ffe30480dd01b84843c65ae89ea866 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 | 39 +++++++++++++++++++ .github/workflows/build-release.yml | 23 ++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) 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..55faa004 --- /dev/null +++ b/.github/workflows/add-release-info-to-pyxis.yml @@ -0,0 +1,39 @@ +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 +# enabled: +# required: true +# type: boolean + secrets: + certificate: + required: true + certificatePassword: + required: true + +jobs: + call-pyxis-endpoint: + name: Add Release Info + runs-on: ubuntu-latest + steps: + - name: Save Certificate + run: | + printf ${{ secrets.certificate }} >> certificate.pem + + - name: Call Pyxis API + run: | + curl --cert 'certificate.pem:${{ secrets.certificatePassword }}' \ + -H 'Content-Type: application/json' \ + -d '{"commit":"${{ inputs.commit }}","enabled_for_testing":false,"name":"github.com/redhat-openshift-ecosystem/openshift-preflight","version":"${{ inputs.tag }}"}' \ + -X POST \ + https://${{ inputs.host }}/v1/tools diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 500a25ec..f925fde2 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -13,16 +13,19 @@ env: jobs: build-release: name: Build and push tag images - strategy: + strategy: matrix: architecture: [amd64,ppc64le,arm64,s390x] platform: [linux] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set Env Tags + - name: Set Release Tag run: echo RELEASE_TAG=$(echo $GITHUB_REF | cut -d '/' -f 3) >> $GITHUB_ENV + - name: Set Version + run: echo COMMIT_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -55,6 +58,9 @@ jobs: outputs: imageName: ${{ env.IMAGE_NAME }} imageVersion: ${{ env.RELEASE_TAG }} + commitSHA: ${{ env.COMMIT_SHA }} + pyxisHost: ${{ vars.PYXIS_HOST }} + #enabled: ${{ env.PYXIS_RELEASE_ENABLED }} build-multiarch: permissions: @@ -87,6 +93,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 }} + #enabled: ${{ needs.build-release.outputs.enabled }} + secrets: + certificate: $${{ secrets.PREFLIGHT_RELEASE_CERTIFICATE }} + certificatePassword: ${{ secrets.PREFLIGHT_RELEASE_PASSWORD }} + copy-to-rhisv: needs: [build-release, build-multiarch] uses: ./.github/workflows/copy-to-rhisv.yml