runtime(metis): normalize helper image refs
This commit is contained in:
parent
0918fc1f30
commit
ebaa367efd
@ -253,14 +253,23 @@ func clusterActiveRemotePodLoads(namespace, run string) map[string]int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) podImageForArch(arch string) string {
|
func (a *App) podImageForArch(arch string) string {
|
||||||
|
var image string
|
||||||
switch strings.TrimSpace(arch) {
|
switch strings.TrimSpace(arch) {
|
||||||
case "arm64":
|
case "arm64":
|
||||||
return strings.TrimSpace(a.settings.RunnerImageARM64)
|
image = strings.TrimSpace(a.settings.RunnerImageARM64)
|
||||||
case "amd64":
|
case "amd64":
|
||||||
return strings.TrimSpace(a.settings.RunnerImageAMD64)
|
image = strings.TrimSpace(a.settings.RunnerImageAMD64)
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
if image == "" || strings.Contains(image, "/") {
|
||||||
|
return image
|
||||||
|
}
|
||||||
|
registry := strings.Trim(strings.TrimSpace(a.settings.HarborRegistry), "/")
|
||||||
|
if registry == "" {
|
||||||
|
registry = "registry.bstein.dev"
|
||||||
|
}
|
||||||
|
return registry + "/bstein/metis:" + strings.TrimLeft(image, ":")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) runRemotePod(jobID, podName string, podSpec map[string]any) (string, error) {
|
func (a *App) runRemotePod(jobID, podName string, podSpec map[string]any) (string, error) {
|
||||||
|
|||||||
@ -443,7 +443,9 @@ func TestServiceClusterAndRemotePodBranches(t *testing.T) {
|
|||||||
|
|
||||||
app := newTestApp(t)
|
app := newTestApp(t)
|
||||||
app.settings.Namespace = "maintenance"
|
app.settings.Namespace = "maintenance"
|
||||||
app.settings.RunnerImageARM64 = "runner:arm64"
|
app.settings.HarborRegistry = "registry.example"
|
||||||
|
app.settings.RunnerImageARM64 = "0.1.0-97-arm64"
|
||||||
|
app.settings.RunnerImageAMD64 = "registry.example/custom/metis:0.1.0-97-amd64"
|
||||||
state, err := app.remotePodState(client, "metis-build-test")
|
state, err := app.remotePodState(client, "metis-build-test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("remotePodState: %v", err)
|
t.Fatalf("remotePodState: %v", err)
|
||||||
@ -455,10 +457,10 @@ func TestServiceClusterAndRemotePodBranches(t *testing.T) {
|
|||||||
if err != nil || logs != "pod logs" {
|
if err != nil || logs != "pod logs" {
|
||||||
t.Fatalf("remotePodLogs = %q err=%v", logs, err)
|
t.Fatalf("remotePodLogs = %q err=%v", logs, err)
|
||||||
}
|
}
|
||||||
if got := app.podImageForArch("amd64"); got != "" {
|
if got := app.podImageForArch("amd64"); got != "registry.example/custom/metis:0.1.0-97-amd64" {
|
||||||
t.Fatalf("podImageForArch fallback = %q", got)
|
t.Fatalf("podImageForArch amd64 = %q", got)
|
||||||
}
|
}
|
||||||
if got := app.podImageForArch("arm64"); got != "runner:arm64" {
|
if got := app.podImageForArch("arm64"); got != "registry.example/bstein/metis:0.1.0-97-arm64" {
|
||||||
t.Fatalf("podImageForArch arm64 = %q", got)
|
t.Fatalf("podImageForArch arm64 = %q", got)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user