-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow passing image tag to docker build in buildArgs #3229
Comments
@Awem, skaffold runs locally and uses the local environment for substituting the variables. Does that make sense? Please re-open this if you need more information. |
Not sure whether we mean the same thing here. The Dockerfile is just for demonstration of a possible build. I do not want Skaffold to parse the Dockerfile. I am only looking for a possibility to use the name of the image (printed by Skaffold after |
Thank you for opening - this is a bug, the docs are confusing and the code is terribly inconsistent. It is supposed to work, as we do evaluate env vars there. However, our calculated values are handled inconsistently across the code base:
As I'm looking at references to this method - a bunch of places (including the docker builder) it is called with The solution will be to have one way of evaluating templates in the code. |
hi, apiVersion: skaffold/v2beta1
kind: Config
build:
local:
push: false
artifacts:
# Builder images are used to build the other containers.
# You need to specify the registry you want to use:
# export SKAFFOLD_DEFAULT_REPO=gcr.io/my-gcp-project
# export SKAFFOLD_TAG=latest
- image: gobuilder
context: build/gobuilder
docker:
dockerfile: Dockerfile
# These containers are using builders + src.
- image: my-app
docker:
dockerfile: my-app/Dockerfile
buildArgs:
GOBUILDER: "{{.SKAFFOLD_DEFAULT_REPO}}/gobuilder:{{.SKAFFOLD_TAG}}" The ARG GOBUILDER=gcr.io/my-gcp-project/gobuilder:latest
FROM ${GOBUILDER} as builder
...
RUN go build ... is there a way we can make some skaffold variables available for buildArgs? |
…not set explicitly). resolves GoogleContainerTools#3229
going to close this as a dupe of #3343 since I think it will be addressed if/when we fix that one. trying to keep all the conversations in one place :) |
…not set explicitly). resolves GoogleContainerTools#3229
…not set explicitly). resolves GoogleContainerTools#3229
…not set explicitly). resolves GoogleContainerTools#3229
…not set explicitly). resolves GoogleContainerTools#3229
…not set explicitly). resolves GoogleContainerTools#3229
…not set explicitly). resolves GoogleContainerTools#3229
…not set explicitly). resolves GoogleContainerTools#3229
…not set explicitly). resolves GoogleContainerTools#3229
* implement env variable expansion for kaniko builds * add IMAGE_REPO, IMAGE_NAME, IMAGE_TAG to generated env variables (if not set explicitly). resolves #3229 * use docker.ParseReference for kaniko env templating * add Repo and Name attributes to ImageReference * Update pkg/skaffold/build/cluster/kaniko_test.go Co-authored-by: Tejal Desai <tejal29@gmail.com>
Expected behavior
On
skaffold build
the tag of the docker image is immediately printed afterGenerating tags...
and should therefore be available in thebuildArgs
template of the docker build configuration.Actual behavior
It is not available.
Information
Steps to reproduce the behavior
IMAGE_NAME=name skaffold build
The text was updated successfully, but these errors were encountered: