Skip to content

[8.19] (backport #17397) fix: push release branches with git CLI - #18092

Merged
fr4nc1sc0-r4m0n merged 1 commit into
8.19from
mergify/bp/8.19/pr-17397
Nov 18, 2026
Merged

fr4nc1sc0-r4m0n merged 1 commit into
8.19from
mergify/bp/8.19/pr-17397

Conversation

@mergify

@mergify mergify Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Motivation

Build #24 of elastic-agent-version-bump got past the SSH/GITHUB_TOKEN auth mismatch from #17385, then hung for the rest of the job timeout on the first push of the new 9.6 branch. The checkout is a Buildkite --reference clone; 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: Bearer on git HTTPS is rejected for Vault/App tokens (remote: invalid credentials). The smoke harness already uses Basic x-access-token.

Summary

  • Replace go-git Push with native git push so reference clones can pack and upload.
  • Authenticate with http.extraHeader=Authorization: Basic for x-access-token:<token> (not Bearer).
  • Keep SSH→HTTPS remote rewrite before push.
  • Bound the push with a 10-minute timeout and log before/after so hangs are visible.
  • Allow file:// remotes for local unit tests; add a local bare-remote push test.
  • Point pre-merge docs at observability-robots ingest-release-smoke.

Related issues

Risk

  • Low: isolated change, no effect on Fleet connectivity, policy handling, or upgrades

Rationale

Native git already understands alternate object stores from reference clones (same reason SyncSubmodules shells out). Token auth stays on an HTTP header so the secret is not written into the remote URL. Basic x-access-token matches 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' — passed
  • Validated end-to-end on ingest-release-smoke build 9 (SOURCE_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 credentials
  • After merge, re-run elastic-agent-version-bump and confirm the same push logs without hanging

Validations

Local fork re-run of mage release:runMajorMinor / mage release:runPatch against fr4nc1sc0-r4m0n/elastic-agent (this PR branch, including git-CLI push).

Minor releases

runMajorMinor opens PR-A (main: next minor + mergify + docs/manifests) and PR-B (release branch ff-release). Next-patch bumps are not opened here; use mage release:runPatch.

Current (grouped) Former (elastic/elastic-agent) Role Status
fr4nc1sc0-r4m0n#43 #15424 + #15425 PR-A: next minor on main + backport rule + docs/manifests ✅ re-run 9.7.0
fr4nc1sc0-r4m0n#44 — (release branch content was not opened as a former bot PR) PR-B: ff-release on release branch ✅

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

Current (grouped) Former (elastic/elastic-agent) Role Status
fr4nc1sc0-r4m0n#45 #15000 PR-A: docs/manifests for CURRENT_RELEASE ✅ re-run 9.4.10
fr4nc1sc0-r4m0n#46 #14423 PR-B: next patch on release branch ✅

This is an automatic backport of pull request #17397 done by [Mergify](https://mergify.com).

* 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)
@mergify mergify Bot added the backport label Nov 18, 2026
@mergify
mergify Bot requested a review from a team as a code owner November 18, 2026 17:02
@mergify mergify Bot added the backport label Nov 18, 2026
@mergify
mergify Bot requested review from ycombinator and removed request for a team November 18, 2026 17:02
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod Bot added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog labels Nov 18, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@mergify mergify Bot mentioned this pull request Nov 18, 2026
1 task done
@mergify

mergify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is merged.

@fr4nc1sc0-r4m0n fr4nc1sc0-r4m0n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions

Copy link
Copy Markdown
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/44354112439

@fr4nc1sc0-r4m0n
fr4nc1sc0-r4m0n enabled auto-merge (squash) November 18, 2026 17:50
@fr4nc1sc0-r4m0n
fr4nc1sc0-r4m0n merged commit 6dc6037 into 8.19 Nov 18, 2026
112 of 114 checks passed
@fr4nc1sc0-r4m0n
fr4nc1sc0-r4m0n deleted the mergify/bp/8.19/pr-17397 branch November 18, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant