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

kos don't seem to infer main from build correctly #4382

Closed
3 of 4 tasks
eddycharly opened this issue Oct 25, 2023 · 9 comments · Fixed by #4429
Closed
3 of 4 tasks

kos don't seem to infer main from build correctly #4382

eddycharly opened this issue Oct 25, 2023 · 9 comments · Fixed by #4429
Assignees
Labels
bug Something isn't working good-first-issue

Comments

@eddycharly
Copy link

What happened?

We tried to use the kos section to build images with a main.go in a subfolder of the repo.

We specified main in the build and referenced the build from the kos section but it doesn't seem to infer the setting.

See https://github.com/kyverno/chainsaw/blob/main/.goreleaser.yaml

How can we reproduce this?

The config file we use is visible at https://github.com/kyverno/chainsaw/blob/main/.goreleaser.yaml

Failing run logs https://github.com/kyverno/chainsaw/actions/runs/6638453325/job/18034825927

goreleaser version

v1.21.2

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this

Supporter

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@eddycharly eddycharly added bug Something isn't working triage Issue pending triage by one of the maintainers labels Oct 25, 2023
@caarlos0
Copy link
Member

caarlos0 commented Oct 26, 2023

I'll take a look when I get some time, thanks for reporting 🙏

@eddycharly
Copy link
Author

Thanks @caarlos0

I managed to make it work, using kos requires that the build is configured in a way that is compatible with the ko tool though.

@eddycharly
Copy link
Author

@caarlos0
Copy link
Member

ah, yes, the build goes a step further trying to look for main funcs in the cwd, which I guess ko does not.

Probably we could run this (the checkMain func) in the builder Default method so it passes down to ko too.

@caarlos0 caarlos0 added good-first-issue and removed triage Issue pending triage by one of the maintainers labels Oct 26, 2023
@eddycharly
Copy link
Author

eddycharly commented Oct 26, 2023

Looks like ko expects a relative path to a folder, things like cmd, cmd/main.go or ./cmd/main.go don't seem work with ko, only ./cmd (in my case).

A more strict validation with a useful message explaining what is wrong would be great.
Or just some words about that in the docs ?

@caarlos0
Copy link
Member

ah, gotcha, I think probably try to validate it better + docs

@caarlos0
Copy link
Member

can probably add a validation regex to the yamlschema, too

@gabrielcipriano
Copy link
Contributor

gabrielcipriano commented Oct 27, 2023

In builds.main The path must always be relative? or only when used with Ko?

@eddycharly
Copy link
Author

In builds.main The path must always be relative? or only when used with Ko?

It's a ko requirement, I don't think it applies when ko is not used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good-first-issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants