-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Restore import path with uppercase characters in custom build ko example #6286
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6286 +/- ##
=======================================
Coverage 70.38% 70.38%
=======================================
Files 501 501
Lines 22755 22755
=======================================
Hits 16015 16015
Misses 5696 5696
Partials 1044 1044
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@halvards not sure why kokoro job keeps failing. This is the error. Is it related to go v1.16?
|
Thanks for the heads up. Not sure, I'll take a look at this tomorrow. |
@halvards this should be fixed by rebasing onto the latest commit from |
I wasn't able to reproduce the issue described in GoogleContainerTools#5492 and GoogleContainerTools#5505, so this change restores the import path with the uppercase characters and the `ko://` prefix in the custom build example. I had to tweak some values to get the integration tests to run, because I don't have access to the `k8s-skaffold` project. Let's see if the build passes. Additional minor changes: - Bump the ko version in the custom build example. - Add the full path to the ko binary in the custom build script, in case `$GOPATH/bin` is not on the `PATH`. Once we move to Go 1.16 for our builds, we can use the `go install` command to install ko in the custom build shell script.
It's difficult to know what's on the `PATH` in different environments. This change to the custom builder example looks for the ko binary in the `GOPATH/bin` directory.
Hypothesis: `tagPolicy: sha256` doesn't behave correctly with images sideloaded into kind snf k3d. Also fix conditional in custom build example shell script to prevent recompiling ko each time.
I was able to reproduce the issue locally and work out a fix. I'd be happy for feedback on whether I've chosen the right place to fix it. When determining which images to sideload (for kind and k3d), we compare `localImages` and `deployerImages`. The former from `skaffold.yaml`, and the latter from Kubernetes manifest files. The image names from Kubernetes manifests are sanitized in `pkg/skaffold/kubernetes/manifests/images.go#L51` (and `L113`) in the call to docker.ParseReference. The same doesn't happen to image names from `skaffold.yaml`. This change sanitizes these image names just for determining whether to sideload the images. In other parts of the code we look up image pipelines from `skaffold.yaml` using the image name, so I was hesitant to change how `localImages` is used (with 'raw' image names). The hypothesis from the previous commit is disproven, so I'm adding back the `sha256` tag policy in the custom builder example. To make the test case easier to identify from the build logs, I renamed the pod in the custom builder example. New hypothesis: Could this be related to the issues some users are reporting with images not being sideloaded when using Helm? E.g., GoogleContainerTools#5159
just did a rebase for you. Hopefully this attempt will succeed. |
ahh kokoro run didn't happen. Running one now. |
Decide on how ko builder users should specify the location of `package main` for their images. Previous discussion: GoogleContainerTools#6054 (comment) Tracking: GoogleContainerTools#6041 Related: GoogleContainerTools#6054, GoogleContainerTools#6286
Decide on how ko builder users should specify the location of `package main` for their images. Previous discussion: GoogleContainerTools#6054 (comment) Tracking: GoogleContainerTools#6041 Related: GoogleContainerTools#6054, GoogleContainerTools#6286
* Refine ko builder behavior for main packages Decide on how ko builder users should specify the location of `package main` for their images. Previous discussion: #6054 (comment) Tracking: #6041 Related: #6054, #6286 * Improve explanation of the Target config field Clarify how a blank value works, and also how users can use a pattern with wildcards.
Fixes: #5505
Related: #5492 #6041
Description
Updated: I was able to reproduce the issue locally and work out a fix. I'd be happy for feedback on whether I've chosen the right place to fix it.
When determining which images to sideload (for kind and k3d), we compare
localImages
anddeployerImages
. The former fromskaffold.yaml
, and the latter from Kubernetes manifest files. The image names from Kubernetes manifests are sanitized inpkg/skaffold/kubernetes/manifests/images.go#L51
(andL113
) in the call todocker.ParseReference()
.The same doesn't happen to image names from
skaffold.yaml
. This change sanitizes these image names just for determining whether to sideload the images.In other parts of the code we look up image pipelines from
skaffold.yaml
using the image name, so I was hesitant to change howlocalImages
is used (with 'raw' image names).To make the custom builder test case easier to identify from the build logs, I renamed the pod in the example.
Hypothesis: Could this be related to the issues some users are reporting with images not being sideloaded when using Helm? E.g., #5159
Additional minor changes:
Bump the ko version in the custom build example.
Add the full path to the ko binary in the custom build script, in case
$GOPATH/bin
is not on thePATH
.Once we move to Go 1.16 for our builds, we can use the
go install
command to install ko in the custom build shell script.