mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-09-06 23:12:21 +02:00
Compare commits
3 Commits
0c5d71c2ee
...
9faccee9bf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9faccee9bf | ||
|
|
dd799d8ed1 | ||
|
|
eefb45ca5a |
@ -360,7 +360,9 @@ tasks:
|
||||
SIDECAR_IMAGE_NAME: ghcr.io/{{.GITHUB_REPOSITORY}}-sidecar{{if not (hasPrefix "refs/tags/v" .GITHUB_REF)}}-testing{{end}}
|
||||
# remove /merge suffix from the branch name. This is a workaround for the GitHub workflow on PRs,
|
||||
# where the branch name is suffixed with /merge. Prepend pr- to the branch name on PRs.
|
||||
IMAGE_VERSION: '{{regexReplaceAll "(\\d+)/merge" .GITHUB_REF_NAME "pr-${1}"}}'
|
||||
# Any remaining "/" (e.g. from namespaced branches like "dev/foo") is replaced with "-" since
|
||||
# "/" is not a valid character in a Docker tag.
|
||||
IMAGE_VERSION: '{{replace "/" "-" (regexReplaceAll "(\\d+)/merge" .GITHUB_REF_NAME "pr-${1}")}}'
|
||||
env:
|
||||
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
|
||||
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
|
||||
@ -450,7 +452,9 @@ tasks:
|
||||
SIDECAR_IMAGE_NAME: ghcr.io/{{.GITHUB_REPOSITORY}}-sidecar{{if not (hasPrefix "refs/tags/v" .GITHUB_REF)}}-testing{{end}}
|
||||
# remove /merge suffix from the branch name. This is a workaround for the GitHub workflow on PRs,
|
||||
# where the branch name is suffixed with /merge. Prepend pr- to the branch name on PRs.
|
||||
IMAGE_VERSION: '{{regexReplaceAll "(\\d+)/merge" .GITHUB_REF_NAME "pr-${1}"}}'
|
||||
# Any remaining "/" (e.g. from namespaced branches like "dev/foo") is replaced with "-" since
|
||||
# "/" is not a valid character in a Docker tag.
|
||||
IMAGE_VERSION: '{{replace "/" "-" (regexReplaceAll "(\\d+)/merge" .GITHUB_REF_NAME "pr-${1}")}}'
|
||||
env:
|
||||
# renovate: datasource=git-refs depName=kustomize lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main
|
||||
DAGGER_KUSTOMIZE_SHA: ff27cd50f6b4eed2e3753c520632cd6099e1ce52
|
||||
|
||||
@ -33,7 +33,8 @@ import (
|
||||
)
|
||||
|
||||
// updateRecoveryWindow updates the recovery window inside the object
|
||||
// store status subresource
|
||||
// store status subresource. It uses retry logic to handle concurrent
|
||||
// updates from backup completion and retention policy enforcement.
|
||||
func updateRecoveryWindow(
|
||||
ctx context.Context,
|
||||
c client.Client,
|
||||
@ -41,6 +42,14 @@ func updateRecoveryWindow(
|
||||
objectStore *barmancloudv1.ObjectStore,
|
||||
serverName string,
|
||||
) error {
|
||||
objectStoreKey := client.ObjectKeyFromObject(objectStore)
|
||||
|
||||
return retry.RetryOnConflict(retry.DefaultBackoff, func() error {
|
||||
var freshObjectStore barmancloudv1.ObjectStore
|
||||
if err := c.Get(ctx, objectStoreKey, &freshObjectStore); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set the recovery window inside the barman object store object
|
||||
convertTime := func(t *time.Time) *metav1.Time {
|
||||
if t == nil {
|
||||
@ -49,16 +58,17 @@ func updateRecoveryWindow(
|
||||
return ptr.To(metav1.NewTime(*t))
|
||||
}
|
||||
|
||||
recoveryWindow := objectStore.Status.ServerRecoveryWindow[serverName]
|
||||
recoveryWindow := freshObjectStore.Status.ServerRecoveryWindow[serverName]
|
||||
recoveryWindow.FirstRecoverabilityPoint = convertTime(backupList.GetFirstRecoverabilityPoint())
|
||||
recoveryWindow.LastSuccessfulBackupTime = convertTime(backupList.GetLastSuccessfulBackupTime())
|
||||
|
||||
if objectStore.Status.ServerRecoveryWindow == nil {
|
||||
objectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
|
||||
if freshObjectStore.Status.ServerRecoveryWindow == nil {
|
||||
freshObjectStore.Status.ServerRecoveryWindow = make(map[string]barmancloudv1.RecoveryWindow)
|
||||
}
|
||||
objectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
|
||||
freshObjectStore.Status.ServerRecoveryWindow[serverName] = recoveryWindow
|
||||
|
||||
return c.Status().Update(ctx, objectStore)
|
||||
return c.Status().Update(ctx, &freshObjectStore)
|
||||
})
|
||||
}
|
||||
|
||||
// setLastFailedBackupTime sets the last failed backup time in the
|
||||
|
||||
Loading…
Reference in New Issue
Block a user