Skip to content

feat(arc): let the App setup write the App Secret and remove the key - #14

Merged
Mearman merged 1 commit into
mainfrom
feat/arc-app-setup-writes-secret
Sep 26, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/arc-app-setup-writes-secret

Conversation

@Mearman

@Mearman Mearman commented Sep 26, 2026

Copy link
Copy Markdown
Member

Closes #11

With github_runner_arc_app_setup_write_secret: true, the second run of playbooks/github_app_setup.yml writes the App Secret once the App is installed. The Secret has the three keys the role's install reads, github_app_id, github_app_installation_id and github_app_private_key. After writing it, the run deletes the key file unless github_runner_arc_app_setup_keep_private_key is set. The Secret goes into github_runner_arc_app_setup_secret_namespaces under github_runner_arc_app_setup_secret_name. When those aren't set, it goes into the namespaces of the organisation's scale-set profiles in github_runner_arc_orgs, under its app_secret_name (<org>-github-app by default), matching what the install expects. The run reaches the cluster through github_runner_arc_kubeconfig_path and creates those namespaces before it uses the one-time code, so a broken cluster path only costs a rerun. If the run stops before the Secret is written, for example because nobody installed the App in time, the key file is left so the App can still be finished without a new code.

github_runner_arc_app_setup_command is the phase 2 command shown in the rendered form and in phase 1's instructions. The role adds the code and key path to it. By default it's the same command as before. A playbook that wraps the flow sets it to its own command, so the form tells the person to run the wrapper and not the collection's playbook. The README has an example wrapper.

It never prints the private key now. The code exchange wasn't no_log, so its error would be visible, but that meant -v printed the key from the successful response. The exchange is now no_log, and a separate task reports GitHub's status and message when the exchange fails.

Nothing changes by default: writing the Secret is off, and the default command renders the same form as before. tests/unit/test_app_setup.py runs phase 1 of the real playbook (no GitHub or cluster involved) and checks the default form text, a wrapper's command in the form and the instructions, the keep-key wording, where the Secret would go (explicit namespaces, or the org's profiles), and that asking to write the Secret with nowhere to put it fails in phase 1. Phase 2 can't run without a real manifest code, so the Secret write and key removal aren't exercised by a test. They use the same kubernetes.core.k8s and file tasks the rest of the role uses. arc.yml --check --diff against a fleet gave the same task list and result as v1.1.0.

With github_runner_arc_app_setup_write_secret, phase 2 of
playbooks/github_app_setup.yml writes github_app_id,
github_app_installation_id and github_app_private_key into the App
Secret once the App is installed, then removes the key file unless
github_runner_arc_app_setup_keep_private_key keeps it. The Secret goes
into github_runner_arc_app_setup_secret_namespaces under
github_runner_arc_app_setup_secret_name, or by default into the
organisation's profile namespaces under its app_secret_name. The
cluster is reached and the namespaces created before the one-time
code is used.

github_runner_arc_app_setup_command names the phase 2 command in the
form and in phase 1's instructions, so a playbook wrapping the flow
names itself. The code exchange is now no_log, since its response
holds the private key that -v used to print; GitHub's error is
reported by a separate task instead.
@Mearman
Mearman marked this pull request as ready for review September 26, 2026 03:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-26T03:37:17.806366Z 9218294 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit 7f64f21 into main Sep 26, 2026
10 checks passed
@Mearman
Mearman deleted the feat/arc-app-setup-writes-secret branch September 26, 2026 03:55
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let the App setup flow write the App Secret and remove the key file

1 participant