Skip to content

Rename env var to BUILDKITE_STEP_CANCEL_FORCE_GRACE_PERIOD_SECONDS#3087

Merged
mitchbne merged 1 commit intomainfrom
rename-env-var-step-cancel-grace-period
Nov 12, 2024
Merged

Rename env var to BUILDKITE_STEP_CANCEL_FORCE_GRACE_PERIOD_SECONDS#3087
mitchbne merged 1 commit intomainfrom
rename-env-var-step-cancel-grace-period

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 requested a review from mhaylock November 12, 2024 02:06
@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.

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
Member

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 enabled auto-merge November 12, 2024 02:13
@mitchbne mitchbne disabled auto-merge November 12, 2024 02:14
@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
@mitchbne mitchbne enabled auto-merge November 12, 2024 03:16
@mitchbne mitchbne disabled auto-merge November 12, 2024 03:16
@mitchbne mitchbne enabled auto-merge November 12, 2024 03:16
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
Member

@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
@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