Skip to content

Commit e68888a

Browse files
committed
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 <chmouel@redhat.com>
1 parent 2af394c commit e68888a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

test/e2e-common.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# Helper functions for E2E tests.
1818

19-
source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/e2e-tests.sh
19+
source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/e2e-tests.sh
2020

2121
function teardown() {
2222
subheader "Tearing down Tekton Pipelines"

test/e2e-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# This script calls out to scripts in tektoncd/plumbing to setup a cluster
1818
# and deploy Tekton Pipelines to it for running integration tests.
1919

20-
source $(dirname $0)/e2e-common.sh
20+
source $(git rev-parse --show-toplevel)/test/e2e-common.sh
2121

2222
# Script entry point.
2323

test/presubmit-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
export DISABLE_MD_LINTING=1
2727
export DISABLE_MD_LINK_CHECK=1
2828

29-
source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh
29+
source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh
3030

3131
function post_build_tests() {
3232
header "running golangci-lint"

0 commit comments

Comments
 (0)