Skip to content

git tag contains "/" causes docker build failure #3344

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

Closed
zhuming opened this issue Dec 3, 2019 · 2 comments · Fixed by #3407
Closed

git tag contains "/" causes docker build failure #3344

zhuming opened this issue Dec 3, 2019 · 2 comments · Fixed by #3407
Assignees
Labels
area/tag help wanted We would love to have this done, but don't have the bandwidth, need help from contributors 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

@zhuming
Copy link

zhuming commented Dec 3, 2019

Expected behavior

  • Any valid Dockerfile
  • git tag name contains "/"
  • run skaffold build
    --> expect the image is built and tagged properly

Actual behavior

skaffold build fails with error message

Generating tags...
 - my-docker-repositories.com/helloworld/hw -> cxm-my-docker-repositories.com/helloworld/hw:ms/1.0.0-94-g93057a3
Checking cache...
 - my-docker-repositories.com/helloworld/hw: Not found. Building
Building [my-docker-repositories.com/helloworld/hw]...
FATA[0001] failed to build: build failed: build failed: building [my-docker-repositories.com/helloworld/hw]: build artifact: docker build: Error response from daemon: invalid reference format

Information

  • Skaffold version: version... 0.6.0 and 1.0.0
  • Operating system: ... MacOS
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1
kind: Config
build:
  artifacts:
  - image: my-docker-repositories.com/helloworld/hw
    context:
      .
deploy:
  kubectl:
    manifests:
    - k8s/hw-dev.yaml

Steps to reproduce the behavior

  1. clone any repo
  2. git tag tag/slash
  3. skaffold build
@zhuming
Copy link
Author

zhuming commented Dec 3, 2019

Please either make the error message more clear, or replace all invalid character when generating the docker image tag from a git tag. Thanks.

@tejal29 tejal29 added kind/bug Something isn't working area/tag priority/p3 agreed that this would be good to have, but no one is available at the moment. help wanted We would love to have this done, but don't have the bandwidth, need help from contributors labels Dec 5, 2019
@tejal29
Copy link
Contributor

tejal29 commented Dec 5, 2019

@zhuming Thank you filing the bug. Replacing all invalid characters seems a good solution. Would you be up for submitting a PR?

Here is where we get the tag name https://github.com/GoogleContainerTools/skaffold/blob/master/pkg/skaffold/build/tag/git_commit.go#L77

we can add a function replaceInvalidChars and check if generated ref contains / and replace them with `_' or throw an error.

@dgageot dgageot self-assigned this Dec 19, 2019
dgageot added a commit to dgageot/skaffold that referenced this issue Dec 19, 2019
Signed-off-by: David Gageot <[email protected]>
dgageot added a commit to dgageot/skaffold that referenced this issue Dec 19, 2019
Signed-off-by: David Gageot <[email protected]>
dgageot added a commit to dgageot/skaffold that referenced this issue Dec 20, 2019
Signed-off-by: David Gageot <[email protected]>
dgageot added a commit that referenced this issue Dec 20, 2019
* Fix parallel tests

Signed-off-by: David Gageot <[email protected]>

* Fix #3344

Signed-off-by: David Gageot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tag help wanted We would love to have this done, but don't have the bandwidth, need help from contributors 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.

3 participants