From a6f53c633cf11843caa2cf84ca080b2497307af6 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:57:34 +0530 Subject: [PATCH] Bumping go version to 1.20.7 (#796)Signed-off-by: sethiyash (#798) * Bumping go version to 1.20.7 (#796) Signed-off-by: sethiyash * Fix tests for kubernetes 1.27.x (#794) Signed-off-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com> --------- Signed-off-by: sethiyash Signed-off-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com> Co-authored-by: Yash Sethiya Co-authored-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com> --- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test-gh-k8s-1.16.yml | 2 +- .github/workflows/test-gh.yml | 2 +- .github/workflows/trivy-scan.yml | 2 +- test/e2e/formatted_error_test.go | 26 ++++++++++++++++++- .../ignore_failing_api_services_flag_test.go | 2 +- 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index e76e89798..ad2b9d6f2 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.20.5 + go-version: 1.20.7 - uses: actions/checkout@v2 with: fetch-depth: '0' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 36d0ec3ce..adfdbd1a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.20.5 + go-version: 1.20.7 - name: Retrieve version run: | echo "TAG_NAME=$(echo ${{ github.ref }} | grep -Eo 'v[0-9].*')" >> $GITHUB_OUTPUT diff --git a/.github/workflows/test-gh-k8s-1.16.yml b/.github/workflows/test-gh-k8s-1.16.yml index 22e4a70ec..b3c8d906c 100644 --- a/.github/workflows/test-gh-k8s-1.16.yml +++ b/.github/workflows/test-gh-k8s-1.16.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.20.5 + go-version: 1.20.7 - name: Check out code into the Go module directory uses: actions/checkout@v2 with: diff --git a/.github/workflows/test-gh.yml b/.github/workflows/test-gh.yml index 9f29abcc8..68022d9f5 100644 --- a/.github/workflows/test-gh.yml +++ b/.github/workflows/test-gh.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.20.5 + go-version: 1.20.7 - name: Check out code into the Go module directory uses: actions/checkout@v2 with: diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index 03ebdeb8d..16e95f64e 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -10,7 +10,7 @@ jobs: with: repo: carvel-dev/kapp tool: kapp - goVersion: 1.20.5 + goVersion: 1.20.7 secrets: githubToken: ${{ secrets.GITHUB_TOKEN }} slackWebhookURL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/test/e2e/formatted_error_test.go b/test/e2e/formatted_error_test.go index 7dfe27782..c8dc756d4 100644 --- a/test/e2e/formatted_error_test.go +++ b/test/e2e/formatted_error_test.go @@ -62,7 +62,25 @@ kapp: Error: create job/successful-job (batch/v1) namespace: default: (reason: Invalid) `) - _, err := kapp.RunWithOpts([]string{"deploy", "-f", "-", "-a", name}, + minorVersion, err := getServerMinorVersion() + require.NoErrorf(t, err, "Error getting k8s server minor version") + // batch.kubernetes.io/controller-uid and batch.kubernetes.io/job-name annotaions are added + if minorVersion >= 27 { + expectedErr = strings.TrimSpace(` +kapp: Error: create job/successful-job (batch/v1) namespace: default: + Creating resource job/successful-job (batch/v1) namespace: default: + API server says: + Job.batch "successful-job" is invalid: + + - spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{-replaced-, "blah":"balh", -replaced-}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: 'selector' not auto-generated + + - spec.template.metadata.labels: Invalid value: map[string]string{-replaced-, -replaced-, -replaced-, "foo":"foo", "job-name":"successful-job", -replaced-, -replaced-}: 'selector' does not match template 'labels' + + (reason: Invalid) +`) + } + + _, err = kapp.RunWithOpts([]string{"deploy", "-f", "-", "-a", name}, RunOpts{StdinReader: strings.NewReader(yaml1), AllowError: true}) out := strings.ReplaceAll(err.Error(), "`", "'") @@ -73,6 +91,12 @@ kapp: Error: create job/successful-job (batch/v1) namespace: default: replaceUIDs := regexp.MustCompile(`"controller-uid":"[^"]+"`) out = replaceUIDs.ReplaceAllString(out, "-replaced-") + replaceUIDs = regexp.MustCompile(`"batch\.kubernetes\.io\/controller-uid":"[^"]+"`) + out = replaceUIDs.ReplaceAllString(out, "-replaced-") + + replaceUIDs = regexp.MustCompile(`"batch\.kubernetes\.io\/job-name":"[^"]+"`) + out = replaceUIDs.ReplaceAllString(out, "-replaced-") + require.Containsf(t, out, expectedErr, "Expected to see expected err in output, but did not") }) } diff --git a/test/e2e/ignore_failing_api_services_flag_test.go b/test/e2e/ignore_failing_api_services_flag_test.go index 5d0831416..27a176509 100644 --- a/test/e2e/ignore_failing_api_services_flag_test.go +++ b/test/e2e/ignore_failing_api_services_flag_test.go @@ -129,7 +129,7 @@ metadata: AllowError: true, IntoNs: true, StdinReader: strings.NewReader(yaml3)}) require.Errorf(t, err, "Expected error when deploying with failing api service") - require.Contains(t, err.Error(), "unable to retrieve the complete list of server APIs: samplekapptest.com/v1: the server is currently unable to handle the request", + require.Contains(t, err.Error(), "unable to retrieve the complete list of server APIs: samplekapptest.com/v1", "Expected api retrieval error") })