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

Rename env var to BUILDKITE_STEP_CANCEL_FORCE_GRACE_PERIOD_SECONDS #3087

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

mitchbne
Copy link
Member

@mitchbne mitchbne commented Nov 12, 2024

Description

Meant to include a3b8339 in #3084 but messed up the rebase. BUILDKITE_STEP_CANCEL_FORCE_GRACE_PERIOD_SECONDS feels like a better name for this env variable.

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go fmt ./...)

@mitchbne mitchbne self-assigned this Nov 12, 2024
@mitchbne mitchbne changed the title Rename env var to BUILDKITE_FORCE_CANCEL_GRACE_PERIOD Rename env var to BUILDKITE_FORCE_CANCEL_GRACE_PERIOD_SECONDS Nov 12, 2024
Copy link
Contributor

@mhaylock mhaylock left a comment

Choose a reason for hiding this comment

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

I think this is a good improvement (I did suggest it 😅).

My only hesitation is around whether its aligned with the rest of the agent that the ENV var name doesn't match the flag name 1:1.

@@ -74,7 +74,7 @@ var StepCancelCommand = cli.Command{
Name: "force-grace-period-seconds",
Value: defaultCancelGracePeriod,
Usage: "The number of seconds to wait for agents to finish uploading artifacts before transitioning unfinished jobs to a canceled state. ′--force′ must also be supplied for this to take affect",
EnvVar: "BUILDKITE_FORCE_GRACE_PERIOD_SECONDS,BUILDKITE_CANCEL_GRACE_PERIOD",
EnvVar: "BUILDKITE_FORCE_CANCEL_GRACE_PERIOD_SECONDS,BUILDKITE_CANCEL_GRACE_PERIOD",
Copy link
Contributor

Choose a reason for hiding this comment

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

@DrJosh9000, @wolfeidau is it ok that this environment variable doesn't 1:1 match the flag? It feels a bit redundant to include the work "cancel" in the flag name - but fairly important to have it in the global ENV var name.

Copy link
Contributor

Choose a reason for hiding this comment

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

We have some similar differences in other flags such as https://github.com/buildkite/agent/blob/main/clicommand/tool_sign.go#L123

Env vars are a global space so prefixing seems legit to me.

Copy link
Contributor

@mhaylock mhaylock Nov 12, 2024

Choose a reason for hiding this comment

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

I guess a legitimate prefix (that matches the command name) would technically be BUILDKITE_STEP_CANCEL_FORCE_GRACE_PERIOD_SECONDS.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's good - it's clear that this env var goes with this flag, and the flag belongs in the context of the command but the env var stands alone.

@mitchbne mitchbne force-pushed the rename-env-var-step-cancel-grace-period branch from 9786332 to 7f81f58 Compare November 12, 2024 03:15
@mitchbne mitchbne changed the title Rename env var to BUILDKITE_FORCE_CANCEL_GRACE_PERIOD_SECONDS Rename env var to BUILDKITE_STEP_CANCEL_FORCE_GRACE_PERIOD_SECONDS Nov 12, 2024
@@ -74,7 +74,7 @@ var StepCancelCommand = cli.Command{
Name: "force-grace-period-seconds",
Value: defaultCancelGracePeriod,
Usage: "The number of seconds to wait for agents to finish uploading artifacts before transitioning unfinished jobs to a canceled state. ′--force′ must also be supplied for this to take affect",
EnvVar: "BUILDKITE_FORCE_GRACE_PERIOD_SECONDS,BUILDKITE_CANCEL_GRACE_PERIOD",
EnvVar: "BUILDKITE_STEP_CANCEL_FORCE_GRACE_PERIOD_SECONDS,BUILDKITE_CANCEL_GRACE_PERIOD",
Copy link
Contributor

Choose a reason for hiding this comment

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

Even better 👍

Copy link
Contributor

@wolfeidau wolfeidau left a comment

Choose a reason for hiding this comment

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

👍🏻

@mitchbne mitchbne merged commit 41d34b0 into main Nov 12, 2024
1 check passed
@mitchbne mitchbne deleted the rename-env-var-step-cancel-grace-period branch November 12, 2024 03:54
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.

4 participants