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

Make preferring runtime env default off #2747

Merged
merged 6 commits into from
Apr 30, 2024

Conversation

patrobinson
Copy link
Contributor

Description

In v3.63.0 we made a breaking change to how pipelines were parsed, specifically the precedence of environment variables in a pipeline upload step.

This undoes that breaking change to restore the original behaviour (see buildkite/go-pipeline#35)

Changes

The following pipeline example exhibits the breaking change (Credit to @lizrabuya for the reproducible test case).

Pipeline Steps:

env:
  HEADER_ENV: "123"

steps:
  - command:
      - buildkite-agent pipeline upload pipeline.yml

pipeline.yml:

env:
  HEADER_ENV: "789" 
  NEW_ENV: "NEW-${HEADER_ENV:-}"
steps: 
- label: "Fixed Values ENV: ${NEW_ENV}" 
  commands: echo "Checking fixed env values ${NEW_ENV} "
- label: "Fixed Values Runtime ENV"
  commands: echo "Checking fixed env values $${NEW_ENV} "

Prior to agent version v3.63.0 this pipeline printed Checking fixed env values NEW-789 for both the first and second command jobs.
As of v3.63.0 and above the steps now prints NEW-123.

This restores the original behaviour.

This PR also adds an experiment flag interpolation-prefers-runtime-env which enables the behaviour introduced in v3.63.0.

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 ./...)

internal/experiments/experiments.go Outdated Show resolved Hide resolved
internal/experiments/experiments.go Outdated Show resolved Hide resolved
@@ -46,7 +47,7 @@ const (
var (
Available = map[string]struct{}{
AgentAPI: {},
DescendingSpawnPrioity: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

Good find!

clicommand/pipeline_upload.go Outdated Show resolved Hide resolved
clicommand/pipeline_upload.go Outdated Show resolved Hide resolved
Co-authored-by: Josh <jd@buildkite.com>
Copy link
Contributor

@DrJosh9000 DrJosh9000 left a comment

Choose a reason for hiding this comment

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

✅✅

@patrobinson patrobinson merged commit e270140 into main Apr 30, 2024
1 check passed
@patrobinson patrobinson deleted the make-preferring-runtime-env-default-off branch April 30, 2024 05:13
@moskyb moskyb mentioned this pull request May 3, 2024
2 tasks
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.

None yet

2 participants