mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-20 06:52:40 +00:00
Merge pull request #9473 from vmware-tanzu/fix_e2e_version_check_issue
Run the E2E test on kind / get-go-version (push) Failing after 1m29s
Run the E2E test on kind / build (push) Has been skipped
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / get-go-version (push) Successful in 14s
Main CI / Build (push) Failing after 44s
Close stale issues and PRs / stale (push) Successful in 16s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m44s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 1m14s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 1m15s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 1m20s
Run the E2E test on kind / get-go-version (push) Failing after 1m29s
Run the E2E test on kind / build (push) Has been skipped
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / get-go-version (push) Successful in 14s
Main CI / Build (push) Failing after 44s
Close stale issues and PRs / stale (push) Successful in 16s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m44s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 1m14s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 1m15s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 1m20s
Fix the version regexp to make sure releaseRe and tegRe can support string like v1.16
This commit is contained in:
@@ -316,12 +316,14 @@ func cleanVSpherePluginConfig(c clientset.Interface, ns, secretName, configMapNa
|
||||
// version can be in the format of 'main', 'release-x.y(-dev)', or 'vX.Y(.Z)'
|
||||
func ValidateVeleroVersion(version string) error {
|
||||
mainRe := regexp.MustCompile(`^main$`)
|
||||
releaseRe := regexp.MustCompile(`^release-(\d)\.(\d)(-dev)?$`)
|
||||
releaseRe := regexp.MustCompile(`^release-(\d+)\.(\d+)(-dev)?$`)
|
||||
tagRe := regexp.MustCompile(`^v(\d+)\.(\d+)(\.\d+)?$`)
|
||||
|
||||
if mainRe.MatchString(version) || releaseRe.MatchString(version) || tagRe.MatchString(version) {
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Println("Invalid Velero version:", version)
|
||||
return fmt.Errorf("invalid Velero version: %s, Velero version must be 'main', 'release-x.y(-dev)', or 'vX.Y.Z'", version)
|
||||
}
|
||||
|
||||
@@ -331,13 +333,14 @@ func ValidateVeleroVersion(version string) error {
|
||||
// return true if version is no older than targetVersion
|
||||
func VersionNoOlderThan(version string, targetVersion string) (bool, error) {
|
||||
mainRe := regexp.MustCompile(`^main$`)
|
||||
releaseRe := regexp.MustCompile(`^release-(\d)\.(\d)(-dev)?$`)
|
||||
tagRe := regexp.MustCompile(`^v(\d)\.(\d)(\.\d+)?$`)
|
||||
releaseRe := regexp.MustCompile(`^release-(\d+)\.(\d+)(-dev)?$`)
|
||||
tagRe := regexp.MustCompile(`^v(\d+)\.(\d+)(\.\d+)?$`)
|
||||
|
||||
if err := ValidateVeleroVersion(version); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !tagRe.MatchString(targetVersion) && !mainRe.MatchString(targetVersion) {
|
||||
fmt.Printf("targetVersion %s is invalid. it must be in the format of 'main', or 'vX.Y.(Z)'.\n", targetVersion)
|
||||
return false, fmt.Errorf("targetVersion is invalid. it must be in the format of 'main', or 'vX.Y.(Z)'.")
|
||||
}
|
||||
|
||||
@@ -383,7 +386,8 @@ func VersionNoOlderThan(version string, targetVersion string) (bool, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return false, fmt.Errorf("unknown error in VersionNoOlderThan")
|
||||
fmt.Printf("Unknown version %s in VersionNoOlderThan\n", version)
|
||||
return false, fmt.Errorf("unknown version in VersionNoOlderThan: %s", version)
|
||||
}
|
||||
|
||||
func installVeleroServer(
|
||||
|
||||
Reference in New Issue
Block a user