diff --git a/.github/workflows/e2e-test-kind.yaml b/.github/workflows/e2e-test-kind.yaml index ff3187051..65517804c 100644 --- a/.github/workflows/e2e-test-kind.yaml +++ b/.github/workflows/e2e-test-kind.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Go uses: actions/setup-go@v5 with: @@ -81,7 +81,7 @@ jobs: fail-fast: false steps: - name: Check out the code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/nightly-trivy-scan.yml b/.github/workflows/nightly-trivy-scan.yml index ac463863b..dc8363e39 100644 --- a/.github/workflows/nightly-trivy-scan.yml +++ b/.github/workflows/nightly-trivy-scan.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master diff --git a/.github/workflows/pr-changelog-check.yml b/.github/workflows/pr-changelog-check.yml index 96052fc2d..6cda5a63e 100644 --- a/.github/workflows/pr-changelog-check.yml +++ b/.github/workflows/pr-changelog-check.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Changelog check if: ${{ !(contains(github.event.pull_request.labels.*.name, 'kind/changelog-not-required') || contains(github.event.pull_request.labels.*.name, 'Design') || contains(github.event.pull_request.labels.*.name, 'Website') || contains(github.event.pull_request.labels.*.name, 'Documentation'))}} diff --git a/.github/workflows/pr-ci-check.yml b/.github/workflows/pr-ci-check.yml index 23f7a12f1..0a394560a 100644 --- a/.github/workflows/pr-ci-check.yml +++ b/.github/workflows/pr-ci-check.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false steps: - name: Check out the code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/pr-codespell.yml b/.github/workflows/pr-codespell.yml index 041403149..9f8e44825 100644 --- a/.github/workflows/pr-codespell.yml +++ b/.github/workflows/pr-codespell.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Codespell uses: codespell-project/actions-codespell@master diff --git a/.github/workflows/pr-containers.yml b/.github/workflows/pr-containers.yml index 345f24362..0f1823f8a 100644 --- a/.github/workflows/pr-containers.yml +++ b/.github/workflows/pr-containers.yml @@ -13,7 +13,7 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 name: Checkout - name: Set up QEMU diff --git a/.github/workflows/pr-goreleaser.yml b/.github/workflows/pr-goreleaser.yml index aed88ab14..2fdc5bc6e 100644 --- a/.github/workflows/pr-goreleaser.yml +++ b/.github/workflows/pr-goreleaser.yml @@ -14,7 +14,7 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 name: Checkout - name: Verify .goreleaser.yml and try a dryrun release. diff --git a/.github/workflows/pr-linter-check.yml b/.github/workflows/pr-linter-check.yml index f3b4397b4..997466ccf 100644 --- a/.github/workflows/pr-linter-check.yml +++ b/.github/workflows/pr-linter-check.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/push-builder.yml b/.github/workflows/push-builder.yml index d4461bbdd..0663ffd2f 100644 --- a/.github/workflows/push-builder.yml +++ b/.github/workflows/push-builder.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: # The default value is "1" which fetches only a single commit. If we merge PR without squash or rebase, # there are at least two commits: the first one is the merge commit and the second one is the real commit diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 212167e98..8dee8799a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 7a538a114..e7cd1fccb 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 - name: Automatic Rebase diff --git a/test/util/velero/install.go b/test/util/velero/install.go index ac993b434..2f4eb43de 100644 --- a/test/util/velero/install.go +++ b/test/util/velero/install.go @@ -187,10 +187,15 @@ func VeleroInstall(ctx context.Context, veleroCfg *test.VeleroConfig, isStandbyC WorkerOS: veleroCfg.WorkerOS, }, ); err != nil { - time.Sleep(1 * time.Minute) - RunDebug(context.Background(), veleroCfg.VeleroCLI, veleroCfg.VeleroNamespace, "", "") + RunDebug(ctx, veleroCfg.VeleroCLI, veleroCfg.VeleroNamespace, "", "") return errors.WithMessagef(err, "Failed to install Velero in the cluster") } + + if err := CheckBSL(ctx, veleroCfg.VeleroNamespace, common.DefaultBSLName); err != nil { + RunDebug(ctx, veleroCfg.VeleroCLI, veleroCfg.VeleroNamespace, "", "") + return fmt.Errorf("fail to wait BSL default till ready: %w", err) + } + fmt.Printf("Finish velero install %s\n", time.Now().Format("2006-01-02 15:04:05")) return nil } @@ -754,32 +759,35 @@ func IsVeleroReady(ctx context.Context, veleroCfg *test.VeleroConfig) (bool, err } } - // Check BSL with poll - err = wait.PollUntilContextTimeout(ctx, k8s.PollInterval, time.Minute, true, func(ctx context.Context) (bool, error) { - return checkBSL(ctx, veleroCfg) == nil, nil - }) - if err != nil { - return false, errors.Wrap(err, "failed to check the bsl") + if err := CheckBSL(ctx, namespace, common.DefaultBSLName); err != nil { + return false, err } + return true, nil } -func checkBSL(ctx context.Context, veleroCfg *test.VeleroConfig) error { - namespace := veleroCfg.VeleroNamespace - stdout, stderr, err := velerexec.RunCommand(exec.CommandContext(ctx, "kubectl", "get", "bsl", "default", - "-o", "json", "-n", namespace)) - if err != nil { - return errors.Wrapf(err, "failed to get bsl %s stdout=%s, stderr=%s", veleroCfg.BSLBucket, stdout, stderr) - } else { - bsl := &velerov1api.BackupStorageLocation{} - if err = json.Unmarshal([]byte(stdout), bsl); err != nil { - return errors.Wrapf(err, "failed to unmarshal the velero bsl") +func CheckBSL(ctx context.Context, ns string, bslName string) error { + // Check BSL with poll + err := wait.PollUntilContextTimeout(ctx, k8s.PollInterval, time.Minute, true, func(ctx context.Context) (bool, error) { + stdout, stderr, err := velerexec.RunCommand(exec.CommandContext(ctx, "kubectl", "get", "bsl", bslName, + "-o", "json", "-n", ns)) + if err != nil { + return false, errors.Wrapf(err, "failed to get bsl %s stdout=%s, stderr=%s", bslName, stdout, stderr) + } else { + bsl := &velerov1api.BackupStorageLocation{} + if err = json.Unmarshal([]byte(stdout), bsl); err != nil { + return false, errors.Wrapf(err, "failed to unmarshal the velero bsl") + } + if bsl.Status.Phase != velerov1api.BackupStorageLocationPhaseAvailable { + // BSL is not ready. Continue polling till timeout. + return false, nil + } } - if bsl.Status.Phase != velerov1api.BackupStorageLocationPhaseAvailable { - return fmt.Errorf("current bsl %s is not available", veleroCfg.BSLBucket) - } - } - return nil + + return true, nil + }) + + return err } func PrepareVelero(ctx context.Context, caseName string, veleroCfg test.VeleroConfig) error { diff --git a/test/util/velero/velero_utils.go b/test/util/velero/velero_utils.go index ab4ce5724..1d17e4ace 100644 --- a/test/util/velero/velero_utils.go +++ b/test/util/velero/velero_utils.go @@ -653,7 +653,12 @@ func VeleroCreateBackupLocation(ctx context.Context, if secretName != "" && secretKey != "" { args = append(args, "--credential", fmt.Sprintf("%s=%s", secretName, secretKey)) } - return VeleroCmdExec(ctx, veleroCLI, args) + + if err := VeleroCmdExec(ctx, veleroCLI, args); err != nil { + return err + } + + return CheckBSL(ctx, veleroNamespace, name) } func VeleroVersion(ctx context.Context, veleroCLI, veleroNamespace string) error {