forked from openstack-k8s-operators/swift-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openstack-k8s-operators#302 from mrkisaolamb/crd-s…
…chema-checker [make][pre-commit]Check CRD schema to avoid update issues
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 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
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,15 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
if [ -f "$INSTALL_DIR/crd-schema-checker" ]; then | ||
exit 0 | ||
fi | ||
|
||
mkdir -p "$INSTALL_DIR/git-tmp" | ||
git clone https://github.com/openshift/crd-schema-checker.git \ | ||
-b "$CRD_SCHEMA_CHECKER_VERSION" "$INSTALL_DIR/git-tmp" | ||
pushd "$INSTALL_DIR/git-tmp" | ||
GOWORK=off make | ||
cp crd-schema-checker "$INSTALL_DIR/" | ||
popd | ||
rm -rf "$INSTALL_DIR/git-tmp" |
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,21 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
CHECKER=$INSTALL_DIR/crd-schema-checker | ||
|
||
TMP_DIR=$(mktemp -d) | ||
|
||
function cleanup { | ||
rm -rf "$TMP_DIR" | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
|
||
for crd in config/crd/bases/*.yaml; do | ||
mkdir -p "$(dirname "$TMP_DIR/$crd")" | ||
git show "$BASE_REF:$crd" > "$TMP_DIR/$crd" | ||
$CHECKER check-manifests \ | ||
--existing-crd-filename="$TMP_DIR/$crd" \ | ||
--new-crd-filename="$crd" | ||
done |