From e3be5c3627f7ccbce0278941eec1fcaf22de0fc7 Mon Sep 17 00:00:00 2001 From: 1gtm <1gtm@appscode.com> Date: Sat, 10 Oct 2026 20:04:21 +0000 Subject: [PATCH] Use Go 1.27, k8s 1.37 & debian:13 /cherry-pick Signed-off-by: 1gtm <1gtm@appscode.com> --- .github/dependabot.yml | 7 +++++ .github/workflows/ci.yml | 4 +-- .github/workflows/release.yml | 4 +-- Makefile | 8 +++--- apis/repositories/register.go | 3 ++- apis/repositories/v1alpha1/register.go | 3 ++- apis/stash/v1alpha1/register.go | 6 +++-- apis/stash/v1beta1/register.go | 6 +++-- cmd/stash-crd-installer/main.go | 6 +++-- pkg/conditions/backup_invoker.go | 15 +++++++---- pkg/conditions/repository.go | 36 +++++++++++++++++--------- pkg/conditions/restore_invoker.go | 9 ++++--- pkg/hooks/hook.go | 6 +++-- pkg/restic/restic_test.go | 3 ++- 14 files changed, 77 insertions(+), 39 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..3dd792052 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7786ab9fc..ca660837c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,10 +18,10 @@ jobs: name: Build runs-on: firecracker steps: - - name: Set up Go 1.25 + - name: Set up Go 1.27 uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: - go-version: '1.25' + go-version: '1.27' id: go - name: Check out code into the Go module directory diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c73e7ae12..9ca92f307 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,10 +22,10 @@ jobs: with: fetch-depth: 0 - - name: Set up Go 1.25 + - name: Set up Go 1.27 uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: - go-version: '1.25' + go-version: '1.27' id: go - name: Print version info diff --git a/Makefile b/Makefile index c1baa93f2..05b6948ae 100644 --- a/Makefile +++ b/Makefile @@ -63,10 +63,10 @@ BIN_PLATFORMS := $(DOCKER_PLATFORMS) windows/amd64 darwin/amd64 OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS)) ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH)) -BASEIMAGE_PROD ?= gcr.io/distroless/static-debian12 -BASEIMAGE_DBG ?= debian:12 +BASEIMAGE_PROD ?= gcr.io/distroless/static-debian13 +BASEIMAGE_DBG ?= debian:13 -GO_VERSION ?= 1.25 +GO_VERSION ?= 1.27 BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION) TEST_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)-stash @@ -379,7 +379,7 @@ push: push-crd-installer .PHONY: push-crd-installer push-crd-installer: $(BUILD_DIRS) install-ko ## Build and push CRD installer image @echo "Pushing CRD installer image....." - KO_DOCKER_REPO=$(REGISTRY) KO_DEFAULTBASEIMAGE=gcr.io/distroless/static-debian12 $(KO) build ./cmd/stash-crd-installer --tags $(VERSION),latest --base-import-paths --platform=all + KO_DOCKER_REPO=$(REGISTRY) KO_DEFAULTBASEIMAGE=gcr.io/distroless/static-debian13 $(KO) build ./cmd/stash-crd-installer --tags $(VERSION),latest --base-import-paths --platform=all .PHONY: release release: ## Release final production docker image and push into the DockerHub. diff --git a/apis/repositories/register.go b/apis/repositories/register.go index 997dd69a4..42f227d00 100644 --- a/apis/repositories/register.go +++ b/apis/repositories/register.go @@ -43,7 +43,8 @@ var ( // Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, + scheme.AddKnownTypes( + SchemeGroupVersion, &Snapshot{}, &SnapshotList{}, ) diff --git a/apis/repositories/v1alpha1/register.go b/apis/repositories/v1alpha1/register.go index 2c41d9a91..046d60848 100644 --- a/apis/repositories/v1alpha1/register.go +++ b/apis/repositories/v1alpha1/register.go @@ -44,7 +44,8 @@ func init() { // Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, + scheme.AddKnownTypes( + SchemeGroupVersion, &Snapshot{}, &SnapshotList{}, ) diff --git a/apis/stash/v1alpha1/register.go b/apis/stash/v1alpha1/register.go index 5c9ea7e89..112fe7eb1 100644 --- a/apis/stash/v1alpha1/register.go +++ b/apis/stash/v1alpha1/register.go @@ -48,12 +48,14 @@ func Resource(resource string) schema.GroupResource { // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, + scheme.AddKnownTypes( + SchemeGroupVersion, &Repository{}, &RepositoryList{}, ) - scheme.AddKnownTypes(SchemeGroupVersion, + scheme.AddKnownTypes( + SchemeGroupVersion, &metav1.Status{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/apis/stash/v1beta1/register.go b/apis/stash/v1beta1/register.go index b2f7fcdbf..4a0db4e2a 100644 --- a/apis/stash/v1beta1/register.go +++ b/apis/stash/v1beta1/register.go @@ -48,7 +48,8 @@ func Resource(resource string) schema.GroupResource { // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, + scheme.AddKnownTypes( + SchemeGroupVersion, &BackupBatchList{}, &BackupBatch{}, &BackupBlueprintList{}, @@ -67,7 +68,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &Task{}, ) - scheme.AddKnownTypes(SchemeGroupVersion, + scheme.AddKnownTypes( + SchemeGroupVersion, &metav1.Status{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/cmd/stash-crd-installer/main.go b/cmd/stash-crd-installer/main.go index deefb75e5..11e5a19b9 100644 --- a/cmd/stash-crd-installer/main.go +++ b/cmd/stash-crd-installer/main.go @@ -75,7 +75,8 @@ func getStashCRDs() []*apiextensions.CustomResourceDefinition { // community features CRDs var stashCRDs []*apiextensions.CustomResourceDefinition - stashCRDs = append(stashCRDs, + stashCRDs = append( + stashCRDs, // v1alpha1 resources stashv1alpha1.Repository{}.CustomResourceDefinition(), @@ -89,7 +90,8 @@ func getStashCRDs() []*apiextensions.CustomResourceDefinition { // enterprise features CRDs if enableEnterpriseFeatures { - stashCRDs = append(stashCRDs, + stashCRDs = append( + stashCRDs, // v1beta1 resources stashv1beta1.BackupBatch{}.CustomResourceDefinition(), stashv1beta1.BackupBlueprint{}.CustomResourceDefinition(), diff --git a/pkg/conditions/backup_invoker.go b/pkg/conditions/backup_invoker.go index 603eceb6b..8ed80b490 100644 --- a/pkg/conditions/backup_invoker.go +++ b/pkg/conditions/backup_invoker.go @@ -31,7 +31,8 @@ func SetBackupTargetFoundConditionToUnknown(invoker invoker.BackupInvoker, tref Type: v1beta1.BackupTargetFound, Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckTargetAvailability, - Message: fmt.Sprintf("Failed to check whether backup target %s %s/%s exist or not. Reason: %v", + Message: fmt.Sprintf( + "Failed to check whether backup target %s %s/%s exist or not. Reason: %v", tref.Kind, tref.Namespace, tref.Name, @@ -47,7 +48,8 @@ func SetBackupTargetFoundConditionToFalse(invoker invoker.BackupInvoker, tref v1 Type: v1beta1.BackupTargetFound, Status: metav1.ConditionFalse, Reason: v1beta1.TargetNotAvailable, - Message: fmt.Sprintf("Backup target %s %s/%s does not exist.", + Message: fmt.Sprintf( + "Backup target %s %s/%s does not exist.", tref.Kind, tref.Namespace, tref.Name, @@ -61,7 +63,8 @@ func SetBackupTargetFoundConditionToTrue(invoker invoker.BackupInvoker, tref v1b Type: v1beta1.BackupTargetFound, Status: metav1.ConditionTrue, Reason: v1beta1.TargetAvailable, - Message: fmt.Sprintf("Backup target %s %s/%s found.", + Message: fmt.Sprintf( + "Backup target %s %s/%s found.", tref.Kind, tref.Namespace, tref.Name, @@ -95,7 +98,8 @@ func SetSidecarInjectedConditionToTrue(invoker invoker.BackupInvoker, tref v1bet Type: v1beta1.StashSidecarInjected, Status: metav1.ConditionTrue, Reason: v1beta1.SidecarInjectionSucceeded, - Message: fmt.Sprintf("Successfully injected stash sidecar into %s %s/%s", + Message: fmt.Sprintf( + "Successfully injected stash sidecar into %s %s/%s", tref.Kind, tref.Namespace, tref.Name, @@ -109,7 +113,8 @@ func SetSidecarInjectedConditionToFalse(invoker invoker.BackupInvoker, tref v1be Type: v1beta1.StashSidecarInjected, Status: metav1.ConditionFalse, Reason: v1beta1.SidecarInjectionFailed, - Message: fmt.Sprintf("Failed to inject stash sidecar into %s %s/%s. Reason: %v", + Message: fmt.Sprintf( + "Failed to inject stash sidecar into %s %s/%s. Reason: %v", tref.Kind, tref.Namespace, tref.Name, diff --git a/pkg/conditions/repository.go b/pkg/conditions/repository.go index 7e1747254..292ef81de 100644 --- a/pkg/conditions/repository.go +++ b/pkg/conditions/repository.go @@ -33,7 +33,8 @@ func SetRepositoryFoundConditionToUnknown(i any, err error) error { Type: v1beta1.RepositoryFound, Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckRepositoryAvailability, - Message: fmt.Sprintf("Failed to check whether the Repository %s/%s exist or not. Reason: %v", + Message: fmt.Sprintf( + "Failed to check whether the Repository %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, in.GetRepoRef().Name, err.Error(), @@ -45,7 +46,8 @@ func SetRepositoryFoundConditionToUnknown(i any, err error) error { Type: v1beta1.RepositoryFound, Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckRepositoryAvailability, - Message: fmt.Sprintf("Failed to check whether the Repository %s/%s exist or not. Reason: %v", + Message: fmt.Sprintf( + "Failed to check whether the Repository %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, in.GetRepoRef().Name, err.Error(), @@ -64,7 +66,8 @@ func SetRepositoryFoundConditionToFalse(i any) error { Type: v1beta1.RepositoryFound, Status: metav1.ConditionFalse, Reason: v1beta1.RepositoryNotAvailable, - Message: fmt.Sprintf("Repository %s/%s does not exist.", + Message: fmt.Sprintf( + "Repository %s/%s does not exist.", in.GetRepoRef().Namespace, in.GetRepoRef().Name, ), @@ -75,7 +78,8 @@ func SetRepositoryFoundConditionToFalse(i any) error { Type: v1beta1.RepositoryFound, Status: metav1.ConditionFalse, Reason: v1beta1.RepositoryNotAvailable, - Message: fmt.Sprintf("Repository %s/%s does not exist.", + Message: fmt.Sprintf( + "Repository %s/%s does not exist.", in.GetRepoRef().Namespace, in.GetRepoRef().Name, ), @@ -93,7 +97,8 @@ func SetRepositoryFoundConditionToTrue(i any) error { Type: v1beta1.RepositoryFound, Status: metav1.ConditionTrue, Reason: v1beta1.RepositoryAvailable, - Message: fmt.Sprintf("Repository %s/%s exist.", + Message: fmt.Sprintf( + "Repository %s/%s exist.", in.GetRepoRef().Namespace, in.GetRepoRef().Name, ), @@ -104,7 +109,8 @@ func SetRepositoryFoundConditionToTrue(i any) error { Type: v1beta1.RepositoryFound, Status: metav1.ConditionTrue, Reason: v1beta1.RepositoryAvailable, - Message: fmt.Sprintf("Repository %s/%s exist.", + Message: fmt.Sprintf( + "Repository %s/%s exist.", in.GetRepoRef().Namespace, in.GetRepoRef().Name, ), @@ -168,7 +174,8 @@ func SetBackendSecretFoundConditionToUnknown(i any, secretName string, err error Type: v1beta1.BackendSecretFound, Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckBackendSecretAvailability, - Message: fmt.Sprintf("Failed to check whether the backend Secret %s/%s exist or not. Reason: %v", + Message: fmt.Sprintf( + "Failed to check whether the backend Secret %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, secretName, err.Error(), @@ -180,7 +187,8 @@ func SetBackendSecretFoundConditionToUnknown(i any, secretName string, err error Type: v1beta1.BackendSecretFound, Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckBackendSecretAvailability, - Message: fmt.Sprintf("Failed to check whether the backend Secret %s/%s exist or not. Reason: %v", + Message: fmt.Sprintf( + "Failed to check whether the backend Secret %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, secretName, err.Error(), @@ -199,7 +207,8 @@ func SetBackendSecretFoundConditionToFalse(i any, secretName string) error { Type: v1beta1.BackendSecretFound, Status: metav1.ConditionFalse, Reason: v1beta1.BackendSecretNotAvailable, - Message: fmt.Sprintf("Backend Secret %s/%s does not exist.", + Message: fmt.Sprintf( + "Backend Secret %s/%s does not exist.", in.GetRepoRef().Namespace, secretName, ), @@ -210,7 +219,8 @@ func SetBackendSecretFoundConditionToFalse(i any, secretName string) error { Type: v1beta1.BackendSecretFound, Status: metav1.ConditionFalse, Reason: v1beta1.BackendSecretNotAvailable, - Message: fmt.Sprintf("Backend Secret %s/%s does not exist.", + Message: fmt.Sprintf( + "Backend Secret %s/%s does not exist.", in.GetRepoRef().Namespace, secretName, ), @@ -228,7 +238,8 @@ func SetBackendSecretFoundConditionToTrue(i any, secretName string) error { Type: v1beta1.BackendSecretFound, Status: metav1.ConditionTrue, Reason: v1beta1.BackendSecretAvailable, - Message: fmt.Sprintf("Backend Secret %s/%s exist.", + Message: fmt.Sprintf( + "Backend Secret %s/%s exist.", in.GetRepoRef().Namespace, secretName, ), @@ -239,7 +250,8 @@ func SetBackendSecretFoundConditionToTrue(i any, secretName string) error { Type: v1beta1.BackendSecretFound, Status: metav1.ConditionTrue, Reason: v1beta1.BackendSecretAvailable, - Message: fmt.Sprintf("Backend Secret %s/%s exist.", + Message: fmt.Sprintf( + "Backend Secret %s/%s exist.", in.GetRepoRef().Namespace, secretName, ), diff --git a/pkg/conditions/restore_invoker.go b/pkg/conditions/restore_invoker.go index 5ea9284f8..78f9fb076 100644 --- a/pkg/conditions/restore_invoker.go +++ b/pkg/conditions/restore_invoker.go @@ -32,7 +32,8 @@ func SetRestoreTargetFoundConditionToTrue(inv invoker.RestoreInvoker, index int) Type: v1beta1.RestoreTargetFound, Status: metav1.ConditionTrue, Reason: v1beta1.TargetAvailable, - Message: fmt.Sprintf("Restore target %s %s/%s found.", + Message: fmt.Sprintf( + "Restore target %s %s/%s found.", target.Ref.Kind, target.Ref.Namespace, target.Ref.Name, @@ -47,7 +48,8 @@ func SetRestoreTargetFoundConditionToFalse(inv invoker.RestoreInvoker, index int Type: v1beta1.RestoreTargetFound, Status: metav1.ConditionFalse, Reason: v1beta1.TargetNotAvailable, - Message: fmt.Sprintf("Restore target %s %s/%s does not exist.", + Message: fmt.Sprintf( + "Restore target %s %s/%s does not exist.", target.Ref.Kind, target.Ref.Namespace, target.Ref.Name, @@ -62,7 +64,8 @@ func SetRestoreTargetFoundConditionToUnknown(inv invoker.RestoreInvoker, index i Type: v1beta1.RestoreTargetFound, Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckTargetAvailability, - Message: fmt.Sprintf("Failed to check whether restore target %s %s/%s exist or not. Reason: %v", + Message: fmt.Sprintf( + "Failed to check whether restore target %s %s/%s exist or not. Reason: %v", target.Ref.Kind, target.Ref.Namespace, target.Ref.Name, diff --git a/pkg/hooks/hook.go b/pkg/hooks/hook.go index 43b9a0b81..66357f9f9 100644 --- a/pkg/hooks/hook.go +++ b/pkg/hooks/hook.go @@ -145,7 +145,8 @@ func (e *BackupHookExecutor) Execute() error { session := invoker.NewBackupSessionHandler(e.StashClient, e.BackupSession) if !IsAllowedByExecutionPolicy(e.ExecutionPolicy, hookExecutor.Summary) { - reason := fmt.Sprintf("Skipping executing %s. Reason: executionPolicy is %q but phase is %q.", + reason := fmt.Sprintf( + "Skipping executing %s. Reason: executionPolicy is %q but phase is %q.", e.HookType, getExecutionPolicyWithDefault(e.ExecutionPolicy), getTargetPhase(hookExecutor.Summary), @@ -259,7 +260,8 @@ func (e *RestoreHookExecutor) Execute() error { } if !IsAllowedByExecutionPolicy(e.ExecutionPolicy, hookExecutor.Summary) { - reason := fmt.Sprintf("Skipping executing %s. Reason: executionPolicy is %q but phase is %q.", + reason := fmt.Sprintf( + "Skipping executing %s. Reason: executionPolicy is %q but phase is %q.", e.HookType, getExecutionPolicyWithDefault(e.ExecutionPolicy), getTargetPhase(hookExecutor.Summary), diff --git a/pkg/restic/restic_test.go b/pkg/restic/restic_test.go index 5f334ab93..80f596698 100644 --- a/pkg/restic/restic_test.go +++ b/pkg/restic/restic_test.go @@ -543,7 +543,8 @@ func TestRunParallelDump(t *testing.T) { // verify that all host has been restored successfully for i := range dumpOutput.RestoreTargetStatus.Stats { - t.Logf("Host: %s, Phase: %s", + t.Logf( + "Host: %s, Phase: %s", dumpOutput.RestoreTargetStatus.Stats[i].Hostname, dumpOutput.RestoreTargetStatus.Stats[i].Phase, )