Add custom artifact for custom local builds#1999
Add custom artifact for custom local builds#1999priyawadhwa merged 21 commits intoGoogleContainerTools:masterfrom
Conversation
Pass in docker env variables so that built images are built directly into minikube. Also add to the unit test and update the build script to only push images if necessary.
Created a custom artifact builder which local/cluster builders will call out to for building custom artifacts. Added unit tests.
Codecov Report
@@ Coverage Diff @@
## master #1999 +/- ##
=========================================
- Coverage 56.03% 55.93% -0.1%
=========================================
Files 175 178 +3
Lines 7615 7689 +74
=========================================
+ Hits 4267 4301 +34
- Misses 2940 2973 +33
- Partials 408 415 +7
Continue to review full report at Codecov.
|
pkg/skaffold/schema/latest/config.go
Outdated
| type CustomArtifact struct { | ||
| // BuildCommand is the command executed to build the image. | ||
| BuildCommand string `yaml:"buildCommand,omitempty"` | ||
| // Dependencies are the file dependencies that skaffold should watch for this artifact. |
There was a problem hiding this comment.
| // Dependencies are the file dependencies that skaffold should watch for this artifact. | |
| // Dependencies are the file dependencies that skaffold should watch for both rebuilding and file syncing for this artifact. |
balopat
left a comment
There was a problem hiding this comment.
Thank you @priyawadhwa, this will be awesome!
I did a quick "drive-by" review and it looks good to me, based on all the discussions we had.
More documentation would be great - a section with ALPHA warnings on the How-to/Builders should describe how to use customArtifact builders, what the contract is between the scripts and skaffold and how they impact file sync, logging, etc.
tejal29
left a comment
There was a problem hiding this comment.
This looks really good except more documentation on the ArtifactBuilder.
| } | ||
|
|
||
| if b.pushImages { | ||
| return docker.RemoteDigest(tag, b.insecureRegistries) |
There was a problem hiding this comment.
What if skaffold pushes the image to Remote instead of build script here?
There was a problem hiding this comment.
So the custom build script is responsible for pushing. We pass in pushImages to the build script so that it knows if the image is expected to exist remotely or locally.
There was a problem hiding this comment.
no my question was around "skaffold actually pushing an image here instead of retrieving it". Since custom artifact builder is local builder the build script shd have build it in local docker.
But i think after looking at what other buildesr do there are builder which directly build into registry.
So i change my mind.
|
Please visit http://35.236.22.24:1313 to view changes to the docs. |
|
Please visit http://35.236.22.24:1313 to view changes to the docs. |
| ##### Local builder | ||
| | Environment Variable | Description | Expectation | | ||
| | ------------- |-------------| -----| | ||
| | Docker daemon environment variables | Inform the custom builder of which docker daemon endpoint we are using. Allows custom build scripts to work with tools like Minikube.| None. | |
There was a problem hiding this comment.
is there a doc on what these environment variables are? The closet i found is https://docs.docker.com/machine/reference/env/
Please add a link here.
tejal29
left a comment
There was a problem hiding this comment.
LGTM except for doc nits.
This is the first PR for custom builders in skaffold. This PR adds in support for:
Upcoming PRs will add support for:
dockerfile,bazel,jibor acommandfor retrieving dependencies