feat(ci): point iOS PR preview at author's freighter-config sandbox (#859) - #947
Open
piyalbasu wants to merge 4 commits into
Open
feat(ci): point iOS PR preview at author's freighter-config sandbox (#859)#947piyalbasu wants to merge 4 commits into
piyalbasu wants to merge 4 commits into
Conversation
…859) Fetch the PR author's per-engineer sandbox URLs from the private stellar/freighter-config repo (via a read-only deploy key) and bake them into the iOS Simulator preview build, replacing the hardcoded staging URLs. - New "Fetch freighter-config" step runs right after checkout, before any PR-controlled code, and tears the deploy key down in-step. - New "Resolve backend URLs" step maps github login -> sandbox v1/v2 and writes them to $GITHUB_ENV (all three PROD/STG/DEV slots). The six backend URL keys are removed from job env to avoid $GITHUB_ENV precedence ambiguity. - Fallbacks: no config entry -> staging; freighter-config unreachable -> staging + `preview-degraded` label. Both explained in the sticky comment. - Release notes + sticky comment now state which backend the build targets. - Adds issues:write for create-if-missing of the preview-degraded label. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Routes iOS PR previews to each author’s sandbox backend, with staging fallback and backend labeling.
Changes:
- Fetches and resolves sandbox URLs from
freighter-config. - Adds degraded-state labeling and fallback routing.
- Reports the selected backend in releases and PR comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
iOS Simulator preview build is ready: https://github.com/stellar/freighter-mobile/releases/tag/untagged-ad7ef61925322c84ba40 |
Verifies sandbox URL resolution before stellar/freighter-config#1 merges. REVERT to plain `git clone --depth 1` (reads main) before merging #947. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tch) - Revert the temporary --branch feat/seed-config-schema-and-piyalbasu pin; the fetch now clones freighter-config's default branch (production behavior). - Replace StrictHostKeyChecking=accept-new (TOFU, no MITM protection on an ephemeral runner) with GitHub's published host keys fetched over TLS-authenticated HTTPS (api.github.com/meta) + StrictHostKeyChecking=yes; degrade to staging if keys can't be obtained. Parity with stellar/freighter#2917. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Validate freighter-config/config.json parses (jq empty) before marking it available, and make the resolve-step jq tolerant, so a malformed config degrades to staging instead of aborting the build under set -e. - Correct the fallback backend labels: V1 production + V2 staging, not "staging" wholesale (matches the routing actually baked in). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
TL;DR
Makes the iOS Simulator PR-preview build point at the PR author's own per-engineer sandbox backend instead of shared staging, by looking the author up in the
freighter-configmap at build time. If the author has no sandbox entry (or the map can't be read), the build falls back to public staging and says so — the preview is never broken, just clearly labeled. The release notes and sticky PR comment now state which backend the preview targets.Part of the Fullstack PR Preview Flow, Phase 2. Part of #859 (iOS scope). Android has no PR-preview workflow yet, so this PR does not auto-close #859 — Android is tracked as a separate follow-up.
Implementation details (for agents)
What changed — all in
.github/workflows/prPreviewIos.yml:Fetch freighter-configstep, placed immediately after checkout and before any PR-controlled code runs (scripts/display-ios-environment,scripts/gh-ios-env, yarn lifecycle hooks). It clones the privatestellar/freighter-configrepo over SSH using a read-only deploy key (secrets.FREIGHTER_CONFIG_DEPLOY_KEY), writesconfig.jsonto$RUNNER_TEMP, and tears the key down in-step (mode-600 tempfile +trap … EXIT). It never fails the build — an unreachable/malformed config just setsconfig_available=false.Resolve backend URLsstep mapspull_request.user.login→ sandboxv1/v2and writes the sixFREIGHTER_BACKEND_V{1,2}_{PROD,STG,DEV}_URLvalues to$GITHUB_ENV(all three slots set to the same value — mirrors the existing staging trick so runtime network-switching can't escape the target). Those six keys were removed from the job-levelenv:to avoid a job-env:-vs-$GITHUB_ENVprecedence ambiguity; they now live exclusively in this step.EnvFileCreator(lib/env_file_creator.rb) reads them from the process env when it materializes.env.preview-degradedlabel.gh label create … || true(create-if-missing), then add/remove so a fixed re-run self-corrects. Addedissues: writeto the build job solely for creating the label definition (add/remove on the PR is covered bypull-requests: write).BACKEND_DESC/BACKEND_NOTEto state the target (sandbox (piyalbasu)/staging — no sandbox configured/staging — freighter-config unreachable).Resolve logic:
freighter-mobile/.github/workflows/prPreviewIos.yml
Lines 177 to 246 in c7458a1
Security: unchanged posture —
pull_request-only + fork-guard, deploy key is read-only + scoped tofreighter-config+ torn down before PR code runs. Only new outbound is the SSH clone of one private repo. No backend is contacted (CI can't reach sandbox URLs behind the VPN; it only bakes the string).Verification: YAML validated (
yaml.safe_load) pre- and post-prettier; survived the repo pre-commit hook (lint-staged + jest). Full end-to-end verification (authorpiyalbasu→ sandbox URLs baked into.env) requires the two prerequisite PRs below to land first.Depends on (land in order):
stellar/terraform— registers the read-only deploy key onfreighter-config.stellar/freighter-config— addsconfig.jsonwith thepiyalbasuentry.(The
FREIGHTER_CONFIG_DEPLOY_KEYsecret is already set on this repo.)Follow-ups / out of scope: Android (
prPreviewAndroid.ymldoesn't exist yet) and the extensionprPreview.ymlmigration offsecrets.INDEXER_*— both reuse this same config map + deploy-key pattern.