ko: ko hangs when used with ASDF installed Go

I am able to reproduce either a bug, or a misconfiguration that could perhaps use a better error message of some sort.

The reproduction is here at StevenACoffman/repro.

Repro

If you clone that repo and run:

export GOPRIVATE=github.com/StevenACoffman
cd sub
ko publish -B --bare --local --platform=linux/amd64 --push=false .

The terminal will just hang there until you hit Ctrl-c.

At which point, it will then say:

^CError: error creating builder: 'builds': entry #0 does not contain a valid local import path (./.) for directory (.): err: signal: interrupt: stderr:
2021/12/12 21:00:19 error during command execution:error creating builder: 'builds': entry #0 does not contain a valid local import path (./.) for directory (.): err: signal: interrupt: stderr:

However, if you delete the .ko.yaml file in that directory and run it again, things work as you’d expect.

rm .ko.yaml
ko publish -B --bare --local --platform=linux/amd64 --push=false .

I have tried a number of different possible values for “main” and “dir” and “id” in the .ko.yaml file, including omitting them altogether. For instance, setting the main: to the values github.com/StevenACoffman/repro/sub, ., and main don’t seem to affect this hanging behavior.

.ko.yaml contents:

# KO_DOCKER_REPO should be either kind.local
# (for KinD) or ko.local

defaultBaseImage: gcr.io/distroless/static
builds:
  # You can have multiple builds defined as a yaml list
  -
    # ID of the build.
    # Defaults to the project name.
    id: "my-build"

    # Path to project's (sub)directory containing Go code.
    # This is the working directory for the Go build command(s).
    # Default is `.`.
    dir: .

    # Path to main.go file or main package.
    # Notice: when used with `gomod.proxy`, this must be a package.
    #
    # Default is `.`.
    main: github.com/StevenACoffman/repro/sub


    ldflags:
      - -s 
      - -w
      - -X main.AppName=Working

    # Custom environment variables to be set during the builds.
    # Default is empty.
    env:
      - CGO_ENABLED=0

Any help or tips would be greatly appreciated!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (10 by maintainers)

Commits related to this issue

Most upvoted comments