Repository navigation
Conversation
Motivation: in Kubernetes mode the agent removes the kubernetes plugin from BUILDKITE_PLUGINS. If it was the only plugin, removeKubernetesPlugin returned "[]", so the caller's empty-string check did not delete the variable. The job executor counts any non-empty BUILDKITE_PLUGINS as plugins, so on an agent with plugins disabled (no-plugins, or no-local-hooks / no-command-eval, which imply it) the job failed before its command ran. Approach: return nil from removeKubernetesPlugin when no plugins remain, so the existing delete branch in the caller runs. Validation: added TestRemoveKubernetesPlugin. Without the fix its "only kubernetes plugin" case fails (got "[]", want ""); with the fix it passes. Also ran `go test ./agent` (pass) and `golangci-lint run ./agent/...` (0 issues). I did not run a live agent-stack-k8s job. Report: buildkite#4525 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Assisted-by: claude-sonnet-5-5 (via Claude Code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In Kubernetes mode the agent strips the
kubernetesplugin fromBUILDKITE_PLUGINS. When that was the step's only plugin,removeKubernetesPluginreturned[](fromjson.Marshal), so the caller's== ""check never deleted the variable andBUILDKITE_PLUGINSwas set to[]. The job executor treats any non-empty value as "has plugins", so an agent with plugins disabled (no-plugins, orno-local-hooks/no-command-evalwhich imply it) failed the job before its command ran.removeKubernetesPluginnow returns nil when no plugins remain, so the existing delete branch runs.Context
Fixes #4525
Changes
agent/job_runner.go: returnnil, nilfromremoveKubernetesPluginwhen the filtered list is empty; add a doc comment.agent/job_runner_test.go: addTestRemoveKubernetesPlugin(only k8s plugin, k8s plus another, no k8s plugin).Public documentation
Status: not needed
Testing
go test ./...). I rango test ./agent(passes), not the whole repo, andgolangci-lint run ./agent/...(0 issues). The new test fails without the fix ("[]"vs"") and passes with it. I did not run an end-to-end agent-stack-k8s job.go tool gofumpt -extra -w .)Affiliation (optional, external contributors)
Disclosures / Credits
Written with Claude Code (AI assistant), working from the cause and suggested fix described in the issue. I did not run a live agent-stack-k8s job.
Fixes #4525