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

Introduce RunContext object for passing necessary context to runner constructor methods #1885

Merged
merged 11 commits into from
Apr 3, 2019

Conversation

nkubala
Copy link
Contributor

@nkubala nkubala commented Mar 27, 2019

This change is a refactor that adds a new configuration object, RunContext, created by the runner. This object aggregates all contextual information about a skaffold pipeline run, and passes this object to all the constructors for the major components inside the runner (e.g. Builder, Deployer, etc.). This simplifies the constructor API, making it easier to add new parameters to these methods without having to change their signatures.

One small functional change: the Tester now optionally consumes the list of pre-built images (passed via the command line) from the SkaffoldOptions object, and uses this list to check against provided TestCases from the skaffold.yaml when running tests. This is a cleaner way of skipping tests for pre-built images.

All other skaffold functionality should be unaffected by this change.

@balopat
Copy link
Contributor

balopat commented Mar 27, 2019

concerns: NeedsPush is not used anywhere, Plugins are failing on kokoro.

@balopat
Copy link
Contributor

balopat commented Apr 1, 2019

Plugins were failing due to the gob encoder not supporting embedded structs with zero exported fields.
A solution to this is to refactor the Build/Test/Deploy parts to Pipeline in SkaffoldConfig and then only store Pipeline in RunContext: this experimental commit passes kokoro tests. I'll create a 3rd PR (insecure registries <- this PR for RunContext <-Pipeline PR) separately to tackle this change.

pkg/skaffold/test/types.go Outdated Show resolved Hide resolved
Copy link
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

balopat added a commit that referenced this pull request Apr 3, 2019
This should be a functionally equivalent change, i.e refactoring, however it does change the generated schema for the skaffold config

Motivation: while introducing `RunContext` in #1885, it would be beneficial to just share the `Pipeline` part of the configuration, as:
 - no further functionality depends on the profiles/apiVersion/kind fields anyway 
 - the profiles struct is not serializable by gob.encoder as it embeds `yamlpatch.Node` which does not have exported fields

Changes: 

* extracting Pipeline struct fromSkaffoldConfig  (SkaffoldPipeline originally) as an inline struct
* changing top level schema definition to be the first defined struct instead of SkaffoldPipeline hardcoded
@codecov-io
Copy link

codecov-io commented Apr 3, 2019

Codecov Report

Merging #1885 into master will decrease coverage by 0.02%.
The diff coverage is 53.03%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1885      +/-   ##
=========================================
- Coverage   49.83%   49.8%   -0.03%     
=========================================
  Files         177     180       +3     
  Lines        8114    8149      +35     
=========================================
+ Hits         4044    4059      +15     
- Misses       3688    3708      +20     
  Partials      382     382
Impacted Files Coverage Δ
pkg/skaffold/plugin/shared/server.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/plugin/plugin.go 12.94% <0%> (-1.17%) ⬇️
pkg/skaffold/plugin/environments/gcb/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/plugin/shared/client.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/local/bazel.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/kaniko/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/plugin/builders/bazel/builder.go 14.28% <0%> (-0.72%) ⬇️
pkg/skaffold/build/local/docker.go 100% <100%> (ø) ⬆️
pkg/skaffold/build/util.go 100% <100%> (ø)
pkg/skaffold/deploy/helm.go 61.92% <100%> (ø) ⬆️
... and 15 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 b1dce64...ca164f5. Read the comment docs.

@tejal29 tejal29 merged commit e9907a4 into GoogleContainerTools:master Apr 3, 2019
@tejal29 tejal29 mentioned this pull request Apr 12, 2019
@nkubala nkubala deleted the runcontext branch June 12, 2019 21:41
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.

5 participants