diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index 79fbe60d..764a45b5 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -14,14 +14,21 @@ jobs: runs-on: ubuntu-latest steps: + - name: Verify, that an image with the target release version as a tag, does not exis. + run: ./scripts/no_image_exists ${{ github.event.inputs.name }} + - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Check that the image tag defined in the sec-scanner-config is the same as the release version (${{ github.event.inputs.name }}). + - name: Check that the image tag defined in the sec-scanner-config is the same as the release version (${{ github.event.inputs.name }}) run: ./scripts/check_image.sh ${{ github.event.inputs.name }} + - name: Unit test + run: make test + + - name: make build + run: make build + create-draft: name: Create draft release needs: verify-head-status @@ -46,6 +53,7 @@ jobs: RELEASE_ID=$(./scripts/create_draft_release.sh ${{ github.event.inputs.name }}) echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT + # This will trigger the prow release jobs. - name: Create lightweight tag run: | git tag ${{ github.event.inputs.name }} diff --git a/scripts/no_image_exists.sh b/scripts/no_image_exists.sh new file mode 100755 index 00000000..5cb2eed2 --- /dev/null +++ b/scripts/no_image_exists.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +TAG=${1:-latest} +IMAGE=${2:-europe-docker.pkg.dev/kyma-project/prod/nats-manager} + +docker manifest inspect $IMAGE:$TAG + +if [ $? -eq 0 ]; then + echo "Error: image ${IMAGE}:${TAG} found." + exit 1 +else + echo "Image not found." + exit 0 +fi