Update the migration and upgrade test cases.
Run the E2E test on kind / get-go-version (push) Failing after 1m34s
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

Modify Dockerfile to fix GitHub CI action error.

Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
Xun Jiang
2026-02-11 14:56:55 +08:00
parent c9e26256fa
commit 9bfc78e769
4 changed files with 94 additions and 11 deletions
+33 -6
View File
@@ -99,6 +99,15 @@ var ImagesMatrix = map[string]map[string][]string{
"velero": {"velero/velero:v1.16.2"},
"velero-restore-helper": {"velero/velero:v1.16.2"},
},
"v1.17": {
"aws": {"velero/velero-plugin-for-aws:v1.13.2"},
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.13.2"},
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"},
"gcp": {"velero/velero-plugin-for-gcp:v1.13.2"},
"datamover": {"velero/velero-plugin-for-aws:v1.13.2"},
"velero": {"velero/velero:v1.17.2"},
"velero-restore-helper": {"velero/velero:v1.17.2"},
},
"main": {
"aws": {"velero/velero-plugin-for-aws:main"},
"azure": {"velero/velero-plugin-for-microsoft-azure:main"},
@@ -128,16 +137,13 @@ func SetImagesToDefaultValues(config VeleroConfig, version string) (VeleroConfig
ret.Plugins = ""
versionWithoutPatch := "main"
if version != "main" {
versionWithoutPatch = semver.MajorMinor(version)
}
versionWithoutPatch := getVersionWithoutPatch(version)
// Read migration case needs images from the PluginsMatrix map.
images, ok := ImagesMatrix[versionWithoutPatch]
if !ok {
return config, fmt.Errorf("fail to read the images for version %s from the ImagesMatrix",
versionWithoutPatch)
fmt.Printf("Cannot read the images for version %s from the ImagesMatrix. Use the original values.\n", versionWithoutPatch)
return config, nil
}
ret.VeleroImage = images[Velero][0]
@@ -164,6 +170,27 @@ func SetImagesToDefaultValues(config VeleroConfig, version string) (VeleroConfig
return ret, nil
}
func getVersionWithoutPatch(version string) string {
versionWithoutPatch := ""
mainRe := regexp.MustCompile(`^main$`)
releaseRe := regexp.MustCompile(`^release-(\d+)\.(\d+)(-dev)?$`)
switch {
case mainRe.MatchString(version):
versionWithoutPatch = "main"
case releaseRe.MatchString(version):
matches := releaseRe.FindStringSubmatch(version)
versionWithoutPatch = fmt.Sprintf("v%s.%s", matches[1], matches[2])
default:
versionWithoutPatch = semver.MajorMinor(version)
}
fmt.Println("The version is ", versionWithoutPatch)
return versionWithoutPatch
}
func getPluginsByVersion(version string, cloudProvider string, needDataMoverPlugin bool) ([]string, error) {
var cloudMap map[string][]string
arr := strings.Split(version, ".")
+54
View File
@@ -0,0 +1,54 @@
/*
Copyright the Velero contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package velero
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_getVersionWithoutPatch(t *testing.T) {
versionTests := []struct {
caseName string
version string
result string
}{
{
caseName: "main version",
version: "main",
result: "main",
},
{
caseName: "release version",
version: "release-1.18-dev",
result: "v1.18",
},
{
caseName: "tag version",
version: "v1.17.2",
result: "v1.17",
},
}
for _, test := range versionTests {
t.Run(test.caseName, func(t *testing.T) {
res := getVersionWithoutPatch(test.version)
require.Equal(t, test.result, res)
})
}
}