Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cherry-pick] Skip the deprecation message for the dry-run install CLI JSON output. #8552

Merged
Merged
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
10 changes: 10 additions & 0 deletions test/util/velero/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"os"
"os/exec"
"strings"
"time"

"github.com/pkg/errors"
Expand Down Expand Up @@ -413,6 +414,15 @@ func createVeleroResources(ctx context.Context, cli, namespace string, args []st
return errors.Wrapf(err, "failed to run velero install dry run command, stdout=%s, stderr=%s", stdout, stderr)
}

// From v1.15, the Restic uploader is deprecated,
// and a warning message is printed for the install CLI.
// Need to skip the deprecation of Restic message before the generated JSON.
// Redirect to the stdout to the first curly bracket to skip the warning.
if stdout[0] != '{' {
newIndex := strings.Index(stdout, "{")
stdout = stdout[newIndex:]
}

resources := &unstructured.UnstructuredList{}
if err := json.Unmarshal([]byte(stdout), resources); err != nil {
return errors.Wrapf(err, "failed to unmarshal the resources: %s", stdout)
Expand Down
Loading