Skip to content
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

Make IMAGE_REPO, IMAGE_NAME, IMAGE_TAG available in build.artifacts[i].docker.buildArgs #4295

Closed
javier-b-perez opened this issue Jun 6, 2020 · 1 comment · Fixed by #7788
Labels
kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment.

Comments

@javier-b-perez
Copy link

Expected behavior

apiVersion: skaffold/v2beta1
kind: Config
build:
  local:
    push: false
  artifacts:
  - image: gobuilder
    context: build/gobuilder
    docker:
      dockerfile: Dockerfile
  # These containers are using builders (like golang + tools) + src.
  - image: my-app
    docker:
      dockerfile: my-app/Dockerfile
      buildArgs:
        GOBUILDER: "{{.IMAGE_REPO}}/gobuilder:{{.IMAGE_TAG}}"
skaffold build --default-repo=gcr.io/my-project -t demo

Actual behavior

- my-app: Error checking cache.
getting hash for artifact "my-app": getting dependencies for "my-app": parsing ONBUILD instructions: retrieving image "<no value>/gobuilder:<no value>": parsing reference [<no value>/gobuilder:<no value>]: could not parse reference: <no value>/gobuilder:<no value>

Information

  • Skaffold version: v1.10.1

Steps to reproduce the behavior

  1. git clone https://github.com/javier-b-perez/skaffold-tags-demo.git
  2. skaffold build --default-repo=gcr.io/my-project -t demo

Workaround

  1. Update skaffold.yaml
apiVersion: skaffold/v2beta1
kind: Config
build:
  local:
    push: false
  artifacts:
  - image: basebuilder
    docker:
      dockerfile: Dockerfile.base
  # These containers are using builders (like golang + tools) + src.
  - image: my-app
    docker:
      dockerfile: Dockerfile
      buildArgs:
        BASEBUILDER: "gcr.io/my-project/basebuilder:demo"
  1. Build builder
skaffold build --default-repo=gcr.io/my-project -t demo -b basebuilder
  1. Build app
skaffold build --default-repo=gcr.io/my-project
@tejal29
Copy link
Contributor

tejal29 commented Jun 17, 2020

@javier-b-perez Unfortunately the pr #3974 linked in #3229 only added the IMAGE_REPO, IMAGE_NAME and IMAGE_TAG to kaniko builder.

We need to do similar thing for docker builder here

@tejal29 tejal29 added the priority/p2 May take a couple of releases label Jun 19, 2020
@nkubala nkubala added this to the Icebox [P2+] milestone Sep 1, 2020
@gsquared94 gsquared94 added priority/p3 agreed that this would be good to have, but no one is available at the moment. and removed priority/p2 May take a couple of releases labels Sep 14, 2020
@nkubala nkubala removed this from the Icebox [P2+] milestone May 11, 2021
0xADD1E added a commit to 0xADD1E/skaffold that referenced this issue Aug 19, 2022
Resolves GoogleContainerTools#4295
Docs have long stated that these fields are available when
using the local docker builder, now they actually are.
0xADD1E added a commit to 0xADD1E/skaffold that referenced this issue Aug 24, 2022
Resolves GoogleContainerTools#4295
Docs have long stated that these fields are available when
using the local docker builder, now they actually are.
aaron-prindle pushed a commit that referenced this issue Aug 30, 2022
* fix: Fill IMAGE_TAG,etc on Docker builds

Resolves #4295
Docs have long stated that these fields are available when
using the local docker builder, now they actually are.

* Fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants