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

Add Dir config field to ko builder #6496

Merged
merged 2 commits into from Aug 30, 2021

Conversation

halvards
Copy link
Collaborator

Description
The Dir config field supports users who have directory layouts where the Go sources and go.mod file are in subdirectories of the context directory.

The value of Dir is a directory path relative to the context directory, and it specifies the directory where go build is run.

This change also moves forward some of the additional ko builder flags in the implementation plan, since the relevant ko PRs have been merged.

Context: #6054 (comment)

Tracking: #6041
Related: #6437 #6447

@halvards halvards requested a review from a team as a code owner August 24, 2021 08:28
@google-cla google-cla bot added the cla: yes label Aug 24, 2021
Copy link
Member

@briandealwis briandealwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: a few tiny optional comments

// Dir is the directory where the `go` tool will be run.
// The value is a directory path relative to the `context` directory.
// If empty, the `go` tool will run in the `context` directory.
// Example: `my-go-mod-is-in-this-dir`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped to come up with a more realistic example, but I can't think of anything that is any better (live-at-head, compat-go114)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are better examples, I've updated the doc.

docs/design_proposals/ko-builder.md Show resolved Hide resolved
pkg/skaffold/build/ko/builder.go Show resolved Hide resolved
The `Dir` config field supports users who have directory layouts where
the Go sources and `go.mod` file are in subdirectories of the `context`
directory.

The value of `Dir` is a directory path relative to the `context`
directory, and it specifies the directory where `go build` is run.

This change also moves forward some of the additional ko builder flags
in the implementation plan, since the relevant ko PRs have been merged.
Also change example ko builder `Dir` config values.
@codecov
Copy link

codecov bot commented Aug 25, 2021

Codecov Report

Merging #6496 (0cf3ab4) into main (997edc8) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6496      +/-   ##
==========================================
- Coverage   70.43%   70.41%   -0.02%     
==========================================
  Files         515      515              
  Lines       23127    23127              
==========================================
- Hits        16289    16286       -3     
- Misses       5780     5783       +3     
  Partials     1058     1058              
Impacted Files Coverage Δ
pkg/skaffold/build/ko/builder.go 100.00% <100.00%> (ø)
pkg/skaffold/log/stream/stream.go 71.42% <0.00%> (-14.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 997edc8...0cf3ab4. Read the comment docs.

@briandealwis briandealwis enabled auto-merge (squash) August 30, 2021 13:51
@briandealwis briandealwis added the kokoro:run runs the kokoro jobs on a PR label Aug 30, 2021
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Aug 30, 2021
@briandealwis briandealwis merged commit 9b85150 into GoogleContainerTools:main Aug 30, 2021
@halvards halvards deleted the ko-config-dir branch August 31, 2021 05:11
halvards added a commit to halvards/skaffold that referenced this pull request Sep 6, 2021
**Description**

Container images built by ko have the
[author](https://github.com/opencontainers/image-spec/blob/main/config.md#properties)
property set to the value
[`github.com/google/ko`](https://github.com/google/ko/blob/v0.8.3/pkg/build/gobuild.go#L610).

Skaffold debug can use this property to detect a Go runtime artifact.

This feature can be used for images built using Skaffold's ko builder (when ready),
and for images build using ko via a custom build (usable now).

**Tracking**: GoogleContainerTools#6041
**Related**: GoogleContainerTools#6563
**Context**: GoogleContainerTools#6496 (comment)
tejal29 pushed a commit that referenced this pull request Sep 8, 2021
**Description**

Container images built by ko have the
[author](https://github.com/opencontainers/image-spec/blob/main/config.md#properties)
property set to the value
[`github.com/google/ko`](https://github.com/google/ko/blob/v0.8.3/pkg/build/gobuild.go#L610).

Skaffold debug can use this property to detect a Go runtime artifact.

This feature can be used for images built using Skaffold's ko builder (when ready),
and for images build using ko via a custom build (usable now).

**Tracking**: #6041
**Related**: #6563
**Context**: #6496 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants