fix: Duplicate backups

This commit is contained in:
Dion 2024-06-20 13:40:37 -04:00
parent 20246998da
commit ad2c908a3e
No known key found for this signature in database
GPG Key ID: A5E0435C957FCD52
1 changed files with 9 additions and 0 deletions

View File

@ -224,6 +224,15 @@ func (bar *BackupAndRestore) Backup(setBackupDoneBeforePodDeletion bool) error {
_, _, err := bar.Exec(podName, jenkins.Spec.Backup.ContainerName, command)
if err == nil {
key := types.NamespacedName{
Namespace: jenkins.Namespace,
Name: jenkins.Name,
}
err = bar.Client.Get(context.TODO(), key, jenkins)
if err != nil {
return err
}
bar.logger.V(log.VDebug).Info(fmt.Sprintf("Backup completed '%d', updating status", backupNumber))
if jenkins.Status.RestoredBackup == 0 {
jenkins.Status.RestoredBackup = backupNumber