Skip to content

Add custom artifact for custom local builds#1999

Merged
priyawadhwa merged 21 commits intoGoogleContainerTools:masterfrom
priyawadhwa:custom
May 1, 2019
Merged

Add custom artifact for custom local builds#1999
priyawadhwa merged 21 commits intoGoogleContainerTools:masterfrom
priyawadhwa:custom

Conversation

@priyawadhwa
Copy link
Copy Markdown
Contributor

@priyawadhwa priyawadhwa commented Apr 22, 2019

This is the first PR for custom builders in skaffold. This PR adds in support for:

  • Building a custom artifact using the local builder
  • I added unit tests, an integration test, and tested locally with a GKE cluster and minikube

Upcoming PRs will add support for:

  • Building a custom artifact using the cluster builder
  • Specifying dockerfile, bazel, jib or a command for retrieving dependencies

Priya Wadhwa added 6 commits April 24, 2019 15:20
Priya Wadhwa added 4 commits April 29, 2019 13:54
Created a custom artifact builder which local/cluster builders will call
out to for building custom artifacts. Added unit tests.
@priyawadhwa priyawadhwa marked this pull request as ready for review April 30, 2019 00:01
@priyawadhwa priyawadhwa changed the title [WIP] Add custom artifact for custom local builds Add custom artifact for custom local builds Apr 30, 2019
@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 30, 2019

Codecov Report

Merging #1999 into master will decrease coverage by 0.09%.
The diff coverage is 48.43%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
pkg/skaffold/schema/latest/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/build/local/local.go 37.31% <0%> (-2.37%) ⬇️
pkg/skaffold/build/local/custom.go 0% <0%> (ø)
pkg/skaffold/build/custom/custom.go 51.72% <51.72%> (ø)
pkg/skaffold/docker/parse.go 78.5% <60%> (-1.21%) ⬇️
pkg/skaffold/build/custom/dependencies.go 77.77% <77.77%> (ø)
pkg/skaffold/build/gcb/docker.go 90.47% <0%> (-9.53%) ⬇️
pkg/skaffold/build/local/docker.go 53.19% <0%> (-3.63%) ⬇️
pkg/skaffold/docker/image.go 71.42% <0%> (-0.7%) ⬇️
... and 3 more

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 11f8a1b...c3339ce. Read the comment docs.

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// 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.

Copy link
Copy Markdown
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

@tejal29 tejal29 left a comment

Choose a reason for hiding this comment

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

This looks really good except more documentation on the ArtifactBuilder.

}

if b.pushImages {
return docker.RemoteDigest(tag, b.insecureRegistries)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if skaffold pushes the image to Remote instead of build script here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

@tejal29 tejal29 Apr 30, 2019

Choose a reason for hiding this comment

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

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.

@priyawadhwa priyawadhwa added the docs-modifications runs the docs preview service on the given PR label Apr 30, 2019
@container-tools-bot
Copy link
Copy Markdown

Please visit http://35.236.22.24:1313 to view changes to the docs.

@container-tools-bot container-tools-bot removed the docs-modifications runs the docs preview service on the given PR label Apr 30, 2019
@priyawadhwa
Copy link
Copy Markdown
Contributor Author

@balopat @tejal29 added documentation!

@priyawadhwa priyawadhwa reopened this Apr 30, 2019
@priyawadhwa priyawadhwa added the docs-modifications runs the docs preview service on the given PR label Apr 30, 2019
@container-tools-bot
Copy link
Copy Markdown

Please visit http://35.236.22.24:1313 to view changes to the docs.

@container-tools-bot container-tools-bot removed the docs-modifications runs the docs preview service on the given PR label Apr 30, 2019
##### 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. |
Copy link
Copy Markdown
Contributor

@tejal29 tejal29 Apr 30, 2019

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

@tejal29 tejal29 left a comment

Choose a reason for hiding this comment

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

LGTM except for doc nits.

@priyawadhwa priyawadhwa merged commit 4a4d696 into GoogleContainerTools:master May 1, 2019
@priyawadhwa priyawadhwa deleted the custom branch May 1, 2019 00:15
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.

6 participants