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

Image name not sanitized when default repo is unset #6675

Closed
halvards opened this issue Oct 5, 2021 · 0 comments · Fixed by #6678
Closed

Image name not sanitized when default repo is unset #6675

halvards opened this issue Oct 5, 2021 · 0 comments · Fixed by #6678
Assignees
Labels
kind/bug Something isn't working ko

Comments

@halvards
Copy link
Contributor

halvards commented Oct 5, 2021

Expected behavior

Skaffold can build images where the image name in skaffold.yaml is a ko:// scheme-prefixed Go import path that may contain uppercase characters, e.g., ko://github.com/GoogleContainerTools/skaffold/cmd/skaffold.

This should work regardless of whether the Skaffold default repo is set or not.

Sanitization (see #4952) removes the ko:// prefix and lowercases the Go import path, e.g., ko://github.com/GoogleContainerTools/skaffold/cmd/skaffold -> github.com/googlecontainertools/skaffold/cmd/skaffold

Actual behavior

Builds of images with the ko:// prefix and Go import paths with uppercase characters fail if the Skaffold default repo is not set.

See steps to reproduce below for details on the error.

Information

  • Skaffold version: v1.32.0
  • Operating system: Linux Debian 5.10.46
  • Installed via: GitHub release
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta23
kind: Config
build:
  artifacts:
  - image: ko://github.com/GoogleContainerTools/skaffold/examples/custom
    custom:
      buildCommand: ./build.sh
      dependencies:
        paths:
        - "go.mod"
        - "**.go"
  tagPolicy:
    sha256: {}

Steps to reproduce the behavior

git clone https://github.com/GoogleContainerTools/skaffold.git
cd skaffold
git checkout v1.32.0
cd examples/custom
unset SKAFFOLD_DEFAULT_REPO
skaffold build --cache-artifacts=false --push=false

Output:

Generating tags...
 - ko://github.com/GoogleContainerTools/skaffold/examples/custom -> ko://github.com/GoogleContainerTools/skaffold/examples/custom:latest
Starting build...
Building [ko://github.com/GoogleContainerTools/skaffold/examples/custom]...
2021/10/05 22:17:14 Using base gcr.io/distroless/static:nonroot for github.com/GoogleContainerTools/skaffold/examples/custom
2021/10/05 22:17:18 Building github.com/GoogleContainerTools/skaffold/examples/custom for linux/amd64
2021/10/05 22:17:18 Loading ko.local/github.com/googlecontainertools/skaffold/examples/custom:f3d25bf00e3dc061e3f130d284317c8599fcb80775418a559c0acfe9f98a6177
2021/10/05 22:17:18 Loaded ko.local/github.com/googlecontainertools/skaffold/examples/custom:f3d25bf00e3dc061e3f130d284317c8599fcb80775418a559c0acfe9f98a6177
Error parsing reference: "ko://github.com/GoogleContainerTools/skaffold/examples/custom:latest" is not a valid repository/tag: invalid reference format: repository name must be lowercase
exit status 1

Related

This issue was uncovered by this failed build of #6614: https://github.com/GoogleContainerTools/skaffold/pull/6614/checks?check_run_id=3799415059

@halvards halvards added kind/bug Something isn't working ko labels Oct 5, 2021
@halvards halvards self-assigned this Oct 5, 2021
halvards added a commit to halvards/skaffold that referenced this issue Oct 5, 2021
This change ensures that image names from `skaffold.yaml` are sanitized
even when the Skaffold default repo is not set.

This is relevant for ko images with names that consist of the `ko://`
scheme prefixed, followed by a Go import path that may contain uppercase
characters, e.g.,
`ko://github.com/GoogleContainerTools/skaffold/cmd/skaffold`.

Fixes: GoogleContainerTools#6675
Tracking: GoogleContainerTools#6041
Related: GoogleContainerTools#4952
tejal29 pushed a commit that referenced this issue Oct 5, 2021
This change ensures that image names from `skaffold.yaml` are sanitized
even when the Skaffold default repo is not set.

This is relevant for ko images with names that consist of the `ko://`
scheme prefixed, followed by a Go import path that may contain uppercase
characters, e.g.,
`ko://github.com/GoogleContainerTools/skaffold/cmd/skaffold`.

Fixes: #6675
Tracking: #6041
Related: #4952
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 ko
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant