-
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 various version related assumptions during CI (#20)
* verify version assumptions in CI --------- Co-authored-by: Andrew <andrew.pelletier@octo.us>
- Loading branch information
1 parent
c4b19ba
commit 0da7124
Showing
11 changed files
with
114 additions
and
23 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
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
28 changes: 28 additions & 0 deletions
28
.github/workflows/scripts/verify_changes_update_version.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,28 @@ | ||
# Verifies changes to directory have an updated version | ||
|
||
if [ -z "$1" ] || [ -z "$2" ]; then | ||
echo "Usage: sh $0 [potential_git_tag] <path_to_directory>" | ||
exit 1 | ||
fi | ||
|
||
set -eux | ||
|
||
POTENTIAL_GIT_TAG=$1 | ||
DIRECTORY=$2 | ||
|
||
main() { | ||
# github actions job does not fetch other git objects by default | ||
git fetch origin $GITHUB_BASE_REF | ||
git fetch --tags | ||
|
||
changes_in_pr=$(git diff origin/$GITHUB_BASE_REF -- $DIRECTORY) | ||
if [ -n "$changes_in_pr" ]; then | ||
echo "Found changes between current branch and $GITHUB_BASE_REF" | ||
if git tag | grep -x "$POTENTIAL_GIT_TAG"; then | ||
echo "$POTENTIAL_GIT_TAG was already released. Please increment the version if changes were made to $DIRECTORY." | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
main |
11 changes: 11 additions & 0 deletions
11
.github/workflows/scripts/verify_minimal_app_releasable.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,11 @@ | ||
set -eux | ||
|
||
MINIMAL_APP_DIR=minimal-app | ||
|
||
verify_version_bump() { | ||
version=$(mvn -f minimal-app/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
potential_tag="${GIT_TAG_PREFIX}${version}" | ||
sh .github/workflows/scripts/verify_changes_update_version.sh $potential_tag $MINIMAL_APP_DIR | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 | ||
} | ||
|
||
verify_current_webhook_img | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
set -eux | ||
|
||
WEBHOOK_DIR=operator/webhook | ||
|
||
verify_version_bump() { | ||
potential_tag=$(make --no-print-directory -C $WEBHOOK_DIR get-tag) | ||
sh .github/workflows/scripts/verify_changes_update_version.sh $potential_tag $WEBHOOK_DIR | ||
} | ||
|
||
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
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
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