From 37bfe17ffe311f2b1163f634dba2b3a329ed59ba Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Mon, 6 Jan 2020 15:13:44 +0100 Subject: [PATCH 1/2] Don't assume $0 is the script source Part of our 'downstream' CI we reuse the `test/e2e-common.sh` functions, we have a script that source the test/e2e-common.sh and run with the downstream specifics functions. $0 in the e2e-common assume the script is run from `test/e2e-tests.sh` when our script which source test/e2e-tests.sh is something else somewhere else. Let's use git to safely detect the toplevel of the directory Signed-off-by: Chmouel Boudjnah --- hack/update-codegen.sh | 2 +- hack/update-deps.sh | 2 +- hack/verify-codegen.sh | 2 +- test/e2e-common.sh | 2 +- test/e2e-tests-upgrade.sh | 2 +- test/e2e-tests-yaml.sh | 2 +- test/e2e-tests.sh | 2 +- test/presubmit-tests.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index f730a19cb8f..a3db51e58d8 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -18,7 +18,7 @@ set -o errexit set -o nounset set -o pipefail -source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/library.sh +source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/library.sh # generate the code with: # --output-base because this script should also be able to run inside the vendor dir of diff --git a/hack/update-deps.sh b/hack/update-deps.sh index 3fbe4ec98d8..3576f2b173d 100755 --- a/hack/update-deps.sh +++ b/hack/update-deps.sh @@ -18,7 +18,7 @@ set -o errexit set -o nounset set -o pipefail -source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/library.sh +source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/library.sh cd ${REPO_ROOT_DIR} diff --git a/hack/verify-codegen.sh b/hack/verify-codegen.sh index 969c2794db8..ae3037cd970 100755 --- a/hack/verify-codegen.sh +++ b/hack/verify-codegen.sh @@ -18,7 +18,7 @@ set -o errexit set -o nounset set -o pipefail -source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/library.sh +source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/library.sh readonly TMP_DIFFROOT="$(mktemp -d ${REPO_ROOT_DIR}/tmpdiffroot.XXXXXX)" diff --git a/test/e2e-common.sh b/test/e2e-common.sh index edbf6d3e7f0..897f0a8f33f 100755 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -16,7 +16,7 @@ # Helper functions for E2E tests. -source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/e2e-tests.sh +source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/e2e-tests.sh function teardown() { subheader "Tearing down Tekton Pipelines" diff --git a/test/e2e-tests-upgrade.sh b/test/e2e-tests-upgrade.sh index 56e9b320f2c..cce0c60bd89 100755 --- a/test/e2e-tests-upgrade.sh +++ b/test/e2e-tests-upgrade.sh @@ -24,7 +24,7 @@ # Scenario 2: install the previous release, create the pipelines and tasks, upgrade # to the current release, and validate whether the Tekton pipeline works. -source $(dirname $0)/e2e-common.sh +source $(git rev-parse --show-toplevel)/test/e2e-common.sh PREVIOUS_PIPELINE_VERSION=v0.5.2 # Script entry point. diff --git a/test/e2e-tests-yaml.sh b/test/e2e-tests-yaml.sh index 6fd160b2d5e..19562b371fe 100755 --- a/test/e2e-tests-yaml.sh +++ b/test/e2e-tests-yaml.sh @@ -18,7 +18,7 @@ # and deploy Tekton Pipelines to it for running integration tests. go get -d github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher/cmd/gcs-fetcher -source $(dirname $0)/e2e-common.sh +source $(git rev-parse --show-toplevel)/test/e2e-common.sh # Script entry point. diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index ac249899bbe..e9ef0e877f6 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -17,7 +17,7 @@ # This script calls out to scripts in tektoncd/plumbing to setup a cluster # and deploy Tekton Pipelines to it for running integration tests. -source $(dirname $0)/e2e-common.sh +source $(git rev-parse --show-toplevel)/test/e2e-common.sh # Script entry point. diff --git a/test/presubmit-tests.sh b/test/presubmit-tests.sh index 77435e52bcf..2042ab57201 100755 --- a/test/presubmit-tests.sh +++ b/test/presubmit-tests.sh @@ -26,7 +26,7 @@ export DISABLE_MD_LINTING=1 export DISABLE_MD_LINK_CHECK=1 -source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh +source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh function post_build_tests() { header "running golangci-lint" From bf11611b1bc4191479af1af16720e48fe51f7120 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Thu, 9 Jan 2020 16:04:35 +0100 Subject: [PATCH 2/2] Remove last go get from the e2e-test-yaml Following commit 2af394cc0d7c60beb3c9c055c95241d32c4e2674 there was a `go get` left which wasnt removed. Since we have it in vendor directory we don't need to donwload it again. Signed-off-by: Chmouel Boudjnah --- test/e2e-tests-yaml.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test/e2e-tests-yaml.sh b/test/e2e-tests-yaml.sh index 19562b371fe..064be59e4fd 100755 --- a/test/e2e-tests-yaml.sh +++ b/test/e2e-tests-yaml.sh @@ -17,7 +17,6 @@ # This script calls out to scripts in tektoncd/plumbing to setup a cluster # and deploy Tekton Pipelines to it for running integration tests. -go get -d github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher/cmd/gcs-fetcher source $(git rev-parse --show-toplevel)/test/e2e-common.sh # Script entry point.