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

enhance(deploy)!: remove default value for ref in add deployment command #480

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

ecrupper
Copy link
Contributor

@ecrupper ecrupper commented Sep 11, 2023

Closes go-vela/community#423

Made possible by go-vela/server#961

Also removing the default value of production as a deployment target. This seems like it could exacerbate a simple mistake if folks forget to provide a target when intending to target a non-prod environment.

Marking this breaking, as potential scripts that depended on those default values (mostly the target, as the ref will be populated with the default branch anyway) will now not work as they used to.

@ecrupper ecrupper requested a review from a team as a code owner September 11, 2023 15:57
@ecrupper ecrupper self-assigned this Sep 11, 2023
@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #480 (42fb8c0) into main (010e316) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #480   +/-   ##
=======================================
  Coverage   86.37%   86.37%           
=======================================
  Files         145      145           
  Lines        6310     6310           
=======================================
  Hits         5450     5450           
  Misses        704      704           
  Partials      156      156           
Files Changed Coverage Δ
command/deployment/add.go 90.00% <ø> (ø)
action/deployment/validate.go 100.00% <100.00%> (ø)

wass3rw3rk
wass3rw3rk previously approved these changes Sep 11, 2023
@ecrupper ecrupper changed the title enhance(deploy): remove default value for ref in add deployment command enhance(deploy)!: remove default value for ref in add deployment command Sep 11, 2023
wass3rw3rk
wass3rw3rk previously approved these changes Sep 11, 2023
Copy link
Member

@wass3rw3rk wass3rw3rk left a comment

Choose a reason for hiding this comment

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

looks good, this is also closer to how UI operates 👍🏼

action/deployment/validate.go Outdated Show resolved Hide resolved
action/deployment/validate.go Outdated Show resolved Hide resolved
},
&cli.StringFlag{
EnvVars: []string{"VELA_TARGET", "DEPLOYMENT_TARGET"},
Name: "target",
Aliases: []string{"t"},
Usage: "provide the name for the target deployment environment",
Value: "production",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you help me understand more about this change?

I ask because GitHub's default is production:

https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment

The environment parameter allows deployments to be issued to different runtime environments. Teams often have multiple environments for verifying their applications, such as production, staging, and qa. This parameter makes it easier to track which environments have requested deployments. The default environment is production.

Copy link
Member

@wass3rw3rk wass3rw3rk Sep 11, 2023

Choose a reason for hiding this comment

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

@ecrupper might chime in too, but it was mainly because we thought "production" was a bit too bold. i'm actually surprised it's the default value on GitHub's end.

there is also a case to be made to let SCM handle the default anyway? what if GitHub changes this on their end?

good news is.. since it's default on GitHub's end, leaving it blank will not impact the result?

as an aside, if we keep this change, we will want to update the UI code as well.

however, if we revert this - i wouldn't mind some comment to explain the choice there though i'd prefer to leave SCM-specific things out since we're trying to be SCM agnostic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I agree that we should just default to whatever the SCM's default is. I'm also surprised it's production.

As long as we're interpreting the target all the same (what we get in the payload), which it looks like we are, then this wouldn't even be breaking, I guess.

Copy link
Contributor

@jbrockopp jbrockopp left a comment

Choose a reason for hiding this comment

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

LGTM

@ecrupper ecrupper merged commit 5646f06 into main Sep 13, 2023
15 of 16 checks passed
@ecrupper ecrupper deleted the enhance/423/no-ref-default-deploy branch September 13, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

For deployments, use VELA_REPO_BRANCH instead of refs/heads/master by default
3 participants