Skip to content

Commit

Permalink
Fix CI for 1.16
Browse files Browse the repository at this point in the history
Run `go mod tidy` before building image so the go.mod has
the required deps.

See https://blog.golang.org/go116-module-changes#TOC_3.
  • Loading branch information
pwittrock committed Jun 6, 2021
1 parent f3e5c62 commit b260018
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/apidiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.15'
go-version: '1.16'
- name: Execute go-apidiff
uses: joelanford/go-apidiff@v0.1.0
with:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Please see https://git.k8s.io/community/CLA.md for more info.

## Prerequisites

- [go](https://golang.org/dl/) version v1.15+.
- [go](https://golang.org/dl/) version v1.16+.
- [docker](https://docs.docker.com/install/) version 17.03+.
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) version v1.11.3+.
- [kustomize](https://sigs.k8s.io/kustomize/docs/INSTALL.md) v3.1.0+
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/alpha/config-gen/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"path/filepath"
"strings"

// TODO: switch to embed
"github.com/markbates/pkger"
"github.com/spf13/cobra"

Expand Down
8 changes: 8 additions & 0 deletions test/e2e/utils/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ func (t *TestContext) Make(makeOptions ...string) error {
return err
}

// Tidy runs `go mod tidy` so that go 1.16 build doesn't fail.
// See https://blog.golang.org/go116-module-changes#TOC_3.
func (t *TestContext) Tidy() error {
cmd := exec.Command("go", "mod", "tidy")
_, err := t.Run(cmd)
return err
}

// Destroy is for cleaning up the docker images for testing
func (t *TestContext) Destroy() {
//nolint:gosec
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/v3/plugin_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func Run(kbc *utils.TestContext) {
var controllerPodName string
var err error

By("updating the go.mod")
err = kbc.Tidy()
ExpectWithOffset(1, err).NotTo(HaveOccurred())

By("building the controller image")
err = kbc.Make("docker-build", "IMG="+kbc.ImageName)
ExpectWithOffset(1, err).NotTo(HaveOccurred())
Expand Down

0 comments on commit b260018

Please sign in to comment.