Skip to content

docs(deploy): by-reference deploys, sealed credentials, CI token auth (draft) - #616

Draft
dawsontoth wants to merge 1 commit into
claude/two-phase-deploy-docsfrom
claude/deploy-by-ref-docs
Draft

docs(deploy): by-reference deploys, sealed credentials, CI token auth (draft)#616
dawsontoth wants to merge 1 commit into
claude/two-phase-deploy-docsfrom
claude/deploy-by-ref-docs

Conversation

@dawsontoth

Copy link
Copy Markdown
Contributor

Draft, and stacked on #599 — this PR targets claude/two-phase-deploy-docs, not main, so the diff shows only what's new. Merge #599 first and this will retarget to main on its own. Like #599 it tracks unmerged work, so hold merge until the CLI PRs land and confirm the version badges against the shipping release.

#599 documents the two-phase deploy and revert_component. This covers the rest of the deploy-by-reference workflow — how you point a cluster at a commit, how it authenticates to a private source, and how CI authenticates to the cluster.

Documents harper#1850 (by_ref), harper#1851 (deploy setup), and harper#1876 (CI token auth). add_ssh_key generate=true (harper-pro#594) is already covered by #599.

What this adds

reference/components/applications.md

  • Deploying by Referenceharper deploy by_ref=true, plus ref= and credential=. Leads with why: omitting package uploads an anonymous snapshot with no record of which commit it came from, so it can't be reproduced or stepped back from.

    Two things I made sure to call out explicitly, because both are quiet correctness traps:

    • A reference pins to a resolved SHA, not the tag or branch name you typed. Peers resolve the package independently, so a tag that moves mid-deploy — or a branch that advances — could otherwise leave nodes in a cluster running different code.
    • By-reference means the cluster builds from source. An app whose build can't run on the node should stay on payload deploys. (This is not hypothetical: it's exactly why create-harper's Next.js templates still deploy by payload — see create-harper#118.)
  • Provisioning a Deploy Credentialharper deploy setup=true: the client-side sealing flow, that the plaintext never reaches the operations API, that it needs custody (Pro/Fabric), and that reverting to the previous version needs no credential at all (it reuses the retained build rather than re-fetching).

reference/cli/authentication.md

  • Adds HARPER_CLI_REFRESH_TOKEN / HARPER_CLI_OPERATION_TOKEN to the supported variables, and a Token credentials for CI/CD section — so the CI recommendation is no longer "put an admin password in your pipeline". Covers precedence, the in-memory-only refresh, and token lifetimes (1d / 30d defaults).

  • ⚠️ Documents a sharp edge I hit while verifying this: a user holds only one valid refresh token at a time. create_authentication_tokens overwrites a single hashed refresh_token on the user record (security/tokenAuthentication.ts), so issuing a new one invalidates the last — meaning a routine local harper login silently breaks a pipeline authenticating as the same account. The docs now recommend giving CI its own user, which also scopes its permissions and makes revocation independent.

reference/cli/commands.md

  • harper login --for-ci, including the stdout/stderr split that makes harper login --for-ci | gh secret set --env-file - work without ever displaying the token.

reference/security/secrets.md

  • Points the existing Private-source deploy credentials section at the CLI flow that automates it.

Verification

  • Every anchor link in the changed files resolves (16 checked, including the pre-existing ones and the three new anchors other pages point at).
  • prettier --check clean on all four files.

Notes for review

Related — deploy-by-reference effort

  • HarperFast/documentation#599 — two-phase deploy docs (this PR's base)
  • HarperFast/harper#1849 — two-phase stage/activate + revert_component
  • HarperFast/harper#1850harper deploy by_ref=true
  • HarperFast/harper#1851harper deploy setup=true
  • HarperFast/harper#1876 — CI token auth + harper login --for-ci
  • HarperFast/harper-pro#594add_ssh_key generate=true
  • HarperFast/create-harper#118 — scaffolds this whole flow

🤖 Generated with Claude Code

Builds on the two-phase deploy docs (#599) to cover the rest of the
deploy-by-reference workflow.

reference/components/applications.md
- "Deploying by Reference" — `harper deploy by_ref=true`, `ref=`, `credential=`.
  Explains why a reference pins to a resolved SHA rather than the tag or branch
  name typed: peers resolve the package independently, so a tag that moves
  mid-deploy could otherwise leave nodes running different code. Notes that the
  cluster clones the pushed remote, and that by-reference means the cluster
  builds from source — so an app whose build can't run on the node should stay
  on payload deploys.
- "Provisioning a Deploy Credential" — `harper deploy setup=true`, the
  client-side sealing flow, and that reverting to the previous version needs no
  credential at all.

reference/cli/authentication.md
- Documents HARPER_CLI_REFRESH_TOKEN / HARPER_CLI_OPERATION_TOKEN and adds
  "Token credentials for CI/CD", so the CI guidance is no longer "put an admin
  password in your pipeline". Covers precedence, in-memory-only refresh, and
  token lifetimes (1d / 30d defaults).
- Warns that a user holds only ONE valid refresh token at a time: issuing a new
  one invalidates the last, so a routine local `harper login` silently breaks a
  pipeline using the same account. Hence the recommendation to give CI its own
  user. (Verified against security/tokenAuthentication.ts, which stores a single
  hashed refresh_token per user record.)

reference/cli/commands.md
- `harper login --for-ci`, including the stdout/stderr split that makes
  `| gh secret set --env-file -` work without displaying the token.

reference/security/secrets.md
- Points the existing private-source deploy credentials section at the CLI flow
  that automates it.

Documents HarperFast/harper#1850, #1851, and #1876. Verified every anchor link
in the changed files resolves (16 checked).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-616

This preview will update automatically when you push new commits.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the Harper CLI documentation to introduce features added in v5.2.0, including token-based credentials for CI/CD pipelines via harper login --for-ci, deploying components by git reference, and provisioning deploy credentials securely using client-side encryption. The review feedback correctly points out that the GitHub CLI (gh) does not support the --env-file flag used in the documentation examples, and provides a shell loop alternative to set multiple secrets from the command output.

Comment on lines +145 to +146
# Set both GitHub Actions secrets in one command — the token is never displayed
harper login --for-ci | gh secret set --env-file -

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.

medium

The gh secret set command in the GitHub CLI does not support a --env-file flag. To set multiple secrets from an environment file, you typically need to loop over the file's contents in your shell script or use a custom gh extension.

Consider providing a standard shell loop or pointing to the correct syntax for setting individual secrets.

Suggested change
# Set both GitHub Actions secrets in one command — the token is never displayed
harper login --for-ci | gh secret set --env-file -
# Set GitHub Actions secrets by looping over the env-file output
harper login --for-ci | while read -r line; do gh secret set "${line%%=*}" -b "${line#*=}"; done

Comment thread reference/cli/commands.md
Comment on lines +173 to +174
# Set both GitHub Actions secrets in one command
harper login --for-ci | gh secret set --env-file -

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.

medium

The gh secret set command in the GitHub CLI does not support a --env-file flag. To set multiple secrets from an environment file, you typically need to loop over the file's contents in your shell script or use a custom gh extension.

Consider providing a standard shell loop or pointing to the correct syntax for setting individual secrets.

Suggested change
# Set both GitHub Actions secrets in one command
harper login --for-ci | gh secret set --env-file -
# Set GitHub Actions secrets by looping over the env-file output
harper login --for-ci | while read -r line; do gh secret set "${line%%=*}" -b "${line#*=}"; done

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant