Repository navigation
[9.5] (backport #17397) fix: push release branches with git CLI - #18090
Merged
Merged
Conversation
* fix: push release branches with git CLI go-git Push hangs on Buildkite reference clones after HTTPS auth is fixed. Use native git with a Bearer token and a push timeout. * docs: point release mage authors at playground smoke Document how to run the Buildkite release smoke before merging changes under dev-tools/mage/release. DRY_RUN alone is not enough. * fix: use Basic auth for git CLI release pushes GitHub git-over-HTTPS rejects Bearer for Vault/App tokens. Match ingest-release-smoke Basic x-access-token; cite smoke build 8. * fix: silence gosec G204 on release git CLI push Fixed git binary; remote and refSpec come from local repo state. Token is only passed in the Basic auth header. * fix: pass git push auth via GIT_CONFIG env Avoid gosec G204 without nolint by keeping argv literal (git push origin HEAD) and injecting Basic auth through GIT_CONFIG_* instead of http.extraHeader on the command line. * release: use [Release][version] PR title prefix Align generated bump PR titles with a shared [Release][<version>] prefix so feature-freeze PRs are easy to group. * fix: harden release git push timeout and auth env Bound CombinedOutput with WaitDelay after context cancel, clear conflicting github.com extraHeaders before setting Basic auth, and disable interactive git prompts. * test: use testify in mage release package tests Align the release mage package tests with the repo preference for require/assert. (cherry picked from commit 0c2f24f)
1 task done
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Contributor
Author
|
This pull request is merged. |
Contributor
|
Dependency review finished without posting an analysis comment. If you expected a review, push a new commit to this pull request (or close and reopen it) to try again. Workflow run: https://github.com/elastic/elastic-agent/actions/runs/44354060188 |
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.
Motivation
Build #24 of elastic-agent-version-bump got past the SSH/
GITHUB_TOKENauth mismatch from #17385, then hung for the rest of the job timeout on the first push of the new9.6branch. The checkout is a Buildkite--referenceclone; go-git can read alternates after #17358 but its Push path never returns. Version bumps still cannot publish release branches or open PRs.Ingest-release-smoke build 8 then showed that
Authorization: Beareron git HTTPS is rejected for Vault/App tokens (remote: invalid credentials). The smoke harness already uses Basicx-access-token.Summary
Pushwith nativegit pushso reference clones can pack and upload.http.extraHeader=Authorization: Basicforx-access-token:<token>(not Bearer).file://remotes for local unit tests; add a local bare-remote push test.Related issues
Risk
Rationale
Native git already understands alternate object stores from reference clones (same reason
SyncSubmodulesshells out). Token auth stays on an HTTP header so the secret is not written into the remote URL. Basicx-access-tokenmatches GitHub git-over-HTTPS and the ingest-release-smoke harness.Rollout and safety
N/A — release tooling only; does not change the agent runtime or Fleet path.
Testing
go test ./dev-tools/mage/release/ -count=1 -run 'TestPush|TestEnsureHTTPS|TestGithubHTTPS|TestGitHTTPSAuth'— passedSOURCE_SHA=d3b61c62): major-minor and patch both completed; all git CLI pushes succeeded (9.6,ff-prep-main-9.6.0,ff-release-9.6.0,ff-prep-next-patch-9.6.1,patch-release-9.6.0) with no invalid credentialsValidations
Local fork re-run of
mage release:runMajorMinor/mage release:runPatchagainstfr4nc1sc0-r4m0n/elastic-agent(this PR branch, including git-CLI push).Minor releases
runMajorMinoropens PR-A (main: next minor + mergify + docs/manifests) and PR-B (release branch ff-release). Next-patch bumps are not opened here; usemage release:runPatch.main+ backport rule + docs/manifestsPatch releases
This branch still uses the pre–ingest-dev#10200 patch shape: docs before build, then next-patch version after release. (#17835 aligns patch to a single bump PR.)
This is an automatic backport of pull request #17397 done by [Mergify](https://mergify.com).