Skip to content

Commit

Permalink
fix: putting back local image load logic and enable --load-images fla…
Browse files Browse the repository at this point in the history
…g to force the load
  • Loading branch information
renzodavid9 committed Jul 13, 2023
1 parent d05a226 commit 73a798a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/skaffold/app/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ The build result from a previous 'skaffold build --file-output' run can be used
Value: &opts.ForceLoadImages,
DefValue: false,
FlagAddMethod: "BoolVar",
DefinedOn: []string{"deploy"},
DefinedOn: []string{"deploy", "verify"},
},
{
Name: "hydration-dir",
Expand Down
2 changes: 2 additions & 0 deletions docs-v2/content/en/docs/references/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,7 @@ The build result from a previous 'skaffold build --file-output' run can be used
--docker-network='': Name of an existing docker network to use when running the verify tests. If not specified, Skaffold will create a new network to use of the form 'skaffold-network-<uuid>'
--env-file='': File containing env var key-value pairs that will be set in all verify container envs
-f, --filename='skaffold.yaml': Path or URL to the Skaffold config file
--load-images=false: If true, skaffold will force load the container images into the local cluster.
-m, --module=[]: Filter Skaffold configs to only the provided named modules
--port-forward=off: Port-forward exposes service ports and container ports within pods and other resources (off, user, services, debug, pods)
-p, --profile=[]: Activate profiles by name (prefixed with `-` to disable a profile)
Expand All @@ -1457,6 +1458,7 @@ Env vars:
* `SKAFFOLD_DOCKER_NETWORK` (same as `--docker-network`)
* `SKAFFOLD_ENV_FILE` (same as `--env-file`)
* `SKAFFOLD_FILENAME` (same as `--filename`)
* `SKAFFOLD_LOAD_IMAGES` (same as `--load-images`)
* `SKAFFOLD_MODULE` (same as `--module`)
* `SKAFFOLD_PORT_FORWARD` (same as `--port-forward`)
* `SKAFFOLD_PROFILE` (same as `--profile`)
Expand Down
11 changes: 9 additions & 2 deletions pkg/skaffold/runner/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,15 @@ See https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works`)
ctx, endTrace := instrumentation.StartTrace(ctx, "Verify_Verifying")
defer endTrace()

// We assume all the localImgs were build by Skaffold, so we want to load them all.
r.verifier.RegisterLocalImages(localImages)
// we only want to register images that are local AND were built by this runner OR forced to load via flag
var localAndBuiltImages []graph.Artifact
for _, image := range localImages {
if r.runCtx.ForceLoadImages() || r.wasBuilt(image.Tag) {
localAndBuiltImages = append(localAndBuiltImages, image)
}
}

r.verifier.RegisterLocalImages(localAndBuiltImages)
err = r.verifier.Verify(ctx, deployOut, artifacts)
postDeployFn()
if err != nil {
Expand Down

0 comments on commit 73a798a

Please sign in to comment.