Skip to content

Dockerfiles with quotes on base image tags fail to parse #7026

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
nkubala opened this issue Jan 19, 2022 · 0 comments · Fixed by #7027
Closed

Dockerfiles with quotes on base image tags fail to parse #7026

nkubala opened this issue Jan 19, 2022 · 0 comments · Fixed by #7027
Assignees
Labels
area/build build/docker kind/bug Something isn't working priority/p1 High impact feature/bug.

Comments

@nkubala
Copy link
Contributor

nkubala commented Jan 19, 2022

Expected behavior

Dockerfile parses correctly and skaffold build builds container image

Actual behavior

skaffold build fails with:

➜  getting-started git:(main) ✗ skaffold build 
Generating tags...
 - skaffold-example -> skaffold-example:v1.35.0-54-ga04528748-dirty
Checking cache...
 - skaffold-example: Error checking cache.
getting hash for artifact "skaffold-example": getting dependencies for "skaffold-example": parsing ONBUILD instructions: retrieving image "golang:\"1.15": parsing reference "golang:\"1.15": could not parse reference: golang:"1.15

Information

  • Skaffold version: v1.35.2 (or any)
  • Contents of skaffold.yaml:
<paste your skaffold.yaml here>

Dockerfile:

FROM golang:"1.15"
RUN ls

This is happening because in our parsing logic, we remove quotes around base images provided in the FROM clause, but we only removing leading/trailing. This results in golang:"1.15" being passed in as golang:"1.15, which fails.

func unquote(v string) string {
unquoted := strings.TrimFunc(v, func(r rune) bool { return r == '"' })
if unquoted != v {
return unquoted
}
unquoted = strings.TrimFunc(v, func(r rune) bool { return r == '\'' })
return unquoted
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build build/docker kind/bug Something isn't working priority/p1 High impact feature/bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant