Skip to content

Added bazel in local execution environment#1662

Merged
priyawadhwa merged 7 commits intoGoogleContainerTools:masterfrom
priyawadhwa:bazel
Feb 21, 2019
Merged

Added bazel in local execution environment#1662
priyawadhwa merged 7 commits intoGoogleContainerTools:masterfrom
priyawadhwa:bazel

Conversation

@priyawadhwa
Copy link
Copy Markdown
Contributor

I added bazel as a builder plugin in the local execution environment.
This required moving DependenciesForArtifact into the build interface;
if people want to write their own plugins, they will need some way of
telling the skaffold watcher what their dependencies are.

fixes #1553

Priya Wadhwa added 4 commits February 15, 2019 14:47
I added bazel as a builder plugin in the local execution environment.
This required moving DependenciesForArtifact into the build interface;
if people want to write their own plugins, they will need some way of
telling the skaffold watcher what their dependencies are.
@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 15, 2019

Codecov Report

Merging #1662 into master will decrease coverage by 0.71%.
The diff coverage is 10.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1662      +/-   ##
==========================================
- Coverage   47.41%   46.69%   -0.72%     
==========================================
  Files         122      123       +1     
  Lines        5448     5600     +152     
==========================================
+ Hits         2583     2615      +32     
- Misses       2604     2716     +112     
- Partials      261      269       +8
Impacted Files Coverage Δ
pkg/skaffold/plugin/environments/gcb/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/local/local.go 29.41% <0%> (-22.32%) ⬇️
pkg/skaffold/runner/dev.go 56.52% <0%> (ø) ⬆️
pkg/skaffold/plugin/environments/gcb/desc.go 56.52% <0%> (-2.57%) ⬇️
pkg/skaffold/build/kaniko/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/util/util.go 46.04% <0%> (-2.45%) ⬇️
...kg/skaffold/plugin/environments/gcb/cloud_build.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/plugin/plugin.go 15.06% <0%> (-1.35%) ⬇️
cmd/skaffold/app/cmd/diagnose.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/kaniko/run.go 0% <0%> (ø) ⬆️
... and 11 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 acde29d...ff280e7. Read the comment docs.

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.

It's looking good - Now that we introduced the DependenciesForArtifact in the Builder interface, I think we can break out the build.DependenciesForArtifact to the separate implementations now instead of keeping it a centralized switch statement. WDYT?

@priyawadhwa
Copy link
Copy Markdown
Contributor Author

priyawadhwa commented Feb 19, 2019

I think the switch statement may still be the cleanest option, since build.DependenciesForArtifact applies to the overall "local" builder instead of the different types of artifacts -- is that what you meant?

@balopat
Copy link
Copy Markdown
Contributor

balopat commented Feb 20, 2019

I think the switch statement may still be the cleanest option, since build.DependenciesForArtifact applies to the overall "local" builder instead of the different types of artifacts -- is that what you meant?

No, what I meant is that the builder itself now should know what the dependencies are for a given artifact. It is weird to see bazel.DependenciesForArtifact calling out to a global build.DependenciesForArtifact where it checks whether the artifact is docker, jib or bazel... Instead the logic should be something like this in bazel.DependenciesForArtifact:

if a.BazelArtifact == nil {
  return nil, fmt.Errorf("%s is not a bazel artifact", a)  
}
return bazel.GetDependencies(ctx, a.Workspace, a.BazelArtifact)

@priyawadhwa
Copy link
Copy Markdown
Contributor Author

@balopat thanks for clarifying, that should be done now!

@balopat
Copy link
Copy Markdown
Contributor

balopat commented Feb 21, 2019

Great, almost there - I think we should go all the way, we can just nuke deps.go.

Return dependencies in DependenciesForArtifact for each builder; moved
switch statement into timeToListDependencies for the diagnose command.
@priyawadhwa
Copy link
Copy Markdown
Contributor Author

So removing deps.go would cause code duplication of the switch statement since we need it here for the local builder and here for the diagnose command.

I'm leaning towards keeping deps.go, WDYT?

@balopat
Copy link
Copy Markdown
Contributor

balopat commented Feb 21, 2019

This looks great!
1.) local.go will go away with all the builders turning into plugins. We can keep the switch logic there for now as it's an "obsolete" builder
2.) diagnose should actually delegate the call now to the builder that the runner created!

@priyawadhwa
Copy link
Copy Markdown
Contributor Author

Ahh got it that makes sense, thanks! I updated diagnose to do that :)

@priyawadhwa priyawadhwa merged commit cff3918 into GoogleContainerTools:master Feb 21, 2019
@priyawadhwa priyawadhwa deleted the bazel branch February 21, 2019 22:13
priyawadhwa pushed a commit to priyawadhwa/skaffold-1 that referenced this pull request Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Bazel as a builder plugin in local ExecutionEnvironment

4 participants