Environment variables set in before hook does not get passed to build arg #8787
Closed
Description
Expected behavior
Setting an environment variable in the before hook and using that in buildArgs
should correctly pass the value.
Actual behavior
No value gets passed.
Information
- Skaffold version: 2.4.1
- Operating system: Ventura 13.3.1 (a)
- Installed via: Homebrew
- Contents of skaffold.yaml:
apiVersion: skaffold/v4beta3
kind: Config
build:
artifacts:
- image: test-image
context: .
docker:
buildArgs:
HELLO: "{{ .HELLO }}"
hooks:
before:
- command:
- bash
- source-env.sh
Steps to reproduce the behavior
- Clone https://github.com/connorjburton/docker-env-hooks-bug
- Run
skaffold dev -v debug
See this line to prove the env is set
printing hello env value
WORLD
And this line to prove that it's not being passed to docker build
DEBU[0001] Running command: [docker build . --file ...snip.../docker-env-hooks-bug/Dockerfile -t test-image:1f2c197 --build-arg HELLO=<no value> --platform linux/amd64] subtask=test-image task=Build