-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
verify operator uses webhook version and release is conditional
- Loading branch information
Andrew
committed
Sep 30, 2024
1 parent
f9fa660
commit d5cfd80
Showing
8 changed files
with
53 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
paths: | ||
- minimal-app/** | ||
- .github/workflows/minimal-app.yml | ||
- .github/workflows/scripts | ||
push: | ||
branches: | ||
- main | ||
|
@@ -60,36 +61,41 @@ jobs: | |
IMAGE_NAME=$(mvn help:evaluate -Dexpression=image-name -q -DforceStdout) | ||
echo "REGISTRY=$REGISTRY" >> "$GITHUB_OUTPUT" | ||
echo "TAG_NAME=${{ env.GIT_TAG_PREFIX }}$VERSION" >> "$GITHUB_OUTPUT" | ||
echo "IMAGE_NAME=$REGISTRY/$IMAGE_NAME:$VERSION" >> "$GITHUB_OUTPUT" | ||
echo "FULL_IMAGE_NAME=$REGISTRY/$IMAGE_NAME:$VERSION" >> "$GITHUB_OUTPUT" | ||
cat $GITHUB_OUTPUT | ||
id: naming-selector | ||
name: generate names for artifacts | ||
- run: | | ||
! docker manifest inspect ${{ steps.naming-selector.outputs.IMAGE_NAME }} | ||
name: confirm image is not already pushed | ||
- run: | | ||
git fetch --tags | ||
! git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}" | ||
name: confirm git tag does not exist | ||
if git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}"; then | ||
# confirm image exists | ||
docker manifest inspect ${{ steps.naming-selector.outputs.FULL_IMAGE_NAME }} | ||
else | ||
echo "needs_release=true" >> $GITHUB_ENV | ||
fi | ||
name: check if release is needed | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: "${{ env.JAVA_VERSION }}" | ||
distribution: "temurin" | ||
- run: mvn --batch-mode --update-snapshots verify | ||
if: env.needs_release == 'true' | ||
name: build image | ||
|
||
- uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
if: env.needs_release == 'true' | ||
with: | ||
registry: ${{ steps.naming-selector.outputs.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: docker push ${{ steps.naming-selector.outputs.IMAGE_NAME }} | ||
- run: docker push ${{ steps.naming-selector.outputs.FULL_IMAGE_NAME }} | ||
if: env.needs_release == 'true' | ||
|
||
- uses: mathieudutour/[email protected] | ||
if: env.needs_release == 'true' | ||
id: tag_version | ||
with: | ||
custom_tag: ${{ steps.naming-selector.outputs.TAG_NAME }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
- operator/** | ||
- "!operator/webhook/**" | ||
- .github/workflows/operator.yml | ||
- .github/workflows/scripts | ||
push: | ||
branches: | ||
- main | ||
|
@@ -57,13 +58,17 @@ jobs: | |
- run: | | ||
git fetch --tags | ||
! git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}" | ||
name: confirm git tag does not exist | ||
if ! git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}"; then | ||
echo "needs_release=true" >> $GITHUB_ENV | ||
fi | ||
name: check if release is needed | ||
- run: make prep-release | ||
if: env.needs_release == 'true' | ||
name: generate release files | ||
|
||
- uses: mathieudutour/[email protected] | ||
if: env.needs_release == 'true' | ||
id: tag_version | ||
with: | ||
custom_tag: ${{ steps.naming-selector.outputs.TAG_NAME }} | ||
|
@@ -72,6 +77,7 @@ jobs: | |
tag_prefix: "" | ||
|
||
- uses: ncipollo/release-action@v1 | ||
if: env.needs_release == 'true' | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
|
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
.github/workflows/scripts/shared/verify_current_webhook_img.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
OPERATOR_DIR=operator | ||
OPERATOR_CONTROLLER_YAML=$OPERATOR_DIR/controller/integrationroute-controller.yaml | ||
|
||
verify_current_webhook_img() { | ||
current_webhook_img=$(make --no-print-directory -C operator/webhook get-image-name) | ||
webhook_image_used=$(yq eval '.spec.template.spec.containers[].image' $OPERATOR_CONTROLLER_YAML) | ||
|
||
test -n "$current_webhook_img" | ||
test -n "$webhook_image_used" | ||
|
||
test "$webhook_image_used" = "$current_webhook_img" || (echo "Operator is not using current version of webhook image" && exit 1) | ||
} | ||
|
||
verify_current_webhook_img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
set -eux | ||
|
||
OPERATOR_DIR=operator | ||
OPERATOR_CONTROLLER_YAML=$OPERATOR_DIR/controller/integrationroute-controller.yaml | ||
|
||
verify_current_webhook_img() { | ||
current_webhook_img=$(make --no-print-directory -C operator/webhook get-image-name) | ||
webhook_image_used=$(yq eval '.spec.template.spec.containers[].image' $OPERATOR_CONTROLLER_YAML) | ||
|
||
test -n "$current_webhook_img" | ||
test -n "$webhook_image_used" | ||
|
||
test "$webhook_image_used" = "$current_webhook_img" || (echo "Operator is not using current version of webhook image" && exit 1) | ||
} | ||
|
||
verify_version_bump() { | ||
potential_tag=$(make --no-print-directory -C $OPERATOR_DIR get-tag) | ||
sh .github/workflows/scripts/verify_changes_update_version.sh $potential_tag $OPERATOR_DIR | ||
sh .github/workflows/scripts/shared/verify_changes_update_version.sh $potential_tag $OPERATOR_DIR | ||
} | ||
|
||
verify_current_webhook_img | ||
sh .github/workflows/scripts/shared/verify_current_webhook_img.sh | ||
verify_version_bump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
paths: | ||
- operator/webhook/** | ||
- .github/workflows/webhook.yml | ||
- .github/workflows/scripts | ||
push: | ||
branches: | ||
- main | ||
|
@@ -82,15 +83,22 @@ jobs: | |
name: generate names for artifacts | ||
- run: | | ||
! docker manifest inspect ${{ steps.naming-selector.outputs.FULL_IMAGE_NAME }} | ||
name: confirm image is not already pushed | ||
git fetch --tags | ||
if git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}"; then | ||
# confirm image exists | ||
docker manifest inspect ${{ steps.naming-selector.outputs.FULL_IMAGE_NAME }} | ||
else | ||
echo "needs_release=true" >> $GITHUB_ENV | ||
fi | ||
name: check if release is needed | ||
- run: | | ||
git fetch --tags | ||
! git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}" | ||
name: confirm git tag does not exist | ||
- uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
if: env.needs_release == 'true' | ||
with: | ||
registry: ${{ steps.naming-selector.outputs.REGISTRY }} | ||
username: ${{ github.actor }} | ||
|
@@ -100,13 +108,15 @@ jobs: | |
uses: docker/setup-buildx-action@v3 | ||
|
||
- uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
if: env.needs_release == 'true' | ||
with: | ||
context: ${{ env.WORKING_DIR }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.naming-selector.outputs.FULL_IMAGE_NAME }} | ||
|
||
- uses: mathieudutour/[email protected] | ||
if: env.needs_release == 'true' | ||
id: tag_version | ||
with: | ||
custom_tag: ${{ steps.naming-selector.outputs.TAG_NAME }} | ||
|