From f185a9b42422adcd07d652e261a2044069b3c9a8 Mon Sep 17 00:00:00 2001 From: Hank Donnay Date: Thu, 16 Sep 2021 13:16:29 -0500 Subject: [PATCH] cicd: use common expiration action Signed-off-by: Hank Donnay --- .github/workflows/cut-release.yml | 9 +++++++-- .github/workflows/nightly.yml | 17 +++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cut-release.yml b/.github/workflows/cut-release.yml index a9206a6e14..c43fc2da65 100644 --- a/.github/workflows/cut-release.yml +++ b/.github/workflows/cut-release.yml @@ -17,7 +17,6 @@ jobs: is_prerelease: ${{ startsWith(github.ref, 'refs/tags/') && (contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc')) }} image_tag: ${{ steps.setup.outputs.image_tag }} image_repo: ${{ steps.setup.outputs.image_repo }} - expiration: ${{ steps.setup.outputs.expiration }} build_image: ${{ steps.setup.outputs.build_image }} build_go_version: ${{ steps.setup.outputs.build_go_version }} build_cache_key: ${{ steps.go.outputs.cache_key }} @@ -36,7 +35,6 @@ jobs: printf '::set-output name=tar_prefix::%s\n' "clair-${tag}" printf '::set-output name=image_tag::%s\n' "${tag#v}" printf '::set-output name=image_repo::%s\n' "${REPO}" - printf '::set-output name=expiration::%s\n' "$(($(date -u '+%s') + 1209600))" printf '::set-output name=build_image::%s\n' "${BUILD_IMAGE}" printf '::set-output name=build_go_version::%s\n' "${BUILD_IMAGE##*:}" - name: Check go version @@ -215,6 +213,13 @@ jobs: push: true tags: | quay.io/${{ needs.config.outputs.image_repo }}:${{ needs.config.outputs.image_tag }} + - name: Set Expiration + if: needs.config.outputs.is_prerelease + uses: ./.github/actions/set-image-expiration + with: + repo: ${{ needs.config.outputs.image_repo }} + tag: ${{ needs.config.outputs.image_tag }} + token: ${{ secrets.QUAY_API_TOKEN }} deploy-documentation: name: Deploy Documentation diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b948f664e1..26d8a7c2f5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -102,15 +102,8 @@ jobs: quay.io/${{ steps.setup.outputs.repo }}:${{ steps.setup.outputs.tag }}-${{ steps.setup.outputs.date }} - name: Set Expiration if: steps.setup.outputs.push && steps.setup.outputs.api - run: | - curl --config - <<. - silent - show-error - fail-with-body - data-raw=$(jq -n '{expiration: ${{ steps.setup.outputs.expiration }}}|tostring') - header="Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}" - header="Content-Type: application/json" - header="Accept: application/json" - request=PUT - url="https://quay.io/api/v1/repository/${{ steps.setup.outputs.repo }}/tag/${{ steps.setup.outputs.tag }}-${{ steps.setup.outputs.date }}" - . + uses: ./.github/actions/set-image-expiration + with: + repo: ${{ steps.setup.outputs.repo }} + tag: ${{ steps.setup.outputs.tag }}-${{ steps.setup.outputs.date }} + token: ${{ secrets.QUAY_API_TOKEN }}