Skip to content

fix(k8s): deploy-stack fetches a private Application repo - #5331

Merged
dan-petty merged 2 commits into
mainfrom
fix/5294-deploy-stack-fetches-a-private-application
Nov 13, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/5294-deploy-stack-fetches-a-private-application

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

render_at_revision gave git fetch only the SSH option. Thus git had no credential for a private repository on github.com, and the fetch failed with "could not read Username". The fetch now also gets the -c values of CONST_GIT_GITHUB_CREDENTIAL_CONFIG, as infra/repo_tree.py does. The empty helper value clears the helpers of the config files for github.com. Then gh auth git-credential gives git the token that the process runner pins on a git child that reaches a remote. The helper key names https://github.com, so a fetch from another host or over SSH does not change.

The homelab migration (#5120) moves the Applications ingress and mattermost to a private repository, and deploy-stack must render them until the override path goes. k8s/README.md says that the fetch uses the credential of the GitHub session and that the dry run fetches nothing.

Closes #5294

Change: openspec/changes/archive/2026-11-13-5294-deploy-stack-fetches-a-private-application/

render_at_revision gave git fetch only the SSH option, so git had no
credential for a private repository on github.com and failed with
"could not read Username". The fetch now also gets the -c values of
CONST_GIT_GITHUB_CREDENTIAL_CONFIG, as infra/repo_tree.py does. The
empty helper clears the helpers of the config files for github.com,
and gh auth git-credential reads the token that the process runner
pins on a git child that reaches a remote.

The helper key names https://github.com, so a fetch from another host
or over SSH does not change. k8s/README.md says that the fetch uses
the credential of the GitHub session and that the dry run fetches
nothing.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 13, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Checks

Fail-to-pass (AGENTS.md rule 4): uv run devops ci fail-to-pass --base origin/main (base 6d11eb013):

failed on base: tests.k8s.test_k8s_argocd_overrides::test_a_private_github_repository_is_fetched_with_the_credential_of_the_github_session (AssertionError: assert ([], True, ['...ory', 'main']) == (['', '!gh au...ory', 'main']))
failed on base: tests.k8s.test_k8s_argocd_overrides::test_only_the_fetch_gets_git_options_and_every_command_gets_only_the_prompt_switch (AssertionError: assert (['core.sshCo...ROMPT': '0'}]) == (['core.sshCo...ROMPT': '0'}]))
2 failed on base (2 failed and 13 passed in tests/k8s/test_k8s_argocd_overrides.py; 0 errored).

All 15 tests pass on the branch.

Scoped checks on the branch (at 6d11eb013 plus 2 commits):

  • uv run devops ci test tests/k8s/test_k8s_argocd_overrides.py: 15 passed.
  • uv run devops ci test src/devops_cli/k8s/argocd_overrides.py src/devops_cli/commands/k8s/stack_lifecycle.py: 816 passed.
  • uv run devops ci --check --only lint,format,typecheck,docs: all pass (mypy strict).
  • uv run devops openspec check: pass.
  • The pre-push hook: pass.

Premise on the real system (git 2.55.0): a direct call of render_at_revision through cluster_runtime._run_cmd, the runner of deploy-stack, on the private homelab repository.

  • Before the fix: fatal: could not read Username for 'https://github.com': terminal prompts disabled.
  • After the fix: the fetch and the checkout pass. Only kubectl kustomize stops, because that repository holds no kustomization yet (a later step of feat(infra): manage infra repos with devops infra #5120).
  • Control: the public devops-cli path k8s/overlays/homelab/ingress renders 10,920 bytes.

The check of the issue

The issue and step 5 of #5120 ask for the check "deploy-stack --stack infra --dry-run fetches an Application that names a private repository". That check cannot pass as written: the dry run lists the Applications and returns before _homelab_host_overrides runs (_render_deploy_stack_dry_run in commands/k8s/stack_lifecycle.py), and a dry run makes no request. The direct render_at_revision call above replaces it. The proposal ## Feasibility records this.

Render diff

No manifest changes. The only k8s/ file in the diff is k8s/README.md, and no kustomization.yaml under k8s/ names a README. Thus kubectl kustomize of each k8s/ path gives the same output at origin/main and at this branch, and Argo CD has nothing to sync from this change.

Notes for the host

For a private repository, the host that runs deploy-stack needs gh on PATH, because git calls gh auth git-credential. For a public repository GitHub asks for no credential, so git does not call the helper.

@dan-petty
dan-petty marked this pull request as ready for review November 13, 2026 01:48
@dan-petty
dan-petty merged commit b0e7c5d into main Nov 13, 2026
24 checks passed
@dan-petty
dan-petty deleted the fix/5294-deploy-stack-fetches-a-private-application branch November 13, 2026 02:14
dan-petty pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.125.3](v0.125.2...v0.125.3)
(2026-11-13)


### Bug Fixes

* **k8s:** deploy-stack fetches a private Application repo
([#5331](#5331))
([b0e7c5d](b0e7c5d))
* **telemetry:** keep one metric stream per workload
([#5324](#5324))
([0165669](0165669))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
dan-petty added a commit that referenced this pull request Nov 13, 2026
#5331 gave render_at_revision the GitHub credential of the session (#5294)
while this branch was open. The fetch of image-pins and the gate still adds
no credential of its own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): deploy-stack fetches a private Application repo

1 participant