Skip to content

Commit

Permalink
Bump versions for Go, CAPI, ImgPkg, Ginkgo and associated dependencies (
Browse files Browse the repository at this point in the history
#823)

* Bump versions for Go, CAPI, ImgPkg and associated dependencies

* Bump Ginkgo to v2 and lint fixes

* Pinning to Go 1.19.10

Because of a issue in Go Http client and docker cli lib,
pinning Go version to 1.19.10
Issue - moby/moby#45935

* Pinnning management cluster k8s version to v1.25.11
  • Loading branch information
dharmjit committed Jul 24, 2023
1 parent 46636f0 commit fcb7f73
Show file tree
Hide file tree
Showing 62 changed files with 530 additions and 1,451 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,25 @@ on:

jobs:
build-agent:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19.10

- name: build agent
run: make host-agent-binaries

test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Check Docker Version
run: docker --version

- name: Checkout code
uses: actions/checkout@v2
with:
Expand All @@ -52,10 +55,10 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19.10

- name: Install ginkgo
run: go install github.com/onsi/ginkgo/ginkgo@v1.16.5
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.9.2

- name: Install prequisit packages
run: sudo apt update && sudo apt install -qq --yes socat ebtables ethtool conntrack
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
markdown-link-check:
name: Broken Links
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:

- name: Checkout
Expand All @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19.10

- name: Build Release Artifacts
run: IMG="projects.registry.vmware.com/cluster_api_provider_bringyourownhost/cluster-api-byoh-controller:${{ github.ref_name }}" make build-release-artifacts
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ on:

jobs:
e2e-pr-blocking:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19.10

- name: Install ginkgo
run: go install github.com/onsi/ginkgo/ginkgo@v1.16.5
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.9.2

- name: turn off swap
run: sudo swapoff -a
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lgtm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
execute:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: jpmcb/prow-github-actions@v1.1.3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ on:

jobs:
golangci:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Install Go 1.18
- name: Install Go 1.19.10
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19.10

- name: Checkout code
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prow-github-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
execute:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: jpmcb/prow-github-actions@v1.1.3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
triage:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Label pull requests based on the file paths
uses: actions/labeler@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.18 as builder
FROM golang:1.19.10 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TOOLS_DIR := $(REPO_ROOT)/hack/tools
BIN_DIR := bin
TOOLS_BIN_DIR := $(TOOLS_DIR)/$(BIN_DIR)
GINKGO := $(TOOLS_BIN_DIR)/ginkgo
GINKGO_PKG := github.com/onsi/ginkgo/ginkgo
GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo

BYOH_TEMPLATES := $(REPO_ROOT)/test/e2e/data/infrastructure-provider-byoh

Expand Down Expand Up @@ -130,16 +130,16 @@ cluster-templates-v1beta1: kustomize ## Generate cluster templates for v1beta1
test: $(GINKGO) generate fmt vet manifests test-coverage ## Run unit tests

test-coverage: prepare-byoh-docker-host-image ## Run test-coverage
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) --randomizeAllSpecs -r --cover --coverprofile=cover.out --outputdir=. --skipPackage=test .
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) --randomize-all -r --cover --coverprofile=cover.out --output-dir=. --skip-package=test .

agent-test: prepare-byoh-docker-host-image ## Run agent tests
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) --randomizeAllSpecs -r $(HOST_AGENT_DIR) -coverprofile cover.out
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) --randomize-all -r $(HOST_AGENT_DIR) --coverprofile cover.out

controller-test: ## Run controller tests
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) --randomizeAllSpecs controllers/infrastructure -coverprofile cover.out
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) --randomize-all controllers/infrastructure --coverprofile cover.out --vv

webhook-test: ## Run webhook tests
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) apis/infrastructure/v1beta1 -coverprofile cover.out
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; $(GINKGO) apis/infrastructure/v1beta1 --coverprofile cover.out

test-e2e: take-user-input docker-build prepare-byoh-docker-host-image $(GINKGO) cluster-templates-e2e ## Run the end-to-end tests
$(GINKGO) -v -trace -tags=e2e -focus="$(GINKGO_FOCUS)" $(_SKIP_ARGS) -nodes=$(GINKGO_NODES) --noColor=$(GINKGO_NOCOLOR) $(GINKGO_ARGS) test/e2e -- \
Expand Down Expand Up @@ -181,7 +181,7 @@ take-user-input:


$(GINKGO): # Build ginkgo from tools folder.
cd $(TOOLS_DIR) && go build -tags=tools -o $(BIN_DIR)/ginkgo $(GINKGO_PKG)
cd $(TOOLS_DIR); GOBIN=$(TOOLS_BIN_DIR) go install $(GINKGO_PKG)

##@ Deployment

Expand Down Expand Up @@ -226,8 +226,8 @@ host-agent-binary: $(RELEASE_DIR)
-e GOARCH=$(GOARCH) \
-v "$$(pwd):/workspace$(DOCKER_VOL_OPTS)" \
-w /workspace \
golang:1.18 \
go build -a -ldflags "$(GOLDFLAGS)" \
golang:1.19.10 \
go build -buildvcs=false -a -ldflags "$(GOLDFLAGS)" \
-o ./bin/$(notdir $(RELEASE_BINARY))-$(GOOS)-$(GOARCH) $(HOST_AGENT_DIR)


