Skip to content

Commit 239e0a3

Browse files
authored
Merge pull request #149 from kagent-dev/upgrade-e2e-pinned-images
Skip third-party images in the upgrade e2e image check
1 parent 1a65fa0 commit 239e0a3

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎internal/e2e/upgrade/upgrade_test.go‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ func runStep(ctx context.Context, t *testing.T, api *api, h *harness, actors []*
279279
api.reconnect(ctx, t)
280280
}
281281
for i, d := range deployments {
282+
// A Deployment that runs only third-party images, like the
283+
// fork's agentgateway, has nothing for the build to move.
284+
if before[i] == "" {
285+
continue
286+
}
282287
if got := deploymentImages(ctx, t, h.k8s, d); got == before[i] {
283288
t.Errorf("Deployment %s still runs %s after %s", d, got, step)
284289
}
@@ -718,16 +723,23 @@ func stepDeployments(step string) []types.NamespacedName {
718723
return nil
719724
}
720725

721-
// deploymentImages lists the images in a Deployment's pod template.
726+
// deploymentImages lists the images in a Deployment's pod template that ko
727+
// built into KO_DOCKER_REPO.
722728
func deploymentImages(ctx context.Context, t *testing.T, k8s kubernetes.Interface, d types.NamespacedName) string {
723729
t.Helper()
730+
env, err := e2e.CheckEnv("KO_DOCKER_REPO")
731+
if err != nil {
732+
t.Fatalf("CheckEnv failed: %v", err)
733+
}
724734
dep, err := k8s.AppsV1().Deployments(d.Namespace).Get(ctx, d.Name, metav1.GetOptions{})
725735
if err != nil {
726736
t.Fatalf("failed to get Deployment %s: %v", d, err)
727737
}
728738
var images []string
729739
for _, c := range dep.Spec.Template.Spec.Containers {
730-
images = append(images, c.Image)
740+
if strings.HasPrefix(c.Image, env["KO_DOCKER_REPO"]+"/") {
741+
images = append(images, c.Image)
742+
}
731743
}
732744
return strings.Join(images, ",")
733745
}

0 commit comments

Comments
 (0)