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

Add Annotations to command and flags per phase annotation. #2022

Merged
merged 12 commits into from
May 22, 2019

Conversation

tejal29
Copy link
Member

@tejal29 tejal29 commented Apr 25, 2019

Inspired by @balopat feedback on #2018 , in this change Command have annotations with phases they run like "build", "test", "deploy".

Annotations Description:

Annotation Description
build Runs a build
test Runs tests
deploy Performs Deploy
cleanup flags related to clean up
events uses events api to send events

With this new change, hopefully only relevant flags are added for commands.

Flags Removed or Added per Command

Command Flags removed Flags Added Note
build --no-prune, --toot
delete --enable-rpc, --rpc-port, --rpc-int-port, --toot Events api not used in this flow
deploy --cache-artifacts , --cache-file,--insecure-registry, --skip-tests
dev --force (for deploy phase,false by default)

Some considerations:
Maybe toot should be a common flag for build, delete, deploy and run without --tail.

Copy link
Contributor

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

just a couple nits

cmd/skaffold/app/cmd/dev.go Outdated Show resolved Hide resolved
cmd/skaffold/app/cmd/flags.go Outdated Show resolved Hide resolved
@tejal29
Copy link
Member Author

tejal29 commented Apr 25, 2019

TODO: --tail has different defaults in depoy, dev and run.
Fix that

@tejal29 tejal29 force-pushed the use_flagset branch 2 times, most recently from 8ccb48c to 414b88a Compare April 26, 2019 01:38
@codecov-io
Copy link

codecov-io commented Apr 26, 2019

Codecov Report

Merging #2022 into master will decrease coverage by <.01%.
The diff coverage is 95.74%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2022      +/-   ##
=========================================
- Coverage   57.31%   57.3%   -0.01%     
=========================================
  Files         186     187       +1     
  Lines        7871    7875       +4     
=========================================
+ Hits         4511    4513       +2     
- Misses       2948    2949       +1     
- Partials      412     413       +1
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/deploy.go 68.75% <100%> (ø) ⬆️
cmd/skaffold/app/cmd/debug.go 61.53% <100%> (ø) ⬆️
pkg/skaffold/config/options.go 92.85% <100%> (ø) ⬆️
cmd/skaffold/app/cmd/run.go 60% <100%> (ø) ⬆️
cmd/skaffold/app/cmd/cmd.go 65% <100%> (-8.34%) ⬇️
cmd/skaffold/app/cmd/dev.go 24.44% <100%> (ø) ⬆️
cmd/skaffold/app/cmd/delete.go 66.66% <100%> (+3.03%) ⬆️
cmd/skaffold/app/cmd/build.go 69.23% <100%> (+0.8%) ⬆️
cmd/skaffold/app/cmd/flags.go 92.59% <92.59%> (ø)

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 6b7a28e...72f2511. Read the comment docs.

@tejal29 tejal29 force-pushed the use_flagset branch 2 times, most recently from d10f864 to e704e4e Compare April 29, 2019 18:49
Copy link
Contributor

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

just one more question & a nit

cmd/skaffold/app/cmd/flags.go Outdated Show resolved Hide resolved
cmd/skaffold/app/cmd/flags_test.go Outdated Show resolved Hide resolved
@tejal29
Copy link
Member Author

tejal29 commented Apr 29, 2019

@priyawadhwa Added comment to describe the same.

Copy link
Contributor

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Cool, LGTM

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

in general this looks good - but the force flag with default false on dev now gets added - but it wasn't there before! that is a regression on #1484.
This is the second example of a flag that needs to be added with different default depending on the command:

tailFalse for deploy, run
tailTrue for dev

forceFalse for deploy, run
forceTrue for dev

Also I don't understand fully the tail situation yet, it is very hard to follow.

@tejal29
Copy link
Member Author

tejal29 commented Apr 29, 2019

Great! i feel with "--force" being another example along with "--tail" where defaults are different per command, i should think of a way to specify default behavior based on command.
I will make changes to this PR.

@tejal29 tejal29 force-pushed the use_flagset branch 2 times, most recently from c3d5a42 to a2a99a0 Compare April 30, 2019 18:44
@tejal29
Copy link
Member Author

tejal29 commented Apr 30, 2019

@priyawadhwa and @balopat please take another look.
I actually ended up moving the annotations to flags now.
This is was something @balopat and I had discussed previously but i veto-ed it :)
Looks like i have to do it that way to add flags with different defaults.

@tejal29
Copy link
Member Author

tejal29 commented Apr 30, 2019

Freeze for now until @balopat comes back. As per last discussion, he would want to see flagset per flag with annotation for which command they belong to versus right now its a group of flags.

@tejal29 tejal29 added the docs-modifications runs the docs preview service on the given PR label May 22, 2019
@container-tools-bot
Copy link

Please visit http://35.236.23.230: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 May 22, 2019
Copy link
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.

This is looking very good - only nits

cmd/skaffold/app/cmd/flags.go Outdated Show resolved Hide resolved
/// specify "all"
// FlagAddMethod is method which defines a flag value with specified
// name, default value, and usage string. e.g. `StringVar`, `BoolVar`
var FlagResitry = []Flag{
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var FlagResitry = []Flag{
var FlagRegistry = []Flag{

pkg/skaffold/config/options.go Show resolved Hide resolved
},
{
Name: "force",
Usage: "Recreate kubernetes resources if necessary for deployment, warning: might cause downtime!)",
Copy link
Contributor

@balopat balopat May 22, 2019

Choose a reason for hiding this comment

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

Suggested change
Usage: "Recreate kubernetes resources if necessary for deployment, warning: might cause downtime!)",
Usage: "Recreate kubernetes resources if necessary for deployment (default: false, warning: might cause downtime!)",

Copy link
Member Author

Choose a reason for hiding this comment

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

done

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

Yay!

@balopat balopat merged commit ab46e0d into GoogleContainerTools:master May 22, 2019
@tejal29 tejal29 deleted the use_flagset branch April 15, 2021 07:33
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