Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 0
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion apis/repositories/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
)
Expand Down
3 changes: 2 additions & 1 deletion apis/repositories/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
)
Expand Down
6 changes: 4 additions & 2 deletions apis/stash/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions apis/stash/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand All @@ -67,7 +68,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&Task{},
)

scheme.AddKnownTypes(SchemeGroupVersion,
scheme.AddKnownTypes(
SchemeGroupVersion,
&metav1.Status{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
Expand Down
6 changes: 4 additions & 2 deletions cmd/stash-crd-installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),

Expand All @@ -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(),
Expand Down
15 changes: 10 additions & 5 deletions pkg/conditions/backup_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
36 changes: 24 additions & 12 deletions pkg/conditions/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand All @@ -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,
),
Expand All @@ -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,
),
Expand All @@ -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,
),
Expand All @@ -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,
),
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand All @@ -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,
),
Expand All @@ -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,
),
Expand All @@ -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,
),
Expand All @@ -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,
),
Expand Down
9 changes: 6 additions & 3 deletions pkg/conditions/restore_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions pkg/hooks/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion pkg/restic/restic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
Loading