Expand Down
5 changes: 2 additions & 3 deletions agent/cloudinit/cloudinit_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (
"encoding/base64"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path"
"strconv"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit"
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/registration"
Expand All @@ -27,7 +26,7 @@ var (
var _ = Describe("CloudinitIntegration", func() {
BeforeEach(func() {
var err error
workDir, err = ioutil.TempDir("", "host-agent-ut")
workDir, err = os.MkdirTemp("", "host-agent-ut")
Expect(err).NotTo(HaveOccurred())

scriptExecutor = cloudinit.ScriptExecutor{
Expand Down
2 changes: 1 addition & 1 deletion agent/cloudinit/cloudinit_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package cloudinit_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
5 changes: 2 additions & 3 deletions agent/cloudinit/cloudinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import (
"encoding/base64"
"errors"
"fmt"
"io/ioutil"
"os"
"path"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit"
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit/cloudinitfakes"
Expand Down Expand Up @@ -48,7 +47,7 @@ var _ = Describe("Cloudinit", func() {
runCmd:
- echo 'some run command'`, workDir)

workDir, err = ioutil.TempDir("", "cloudinit_ut")
workDir, err = os.MkdirTemp("", "cloudinit_ut")
Expect(err).NotTo(HaveOccurred())
})

Expand Down
5 changes: 2 additions & 3 deletions agent/cloudinit/file_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ package cloudinit_test

import (
"io/fs"
"io/ioutil"
"os"
"path"
"strconv"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit"
)
Expand All @@ -23,7 +22,7 @@ var _ = Describe("FileWriter", func() {
)

BeforeEach(func() {
workDir, err = ioutil.TempDir("", "file_writer_ut")
workDir, err = os.MkdirTemp("", "file_writer_ut")
Expect(err).NotTo(HaveOccurred())
})

Expand Down
4 changes: 2 additions & 2 deletions agent/help_flag_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright 2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//nolint: nolintlint,testpackage
// nolint: nolintlint,testpackage
package main

import (
"os/exec"
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
Expand Down
17 changes: 8 additions & 9 deletions agent/host_agent_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright 2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//nolint: nolintlint,testpackage
// nolint: nolintlint,testpackage
package main

import (
"context"
"go/build"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -16,7 +15,7 @@ import (
dockertypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
dClient "github.com/docker/docker/client"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
infrastructurev1beta1 "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/apis/infrastructure/v1beta1"
Expand Down Expand Up @@ -71,8 +70,8 @@ var _ = BeforeSuite(func() {
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{
filepath.Join("..", "config", "crd", "bases"),
filepath.Join(build.Default.GOPATH, "pkg", "mod", "sigs.k8s.io", "cluster-api@v1.1.3", "config", "crd", "bases"),
filepath.Join(build.Default.GOPATH, "pkg", "mod", "sigs.k8s.io", "cluster-api@v1.1.3", "bootstrap", "kubeadm", "config", "crd", "bases"),
filepath.Join(build.Default.GOPATH, "pkg", "mod", "sigs.k8s.io", "cluster-api@v1.4.4", "config", "crd", "bases"),
filepath.Join(build.Default.GOPATH, "pkg", "mod", "sigs.k8s.io", "cluster-api@v1.4.4", "bootstrap", "kubeadm", "config", "crd", "bases"),
},

ErrorIfCRDPathMissing: true,
Expand Down Expand Up @@ -101,7 +100,7 @@ var _ = BeforeSuite(func() {

clientSet = clientset.NewForConfigOrDie(cfg)

dockerClient, err = dClient.NewClientWithOpts(dClient.FromEnv)
dockerClient, err = dClient.NewClientWithOpts(dClient.FromEnv, dClient.WithAPIVersionNegotiation())
Expect(err).NotTo(HaveOccurred())

pathToHostAgentBinary, err = gexec.Build("github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent")
Expand All @@ -120,7 +119,7 @@ var _ = AfterSuite(func() {
})

func writeKubeConfig() {
kubeConf, err := ioutil.TempFile("", tmpFilePrefix)
kubeConf, err := os.CreateTemp("", tmpFilePrefix)
Expect(err).NotTo(HaveOccurred())
setKubeConfig(kubeConf)

Expand Down Expand Up @@ -160,8 +159,8 @@ func setupTestInfra(ctx context.Context, hostname, kubeconfig string, namespace
return &byohostRunner
}

func cleanup(ctx context.Context, byoHostContainer *container.ContainerCreateCreatedBody, namespace *corev1.Namespace, agentLogFile string) {
err := dockerClient.ContainerStop(ctx, byoHostContainer.ID, nil)
func cleanup(ctx context.Context, byoHostContainer *container.CreateResponse, namespace *corev1.Namespace, agentLogFile string) {
err := dockerClient.ContainerStop(ctx, byoHostContainer.ID, container.StopOptions{})
Expect(err).NotTo(HaveOccurred())

err = dockerClient.ContainerRemove(ctx, byoHostContainer.ID, dockertypes.ContainerRemoveOptions{})
Expand Down
Loading

0 comments on commit fcb7f73

Please sign in to comment.