Skip to content

Commit

Permalink
Merge pull request #101 from mittwald/bump/go-and-deps
Browse files Browse the repository at this point in the history
bump go and dependencies
  • Loading branch information
elenz97 authored Nov 2, 2022
2 parents d5f87ca + 082e51f commit b5fdcc2
Show file tree
Hide file tree
Showing 17 changed files with 466 additions and 1,072 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/verify-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
name: Verify Code Generation
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand All @@ -39,10 +39,10 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand All @@ -56,10 +56,10 @@ jobs:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand All @@ -74,10 +74,10 @@ jobs:
needs: ['test', 'build']
if: github.ref == 'refs/heads/master'
steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Registry Login
Expand All @@ -98,10 +98,10 @@ jobs:
needs: ['test', 'build']
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Registry Login
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 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,13 @@ vet: ## Run go vet against code.
go vet ./...

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
test: fmt generate vet manifests setup-envtest
KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) --arch=amd64 use -p path 1.23.x)" go test -v ./... -coverprofile cover.out

SETUP_ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: setup-envtest
setup-envtest:
$(call go-get-tool,$(SETUP_ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)

##@ Build

Expand Down
2 changes: 1 addition & 1 deletion controllers/registries/crds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
)
Expand Down
2 changes: 1 addition & 1 deletion controllers/registries/instance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (r *InstanceReconciler) installOrUpgradeHelmChart(ctx context.Context, helm
upgradedRelease, upgradeErr := helmClient.InstallOrUpgradeChart(ctx, helmChart, nil)
if upgradeErr != nil {
if upgradedRelease != nil {
rollbackErr := helmClient.RollbackRelease(helmChart, 0)
rollbackErr := helmClient.RollbackRelease(helmChart)
if rollbackErr != nil {
return fmt.Errorf("rollback failed: (%s), upgrade failed: %w", rollbackErr, upgradeErr)
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/registries/instance_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package registries_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package registries_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
2 changes: 1 addition & 1 deletion controllers/registries/project_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package registries_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
2 changes: 1 addition & 1 deletion controllers/registries/registry_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package registries_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
2 changes: 1 addition & 1 deletion controllers/registries/replication_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package registries_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
36 changes: 11 additions & 25 deletions controllers/registries/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@ package registries_test

import (
"context"
"path/filepath"
"testing"
"time"

"github.com/mittwald/harbor-operator/apis/registries/v1alpha2"
corev1 "k8s.io/api/core/v1"
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"path/filepath"
"testing"

ctrl "sigs.k8s.io/controller-runtime"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
// +kubebuilder:scaffold:imports
Expand All @@ -60,19 +57,20 @@ var (
testReplicationName = "test-replication"
testNamespaceName = "test-namespace"
ctx = context.TODO()
cancel context.CancelFunc
)

func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

ctx, cancel = context.WithCancel(context.TODO())

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
Expand All @@ -98,22 +96,10 @@ var _ = BeforeSuite(func(done Done) {
// Create namespace for tests
err = k8sClient.Create(ctx, testNamespace)
Ω(err).ToNot(HaveOccurred())

close(done)
}, 60)
})

var _ = AfterSuite(func() {
// Clean up CRDs
Context("Deleting CRDs", func() {
err := envtest.UninstallCRDs(cfg, envtest.CRDInstallOptions{
Paths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
MaxTime: 50 * time.Millisecond,
PollInterval: 15 * time.Millisecond,
})
Ω(err).ToNot(HaveOccurred())
})

cancel()
By("tearing down the test environment")
err := testEnv.Stop()
Ω(err).ToNot(HaveOccurred())
Ω(testEnv.Stop()).ToNot(HaveOccurred())
})
2 changes: 1 addition & 1 deletion controllers/registries/user_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package registries_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ roleRef:
name: {{ include "harbor-operator.name" . }}
subjects:
- kind: ServiceAccount
name: {{ include "harbor-operator.serviceAccountName" . }}
name: controller-manager
namespace: {{ .Release.Namespace }}
Loading

0 comments on commit b5fdcc2

Please sign in to comment.