@@ -19,14 +19,16 @@ package integration
1919import (
2020 "context"
2121 "fmt"
22- "github.com/fluxcd/test-infra/tftestenv "
22+ "log "
2323 "path"
2424 "strings"
25+
26+ "github.com/fluxcd/test-infra/tftestenv"
2527)
2628
2729// updateAndBuildFluxInstallManifests assumes that ./build/flux/ already exists
2830// with downloaded install.yaml and copied kustomization.yaml. It updates the
29- // kustomization.yaml with new test images and builds a new install manifest
31+ // kustomization.yaml with new test images and patchkes. Then it builds a new install manifest
3032// at ./build/flux.yaml.
3133func updateAndBuildFluxInstallManifests (ctx context.Context , images map [string ]string , patches []string ) error {
3234 // Construct kustomize set image arguments.
@@ -39,6 +41,16 @@ func updateAndBuildFluxInstallManifests(ctx context.Context, images map[string]s
3941 setImgArgs = append (setImgArgs , arg )
4042 }
4143
44+ log .Println ("setting images:" , setImgArgs )
45+ // Update all the images in kustomization.
46+ err := tftestenv .RunCommand (ctx , "./build/flux" ,
47+ fmt .Sprintf ("kustomize edit set image %s" , strings .Join (setImgArgs , " " )),
48+ tftestenv.RunCommandOptions {},
49+ )
50+ if err != nil {
51+ return err
52+ }
53+
4254 for _ , patch := range patches {
4355 // add patches to kustomization.
4456 err := tftestenv .RunCommand (ctx , "./build/flux" ,
@@ -50,15 +62,6 @@ func updateAndBuildFluxInstallManifests(ctx context.Context, images map[string]s
5062 }
5163 }
5264
53- // Update all the images in kustomization.
54- err := tftestenv .RunCommand (ctx , "./build/flux" ,
55- fmt .Sprintf ("kustomize edit set image %s" , strings .Join (setImgArgs , " " )),
56- tftestenv.RunCommandOptions {},
57- )
58- if err != nil {
59- return err
60- }
61-
6265 // Build install manifest.
6366 err = tftestenv .RunCommand (ctx , "./" ,
6467 "kustomize build build/flux > build/flux.yaml" ,
0 commit comments