Skip to content

Publish static beta redirect artifacts#5603

Merged
kodjima33 merged 1 commit intomainfrom
codex/publish-static-beta-redirect
Mar 13, 2026
Merged

Publish static beta redirect artifacts#5603
kodjima33 merged 1 commit intomainfrom
codex/publish-static-beta-redirect

Conversation

@kodjima33
Copy link
Collaborator

Summary

  • publish static beta redirect files to the macOS updates GCS bucket during desktop release
  • write beta/index.html, beta/latest-url.txt, and beta/redirect.json
  • prepare macos.omi.me/beta for a static cutover off the backend

Notes

  • this does not change the live domain routing by itself; infra still needs to point /beta at the static artifact path

@kodjima33 kodjima33 merged commit febf149 into main Mar 13, 2026
@kodjima33 kodjima33 deleted the codex/publish-static-beta-redirect branch March 13, 2026 20:13
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR adds a new CI step to the macOS desktop release workflow that publishes three static redirect artifacts (beta/index.html, beta/redirect.json, beta/latest-url.txt) to the gs://omi_macos_updates GCS bucket on every tagged release. It also adds the GCS_DESKTOP_UPDATES_BUCKET environment variable. The artifacts are intended to enable a future static cutover of macos.omi.me/beta away from the backend, without changing live domain routing in this PR.

Key issues found:

  • Runtime failure on macOS bash 3.2: The heredoc at line 2447 uses ${BETA_DMG_URL@Q}, a bash 4.4+ parameter expansion (@Q = shell-quote). macOS ships /bin/bash at 3.2.57, which is the default shell for Codemagic macOS build agents. With set -e active, the bad substitution error will abort the entire step before any gcloud storage cp command runs — no artifacts will be published. Removing @Q and using ${BETA_DMG_URL} directly is the correct fix; the URL is a plain GitHub release asset URL with no characters that require escaping.
  • Missing --content-type for HTML upload: The index.html artifact is uploaded without an explicit --content-type="text/html; charset=utf-8" flag, which means the Unicode ellipsis in the <title> may be served with an incorrect encoding on some GCS/CDN configurations.

Confidence Score: 3/5

  • Not safe to merge as-is — the @Q bash substitution will cause the new step to abort silently on macOS CI, meaning zero artifacts are published despite the step appearing in the pipeline.
  • The change is narrowly scoped (one new CI step + one env var) and the logic is otherwise sound, but the ${BETA_DMG_URL@Q} syntax is bash 4.4+ only and will produce a bad substitution failure under the macOS system bash 3.2 environment that Codemagic defaults to. With set -e active the entire publish step silently fails on every release. This is a concrete runtime breakage of the feature being introduced, warranting a below-average confidence score.
  • codemagic.yaml — specifically the Publish static beta redirect artifacts script block (lines 2423–2481).

Important Files Changed

Filename Overview
codemagic.yaml Adds a new "Publish static beta redirect artifacts" step to the macOS desktop release workflow that writes beta/index.html, beta/redirect.json, and beta/latest-url.txt to GCS. Contains a bash 4.4-only @Q parameter expansion that will cause a bad substitution failure on the macOS system bash (3.2), preventing all three artifacts from being published.

Sequence Diagram

sequenceDiagram
    participant CM as Codemagic CI
    participant GH as GitHub Releases
    participant GCS as GCS Bucket (omi_macos_updates)
    participant Browser as End-User Browser

    CM->>GH: gh release create $CM_TAG (uploads omi.dmg + Omi.zip)
    CM->>CM: Generate index.html / redirect.json / latest-url.txt in /tmp
    CM->>GCS: gcloud storage cp → beta/index.html (no-store)
    CM->>GCS: gcloud storage cp → beta/redirect.json (no-store)
    CM->>GCS: gcloud storage cp → beta/latest-url.txt (no-store)
    Note over CM,GCS: ⚠️ Step aborts before any cp if bash<4.4 (@Q bad substitution)

    Browser->>GCS: GET macos.omi.me/beta (after infra cutover)
    GCS-->>Browser: 200 index.html (meta-refresh + JS redirect)
    Browser->>GH: Download omi.dmg from GitHub release asset URL
Loading

Last reviewed commit: b47bf11

Comment on lines +2466 to +2469
gcloud storage cp \
--cache-control="no-store,max-age=0" \
/tmp/macos-beta-index.html \
"$GCS_DESKTOP_UPDATES_BUCKET/beta/index.html"
Copy link
Contributor

Choose a reason for hiding this comment

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

Specify explicit --content-type for the HTML artifact

gcloud storage cp infers MIME type from the file extension by default, so index.html should get text/html. However, it won't automatically append ; charset=utf-8, which can cause browsers to fall back to a legacy encoding and potentially mishandle the Unicode ellipsis () in the <title>. Explicitly declaring the content-type is more robust:

Suggested change
gcloud storage cp \
--cache-control="no-store,max-age=0" \
/tmp/macos-beta-index.html \
"$GCS_DESKTOP_UPDATES_BUCKET/beta/index.html"
gcloud storage cp \
--cache-control="no-store,max-age=0" \
--content-type="text/html; charset=utf-8" \
/tmp/macos-beta-index.html \
"$GCS_DESKTOP_UPDATES_BUCKET/beta/index.html"

<body>
<p>Redirecting to the latest Omi Beta download.</p>
<p><a href="${BETA_DMG_URL}">If you are not redirected, click here.</a></p>
<script>window.location.replace(${BETA_DMG_URL@Q});</script>
Copy link
Contributor

Choose a reason for hiding this comment

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

@Q requires bash ≥ 4.4 — aborts on macOS system bash 3.2

The ${BETA_DMG_URL@Q} parameter transformation (@Q = shell-quote the value) was introduced in bash 4.4. macOS ships /bin/bash at version 3.2.57, which is the interpreter Codemagic macOS agents default to when running script: blocks. When bash 3.2 evaluates this heredoc and encounters @Q, it emits bad substitution and exits immediately. Because set -e is active at the top of the script, the entire step aborts — no index.html, redirect.json, or latest-url.txt is ever uploaded to GCS.

The quoting is also unnecessary: $BETA_DMG_URL is always a well-formed GitHub release asset URL containing no shell-special or JavaScript-special characters, so it is safe to embed directly. Drop the @Q transform:

Suggested change
<script>window.location.replace(${BETA_DMG_URL@Q});</script>
<script>window.location.replace("${BETA_DMG_URL}");</script>

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