From 40266345d237586737774533432ac4389d0c7e8f Mon Sep 17 00:00:00 2001 From: cpanato Date: Thu, 14 Mar 2024 08:49:05 +0100 Subject: [PATCH] debug Signed-off-by: cpanato --- .../workflows/modules-integration-test.yaml | 2 +- integration_test.sh | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/modules-integration-test.yaml b/.github/workflows/modules-integration-test.yaml index 5296844c13..210e797a9b 100644 --- a/.github/workflows/modules-integration-test.yaml +++ b/.github/workflows/modules-integration-test.yaml @@ -11,7 +11,7 @@ jobs: strategy: matrix: go-version: - - '1.21' + # - '1.21' - '1.22' runs-on: 'ubuntu-latest' diff --git a/integration_test.sh b/integration_test.sh index 46b4c15611..ac1eeb3c05 100755 --- a/integration_test.sh +++ b/integration_test.sh @@ -21,23 +21,26 @@ mkdir -p "$GOPATH/src/github.com/google/ko" cp -r "$ROOT_DIR/"* "$GOPATH/src/github.com/google/ko/" echo "Downloading github.com/go-training/helloworld" -GO111MODULE=off go get -d github.com/go-training/helloworld +mkdir -p "$GOPATH/src/github.com/go-training" +pushd "$GOPATH/src/github.com/go-training" || exit 1 +git clone --depth=1 https://github.com/go-training/helloworld +popd pushd "$GOPATH/src/github.com/google/ko" || exit 1 echo "Replacing hello world in vendor with TEST." -sed -i 's/Hello World/TEST/g' ./vendor/github.com/go-training/helloworld/main.go +sed -i 's/Hello World/TEST/g' $GOPATH/src/github.com/go-training/helloworld/main.go echo "Building ko" -RESULT="$(GO111MODULE="on" GOFLAGS="-mod=vendor" go build .)" +RESULT="$(GOFLAGS="-mod=vendor" go build .)" echo "Beginning scenarios." FILTER="[^ ]local[^ ]*" echo "1. GOPATH mode should always create an image that outputs 'Hello World'" -RESULT="$(GO111MODULE=off ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" +RESULT="$(./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" if [[ "$RESULT" != *"Hello World"** ]]; then echo "Test FAILED. Saw $RESULT" && exit 1 else @@ -47,7 +50,7 @@ fi echo "2. Go module auto mode should create an image that outputs 'Hello World' when run outside the module." pushd .. || exit 1 -RESULT="$(GO111MODULE=auto GOFLAGS="-mod=vendor" ./ko/ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" +RESULT="$(GOFLAGS="-mod=vendor" ./ko/ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" if [[ "$RESULT" != *"Hello World"* ]]; then echo "Test FAILED. Saw $RESULT" && exit 1 else @@ -58,7 +61,7 @@ popd || exit 1 echo "3. Auto inside the module with vendoring should output TEST" -RESULT="$(GO111MODULE=auto GOFLAGS="-mod=vendor" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" +RESULT="$(GOFLAGS="-mod=vendor" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" if [[ "$RESULT" != *"TEST"* ]]; then echo "Test FAILED. Saw $RESULT" && exit 1 else @@ -66,7 +69,7 @@ else fi echo "4. Auto inside the module without vendoring should output TEST" -RESULT="$(GO111MODULE=auto GOFLAGS="" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" +RESULT="$(GOFLAGS="" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" if [[ "$RESULT" != *"TEST"* ]]; then echo "Test FAILED. Saw $RESULT" && exit 1 else @@ -74,7 +77,7 @@ else fi echo "5. On inside the module with vendor should output TEST." -RESULT="$(GO111MODULE=on GOFLAGS="-mod=vendor" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" +RESULT="$(GOFLAGS="-mod=vendor" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" if [[ "$RESULT" != *"TEST"* ]]; then echo "Test FAILED. Saw $RESULT" && exit 1 else @@ -82,7 +85,7 @@ else fi echo "6. On inside the module without vendor should output TEST" -RESULT="$(GO111MODULE=on GOFLAGS="" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" +RESULT="$(GOFLAGS="" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)" if [[ "$RESULT" != *"TEST"* ]]; then echo "Test FAILED. Saw $RESULT" && exit 1 else @@ -91,7 +94,7 @@ fi echo "7. On outside the module should fail." pushd .. || exit 1 -GO111MODULE=on ./ko/ko build --local github.com/go-training/helloworld && exit 1 +./ko/ko build --local github.com/go-training/helloworld && exit 1 popd || exit 1 echo "8. On outside with build config specifying the test module builds." @@ -100,7 +103,7 @@ for app in foo bar ; do # test both local and fully qualified import paths for prefix in example.com . ; do import_path=$prefix/$app/cmd - RESULT="$(GO111MODULE=on GOFLAGS="" ../../ko build --local $import_path | grep "$FILTER" | xargs -I% docker run %)" + RESULT="$(GOFLAGS="" ../../ko build --local $import_path | grep "$FILTER" | xargs -I% docker run %)" if [[ "$RESULT" != *"$app"* ]]; then echo "Test FAILED for $import_path. Saw $RESULT but expected $app" && exit 1 else