From 97e435375513383b7491d98490db0cc48b3d6edf Mon Sep 17 00:00:00 2001 From: jregan Date: Thu, 10 Dec 2020 12:31:14 -0800 Subject: [PATCH] Update test of examples against new releases. --- Makefile | 23 ++++++++++------------- hack/testExamplesAgainstKustomize.sh | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 8430647e8..0aa7df317 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,8 @@ verify-kustomize: \ lint-kustomize \ test-unit-kustomize-all \ test-examples-kustomize-against-HEAD \ - test-examples-kustomize-against-3.8.6 + test-examples-kustomize-against-3.9.0 \ + test-examples-kustomize-against-3.8.8 # The following target referenced by a file in # https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/kustomize @@ -38,7 +39,8 @@ prow-presubmit-check: \ test-unit-cmd-all \ test-go-mod \ test-examples-kustomize-against-HEAD \ - test-examples-kustomize-against-3.8.6 + test-examples-kustomize-against-3.9.0 \ + test-examples-kustomize-against-3.8.8 .PHONY: verify-kustomize-e2e verify-kustomize-e2e: test-examples-e2e-kustomize @@ -274,17 +276,12 @@ test-examples-kustomize-against-HEAD: $(MYGOBIN)/kustomize $(MYGOBIN)/mdrip ./hack/testExamplesAgainstKustomize.sh HEAD .PHONY: -test-examples-kustomize-against-3.8.6: $(MYGOBIN)/mdrip - ( \ - set -e; \ - tag=v3.8.6; \ - /bin/rm -f $(MYGOBIN)/kustomize; \ - echo "Installing kustomize $$tag."; \ - GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3@$${tag}; \ - ./hack/testExamplesAgainstKustomize.sh $$tag; \ - echo "Reinstalling kustomize from HEAD."; \ - cd kustomize; go install .; \ - ) +test-examples-kustomize-against-3.9.0: $(MYGOBIN)/mdrip + ./hack/testExamplesAgainstKustomize.sh v3.9.0 + +.PHONY: +test-examples-kustomize-against-3.8.8: $(MYGOBIN)/mdrip + ./hack/testExamplesAgainstKustomize.sh v3.8.8 # linux only. # This is for testing an example plugin that diff --git a/hack/testExamplesAgainstKustomize.sh b/hack/testExamplesAgainstKustomize.sh index 5cd622f2d..f94466995 100755 --- a/hack/testExamplesAgainstKustomize.sh +++ b/hack/testExamplesAgainstKustomize.sh @@ -12,11 +12,22 @@ version=$1 # All hack scripts should run from top level. . hack/shellHelpers.sh +echo "Installing kustomize ${version}" + +# Always rebuild, never assume the installed verion is +# the right one to test. +rm -f $(go env GOPATH)/bin/kustomize +if [ "$version" == "HEAD" ]; then + (cd kustomize; go install .) +else + GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3@${version} +fi + # TODO: change the label? # We test against the latest release, and HEAD, and presumably # any branch using this label, so it should probably get # a new value. -mdrip --mode test --blockTimeOut 9m \ +mdrip --mode test --blockTimeOut 15m \ --label testAgainstLatestRelease examples # TODO: make work for non-linux @@ -28,4 +39,10 @@ if onLinuxAndNotOnRemoteCI; then mdrip --mode test --label helmtest examples/chart.md fi +# Force outside logic to rebuild kustomize rather than +# rely on whatever this script just did. Tests should +# be order independent. +echo "Removing kustomize ${version}" +rm $(go env GOPATH)/bin/kustomize + echo "Example tests passed against ${version}."