-
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.
- Loading branch information
Showing
2 changed files
with
27 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,15 @@ function run_single_diff() { | |
comp=$(kubectl get "$type" "$name" -oyaml | yq -r '.spec.compositionRef.name') | ||
echo "composition: $comp $type/$name" | ||
kubectl get compositions.apiextensions.crossplane.io "$comp" -oyaml > hack/tmp/composition.yaml | ||
go run github.com/crossplane/crossplane/cmd/[email protected] render hack/tmp/xr.yaml hack/tmp/composition.yaml hack/diff/function.yaml -o "$dir_name" > "$res_dir_name/$3.yaml" | ||
crank_func render hack/tmp/xr.yaml hack/tmp/composition.yaml hack/diff/function.yaml -o "$dir_name" > "$res_dir_name/$3.yaml" | ||
} | ||
|
||
function crank_func() { | ||
mkdir -p .work/bin | ||
[ ! -f .work/bin/crank ] && curl -s https://releases.crossplane.io/stable/v1.17.0/bin/linux_amd64/crank -o .work/bin/crank | ||
chmod +x .work/bin/crank | ||
if .work/bin/crank -h > /dev/null 2>&1; then .work/bin/crank "$@"; | ||
else go run github.com/crossplane/crossplane/cmd/[email protected] "$@"; fi | ||
} | ||
|
||
function get_running_func_version() { | ||
|
@@ -89,11 +97,14 @@ function second_diff() { | |
function compare() { | ||
for f in hack/res/*/*; | ||
do | ||
echo "comparing $f" | ||
# enable color | ||
# ignore changed array order | ||
# exclude nested managedFields in kube objects | ||
# exclude nested resourceVersion | ||
# don't print the huge dyff header | ||
go run github.com/homeport/dyff/cmd/[email protected] between \ | ||
dyff between \ | ||
--color=on \ | ||
-i \ | ||
--exclude-regexp "spec.forProvider.manifest.metadata.managedFields.*" \ | ||
--exclude "spec.forProvider.manifest.metadata.resourceVersion" \ | ||
|
@@ -103,6 +114,15 @@ function compare() { | |
done | ||
} | ||
function dyff() { | ||
mkdir -p .work/bin | ||
[ ! -f .work/bin/dyff ] && curl -sL https://github.com/homeport/dyff/releases/download/v1.9.1/dyff_1.9.1_linux_amd64.tar.gz -o .work/bin/dyff.tar.gz && \ | ||
tar xvfz .work/bin/dyff.tar.gz -C .work/bin > /dev/null 2>&1 | ||
chmod +x .work/bin/dyff | ||
if .work/bin/dyff version > /dev/null 2>&1 ; then .work/bin/dyff "$@"; | ||
else go run github.com/homeport/dyff/cmd/[email protected] "$@"; fi | ||
} | ||
function clean() { | ||
rm -rf hack/tmp | ||
rm -rf hack/res | ||
|