Skip to content

Commit

Permalink
Upgrade dependencies and Go 1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
yunussandikci authored Aug 17, 2024
1 parent b513f68 commit 2fb49c4
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ permissions:
contents: read

env:
GO_VERSION: "1.22"
GO_VERSION: "1.23"

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -21,4 +21,4 @@ jobs:
- name: Download Dependencies
run: go mod download
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
release:
name: Release Image
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -32,7 +32,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ permissions:
contents: write

env:
GO_VERSION: "1.22"
GO_VERSION: "1.23"
GOPRIVATE: "github:com/NCCloud/*"

jobs:
tests:
name: Test
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
Expand All @@ -31,7 +31,7 @@ jobs:
run: |
./devops.sh prepare_envtest
- name: Coverage Report
uses: gwatts/go-coverage-action@v1
uses: gwatts/go-coverage-action@v2
id: coverage
with:
coverage-threshold: 80
Expand Down
6 changes: 1 addition & 5 deletions deploy/crds/cloud.namecheap.com_scheduledresources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: scheduledresources.cloud.namecheap.com
spec:
group: cloud.namecheap.com
Expand Down Expand Up @@ -69,10 +69,6 @@ spec:
type: string
nextRun:
type: string
required:
- condition
- lastRun
- nextRun
type: object
type: object
served: true
Expand Down
8 changes: 4 additions & 4 deletions devops.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

export CONTROLLER_GEN_VERSION="v0.15.0"
export GOLANGCI_LINT_VERSION="v1.59.1"
export MOCKERY_GEN_VERSION="v2.44.1"
export GOFUMPT_VERSION="v0.6.0"
export CONTROLLER_GEN_VERSION="v0.16.1"
export GOLANGCI_LINT_VERSION="v1.60.1"
export MOCKERY_GEN_VERSION="v2.44.2"
export GOFUMPT_VERSION="v0.7.0"
export TESTENV_VERSION="1.25.x!"

prerequisites() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/NCCloud/mayfly

go 1.22.0
go 1.23.0

require (
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/apis/v1alpha2/scheduled_resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ type ScheduledResourceSpec struct {
}

type ScheduledResourceStatus struct {
NextRun string `json:"nextRun"`
LastRun string `json:"lastRun"`
Condition Condition `json:"condition"`
NextRun string `json:"nextRun,omitempty"`
LastRun string `json:"lastRun,omitempty"`
Condition Condition `json:"condition,omitempty"`
}

func (in *ScheduledResource) IsBeingDeleted() bool {
Expand Down
5 changes: 4 additions & 1 deletion pkg/controllers/expiration/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@ func (r *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}

func (r *Controller) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).For(common.NewResourceInstance(r.apiVersionKind)).Complete(r)
return ctrl.NewControllerManagedBy(mgr).
Named(fmt.Sprintf("Expiration/%s", r.apiVersionKind)).
For(common.NewResourceInstance(r.apiVersionKind)).
Complete(r)
}
2 changes: 1 addition & 1 deletion pkg/controllers/expiration/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func TestController_SetupWithManager(t *testing.T) {
mockManager = new(manager2.MockManager)
mockCache = new(cache2.MockCache)
mockScheduler = new(common2.MockScheduler)
apiVersionKind = "v1;Secret"
apiVersionKind = "v1;ConfigMap"

controller = NewController(common.NewConfig(), mockClient, apiVersionKind, mockScheduler)
)
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/scheduledresource/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (r *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu

func (r *Controller) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
Named("ScheduledResource").
For(&v1alpha2.ScheduledResource{}).
Complete(r)
}
5 changes: 4 additions & 1 deletion pkg/controllers/scheduledresource/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func TestController_SetupWithManager(t *testing.T) {
mockManager = new(manager2.MockManager)
mockCache = new(cache2.MockCache)
mockScheduler = new(common2.MockScheduler)
controller = NewController(common.NewConfig(), mockClient, mockScheduler)
controller = NewController(&common.Config{}, mockClient, mockScheduler)
scheme = runtime.NewScheme()
)

Expand All @@ -475,6 +475,9 @@ func TestController_SetupWithManager(t *testing.T) {

// when
setupErr := controller.SetupWithManager(mockManager)
if setupErr != nil && strings.Contains(setupErr.Error(), "already exists") {
setupErr = nil
}

// then
assert.Nil(t, addToSchemeErr)
Expand Down

0 comments on commit 2fb49c4

Please sign in to comment.