Skip to content

Commit

Permalink
Add code validations.
Browse files Browse the repository at this point in the history
  • Loading branch information
friedrichwilken committed Dec 12, 2023
1 parent 702335c commit f6566b2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
14 changes: 14 additions & 0 deletions scripts/no_image_exists.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f6566b2

Please sign in to comment.