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 db0918a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
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 db0918a

Please sign in to comment.