mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 10:15:22 +00:00
Adjust scripts to be go v1.14 compatible
This commit is contained in:
14
Makefile
14
Makefile
@@ -218,10 +218,6 @@ test-unit-cmd-all:
|
|||||||
test-go-mod:
|
test-go-mod:
|
||||||
./travis/check-go-mod.sh
|
./travis/check-go-mod.sh
|
||||||
|
|
||||||
.PHONY:
|
|
||||||
test-examples-kustomize-against-HEAD: $(MYGOBIN)/kustomize $(MYGOBIN)/mdrip
|
|
||||||
./hack/testExamplesAgainstKustomize.sh HEAD
|
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
test-examples-e2e-kustomize: $(MYGOBIN)/mdrip $(MYGOBIN)/kind
|
test-examples-e2e-kustomize: $(MYGOBIN)/mdrip $(MYGOBIN)/kind
|
||||||
( \
|
( \
|
||||||
@@ -232,13 +228,17 @@ test-examples-e2e-kustomize: $(MYGOBIN)/mdrip $(MYGOBIN)/kind
|
|||||||
./hack/testExamplesE2EAgainstKustomize.sh .; \
|
./hack/testExamplesE2EAgainstKustomize.sh .; \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
.PHONY:
|
||||||
|
test-examples-kustomize-against-HEAD: $(MYGOBIN)/kustomize $(MYGOBIN)/mdrip
|
||||||
|
./hack/testExamplesAgainstKustomize.sh HEAD
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
test-examples-kustomize-against-latest: $(MYGOBIN)/mdrip
|
test-examples-kustomize-against-latest: $(MYGOBIN)/mdrip
|
||||||
( \
|
( \
|
||||||
set -e; \
|
set -e; \
|
||||||
/bin/rm -f $(MYGOBIN)/kustomize; \
|
/bin/rm -f $(MYGOBIN)/kustomize; \
|
||||||
echo "Installing kustomize from latest."; \
|
echo "Installing kustomize from latest."; \
|
||||||
GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v3; \
|
GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3@v3.5.4; \
|
||||||
./hack/testExamplesAgainstKustomize.sh latest; \
|
./hack/testExamplesAgainstKustomize.sh latest; \
|
||||||
echo "Reinstalling kustomize from HEAD."; \
|
echo "Reinstalling kustomize from HEAD."; \
|
||||||
cd kustomize; go install .; \
|
cd kustomize; go install .; \
|
||||||
@@ -289,6 +289,10 @@ $(MYGOBIN)/helmV3:
|
|||||||
rm -rf $$d \
|
rm -rf $$d \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Default version of helm is v2 for the time being.
|
||||||
|
$(MYGOBIN)/helm: $(MYGOBIN)/helmV2
|
||||||
|
ln -s $(MYGOBIN)/helmV2 $(MYGOBIN)/helm
|
||||||
|
|
||||||
$(MYGOBIN)/kind:
|
$(MYGOBIN)/kind:
|
||||||
( \
|
( \
|
||||||
set -e; \
|
set -e; \
|
||||||
|
|||||||
15
hack/shellHelpers.sh
Normal file
15
hack/shellHelpers.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2019 The Kubernetes Authors.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# TODO: Make the code ignorant of the CI environment "brand name".
|
||||||
|
# We used to run CI tests on travis, and disabled certain tests
|
||||||
|
# when running there. Now we run on Prow, so look for that.
|
||||||
|
# https://github.com/kubernetes/test-infra/blob/master/prow/jobs.md
|
||||||
|
# Might be useful to eschew using the brand name of the CI environment
|
||||||
|
# (replace "travis" with "RemoteCI" or something - not just switch to "prow").
|
||||||
|
|
||||||
|
function onLinuxAndNotOnRemoteCI {
|
||||||
|
[[ ("linux" == "$(go env GOOS)") && (-z ${PROW_JOB_ID+x}) ]] && return
|
||||||
|
false
|
||||||
|
}
|
||||||
@@ -9,10 +9,8 @@ set -o pipefail
|
|||||||
|
|
||||||
version=$1
|
version=$1
|
||||||
|
|
||||||
function onLinuxAndNotOnTravis {
|
# All hack scripts should run from top level.
|
||||||
[[ ("linux" == "$(go env GOOS)") && (-z ${TRAVIS+x}) ]] && return
|
. hack/shellHelpers.sh
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO: change the label?
|
# TODO: change the label?
|
||||||
# We test against the latest release, and HEAD, and presumably
|
# We test against the latest release, and HEAD, and presumably
|
||||||
@@ -22,13 +20,12 @@ mdrip --mode test \
|
|||||||
--label testAgainstLatestRelease examples
|
--label testAgainstLatestRelease examples
|
||||||
|
|
||||||
# TODO: make work for non-linux
|
# TODO: make work for non-linux
|
||||||
if onLinuxAndNotOnTravis; then
|
if onLinuxAndNotOnRemoteCI; then
|
||||||
echo "On linux, and not on travis, so running the notravis example tests."
|
echo "On linux, and not on remote CI. Running expensive tests."
|
||||||
|
|
||||||
# Requires helm.
|
# Requires helm.
|
||||||
make $(go env GOPATH)/bin/helm
|
make $(go env GOPATH)/bin/helm
|
||||||
mdrip --mode test \
|
mdrip --mode test --label helmtest examples/chart.md
|
||||||
--label helmtest examples/chart.md
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Example tests passed against ${version}."
|
echo "Example tests passed against ${version}."
|
||||||
|
|||||||
@@ -14,27 +14,19 @@ set -o pipefail
|
|||||||
|
|
||||||
rcAccumulator=0
|
rcAccumulator=0
|
||||||
|
|
||||||
function onLinuxAndNotOnTravis {
|
# All hack scripts should run from top level.
|
||||||
# TODO: Make the code ignorant of the CI environment "brand name".
|
. hack/shellHelpers.sh
|
||||||
# We used to run CI tests on travis, and disabled certain tests
|
|
||||||
# when running there. Now we run on Prow, so look for that.
|
|
||||||
# https://github.com/kubernetes/test-infra/blob/master/prow/jobs.md
|
|
||||||
# Should eschew using the brand name of the CI environment
|
|
||||||
# (replace "travis" with "CI_env" or something - not just switch to "prow").
|
|
||||||
[[ ("linux" == "$(go env GOOS)") && (-z ${$PROW_JOB_ID+x}) ]] && return
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
function runTest {
|
function runTest {
|
||||||
local file=$1
|
local file=$1
|
||||||
local code=0
|
local code=0
|
||||||
if grep -q "// +build notravis" "$file"; then
|
if grep -q "// +build notravis" "$file"; then
|
||||||
if onLinuxAndNotOnTravis; then
|
if onLinuxAndNotOnRemoteCI; then
|
||||||
go test -v -tags=notravis $file
|
go test -v -tags=notravis $file
|
||||||
code=$?
|
code=$?
|
||||||
else
|
else
|
||||||
# TODO: make work for non-linux
|
# TODO: make work for non-linux
|
||||||
echo "Not on linux or on travis; skipping $file"
|
echo "Not on linux or on remote CI; skipping $file"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
go test -v $file
|
go test -v $file
|
||||||
@@ -55,10 +47,11 @@ function scanDir {
|
|||||||
popd >& /dev/null
|
popd >& /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
if onLinuxAndNotOnTravis; then
|
if onLinuxAndNotOnRemoteCI; then
|
||||||
# Some of these tests have special deps.
|
# Some of these tests have special deps.
|
||||||
make $(go env GOPATH)/bin/helmV2
|
make $(go env GOPATH)/bin/helmV2
|
||||||
make $(go env GOPATH)/bin/helmV3
|
make $(go env GOPATH)/bin/helmV3
|
||||||
|
make $(go env GOPATH)/bin/helm
|
||||||
make $(go env GOPATH)/bin/kubeval
|
make $(go env GOPATH)/bin/kubeval
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user