buildkite / buildkite/agent-stack-k8s

[BUG] `BUILDKITE_COMMIT` remains "HEAD" in build steps despite `resolve-commit-after-checkout` experiment

Open
#770 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
110
Forks
57
Avg merge
3d 8h
Merged PRs (30d)
5

Description

## Describe the bug

When using the `resolve-commit-after-checkout` experimental feature, the Buildkite agent logs indicate that `BUILDKITE_COMMIT` is being updated from "HEAD" to the resolved commit hash, but the environment variable is not actually available to build steps, which continue to see "HEAD".

## Steps to Reproduce

1. Deploy Buildkite Kubernetes stack version `0.35.0` with the following configuration:

```yaml
config:
agent-config:
experiment:
- "resolve-commit-after-checkout"
```

2. Run a build with the following pipeline steps:

```yaml
steps:
- label: testing
command:
- echo ${BUILDKITE_COMMIT}
- echo $${BUILDKITE_COMMIT}
```

## Expected behavior
The build steps should output the resolved commit hash instead of "HEAD".

## Environment
- agent-stack-k8s version: 0.35.0
- Kubernetes version: 1.34.1
- Deployment method: Helm chart

## Logs
```
# Using resolve-commit-after-checkout experiment 🧪
# Updating BUILDKITE_COMMIT from "HEAD" to "050ada53c89d97ff1b6fd77a754155f5115d2a51"
# Checking to see if git commit information needs to be sent to Buildkite...
$ /usr/local/bin/buildkite-agent meta-data exists buildkite:git:commit
# Sending Git commit information back to Buildkite
$ /usr/local/bin/buildkite-agent meta-data set buildkite:git:commit < /dev/stdin
```

## Additional context
The agent appears to be resolving the commit hash correctly (as evidenced by the log output), but the environment variable update is not being propagated to the build step execution environment. This suggests the variable is being set in a context that is not accessible to the build steps.

## Screenshots
`resolve-commit-after-checkout` working
Image

command output

Image

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.