Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

chore: 停用阿里云镜像,桌面端检查更新少一次注定失败的往返

lmliheng5e9f2452a014
diff --git a/.github/workflows/oss-staging.yml b/.github/workflows/oss-staging.yml
deleted file mode 100644
index c5acd4e7..00000000
--- a/.github/workflows/oss-staging.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-name: Test Alibaba Cloud OSS publishing
-
-on:
- workflow_dispatch:
-
-jobs:
- staging:
- name: Verify GitHub OIDC staging access
- runs-on: ubuntu-latest
- permissions:
- contents: read
- id-token: write
- environment:
- name: oss-staging
- steps:
- - uses: actions/checkout@v5
-
- - name: Validate OSS environment configuration
- env:
- ALIYUN_OIDC_PROVIDER_ARN: ${{ vars.ALIYUN_OIDC_PROVIDER_ARN }}
- ALIYUN_ROLE_ARN: ${{ vars.ALIYUN_ROLE_ARN }}
- OSS_BUCKET: ${{ vars.OSS_BUCKET }}
- OSS_REGION: ${{ vars.OSS_REGION }}
- OSS_ENDPOINT: ${{ vars.OSS_ENDPOINT }}
- OSS_PUBLIC_BASE_URL: ${{ vars.OSS_PUBLIC_BASE_URL }}
- run: |
- set -eu
- for name in ALIYUN_OIDC_PROVIDER_ARN ALIYUN_ROLE_ARN OSS_BUCKET OSS_REGION OSS_ENDPOINT OSS_PUBLIC_BASE_URL; do
- eval "value=\${$name:-}"
- if [ -z "$value" ]; then
- echo "error: $name is not configured in the oss-staging environment" >&2
- exit 1
- fi
- done
-
- - name: Download and verify ossutil
- run: |
- sh scripts/install-ossutil.sh "$RUNNER_TEMP/ossutil-bin"
- echo "$RUNNER_TEMP/ossutil-bin" >> "$GITHUB_PATH"
-
- - name: Exchange GitHub OIDC token for Alibaba Cloud credentials
- id: aliyun
- uses: aliyun/configure-aliyun-credentials-action@1e5248c8d5d93a8781ac344a68e19a43341e79e6
- with:
- oidc-provider-arn: ${{ vars.ALIYUN_OIDC_PROVIDER_ARN }}
- role-to-assume: ${{ vars.ALIYUN_ROLE_ARN }}
- role-session-name: penguin-oss-staging-${{ github.run_id }}
- role-session-expiration: 1800
- audience: github-actions
-
- - name: Verify staging access boundaries
- env:
- OSS_ACCESS_KEY_ID: ${{ steps.aliyun.outputs['aliyun-access-key-id'] }}
- OSS_ACCESS_KEY_SECRET: ${{ steps.aliyun.outputs['aliyun-access-key-secret'] }}
- OSS_SESSION_TOKEN: ${{ steps.aliyun.outputs['aliyun-security-token'] }}
- OSS_BUCKET: ${{ vars.OSS_BUCKET }}
- OSS_REGION: ${{ vars.OSS_REGION }}
- OSS_ENDPOINT: ${{ vars.OSS_ENDPOINT }}
- OSS_PUBLIC_BASE_URL: ${{ vars.OSS_PUBLIC_BASE_URL }}
- run: sh scripts/test-oss-staging.sh
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9a30963d..9dbdfacf 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,7 +1,7 @@
# Release: tag v* -> build the one-line install artifacts and publish a GitHub Release.
# Releases are immutable: once published, assets can never be replaced. A tiny check-release
# job therefore gates the release job on the tag's Release not existing yet — dispatching an
-# already-released tag skips the GitHub build/upload while still retrying the OSS mirror and npm publishing.
+# already-released tag skips the GitHub build/upload while still retrying npm publishing.
# Release jobs (the release job is gated on the existence check):
# - release: build the monorepo -> pnpm deploy a production CLI dir -> assemble penguin/ (bin + lib + web)
# -> one program payload per target (four platform payloads bundling the official Node runtime,
@@ -35,10 +35,8 @@
# that failed mid-chain can be re-run as-is after fixing the config.
# npm publishing lives here rather than a separate `on: release: published` workflow: the Release is created
# by this workflow's GITHUB_TOKEN, and GitHub won't trigger other workflows' release events from that.
-# - mirror-oss: download the exact GitHub Release assets, verify their checksums, then mirror the same bytes
-# to immutable releases/<tag>/ keys in Alibaba Cloud OSS through GitHub OIDC. The GitHub Environment
-# `oss-production` supplies the provider/role ARNs and OSS settings. latest.json is uploaded last and only
-# when the tag is still GitHub's current latest Release. Manual retries also work after a Release exists.
+# The Release assets are the only distribution: this fork retired the Alibaba Cloud OSS mirror
+# (2026-10-17), so nothing is copied anywhere after the upload.
# - docker: build and push the official image (Docker Hub hiyouga/penguinharness, linux/amd64 +
# linux/arm64) from the tag's own source, independently of npm. The build/publish steps live in
# docker.yml, which the same PR-time smoke job exercises and which also publishes `latest` from
@@ -70,7 +68,7 @@ env:
jobs:
# Skip the build/upload when the tag's Release already exists (immutable releases forbid
- # replacing assets, so re-uploading can only fail; OSS mirroring and npm publishing are idempotent).
+ # replacing assets, so re-uploading can only fail; npm publishing is idempotent).
check-release:
runs-on: ubuntu-latest
permissions:
@@ -133,7 +131,7 @@ jobs:
run: pnpm install --frozen-lockfile
# Inject the release tag into core's VERSION constant (the source for CLI --version and the install-complete
- # message) and both standalone installers. The stamped installers then select the same immutable OSS/GitHub
+ # message) and both standalone installers. The stamped installers then select the same immutable GitHub
# release when run directly. BUILD_DATE is stamped alongside core with this run's UTC date.
- name: Stamp release version
env:
@@ -350,8 +348,7 @@ jobs:
# Desktop artifacts built by the desktop job (three-OS matrix): installers plus the
# latest*.yml metadata and .blockmap files electron-updater needs. They are collected
# here so they are part of the Release's initial (immutable) asset set. Their checksums
- # go in a separate SHA256SUMS.desktop, which is also how the OSS mirror script verifies
- # them.
+ # go in a separate SHA256SUMS.desktop.
- name: Collect desktop artifacts
uses: actions/download-artifact@v4
with:
@@ -432,98 +429,6 @@ jobs:
install.sh
install.ps1
- mirror-oss:
- name: Mirror GitHub Release to Alibaba Cloud OSS
- needs: [check-release, release]
- if: >-
- ${{ always() && needs.check-release.result == 'success' &&
- (needs.release.result == 'success' || needs.release.result == 'skipped') }}
- runs-on: ubuntu-latest
- concurrency:
- group: penguin-oss-production
- cancel-in-progress: false
- permissions:
- contents: read
- id-token: write
- environment:
- name: oss-production
- url: ${{ vars.OSS_PUBLIC_BASE_URL }}
- steps:
- # On workflow_dispatch, use the selected branch's current mirror scripts while downloading
- # the requested tag's immutable Release assets. A tag push naturally checks out that tag.
- - uses: actions/checkout@v5
-
- - name: Validate OSS environment configuration
- env:
- ALIYUN_OIDC_PROVIDER_ARN: ${{ vars.ALIYUN_OIDC_PROVIDER_ARN }}
- ALIYUN_ROLE_ARN: ${{ vars.ALIYUN_ROLE_ARN }}
- OSS_BUCKET: ${{ vars.OSS_BUCKET }}
- OSS_REGION: ${{ vars.OSS_REGION }}
- OSS_ENDPOINT: ${{ vars.OSS_ENDPOINT }}
- OSS_PUBLIC_BASE_URL: ${{ vars.OSS_PUBLIC_BASE_URL }}
- run: |
- set -eu
- for name in ALIYUN_OIDC_PROVIDER_ARN ALIYUN_ROLE_ARN OSS_BUCKET OSS_REGION OSS_ENDPOINT OSS_PUBLIC_BASE_URL; do
- eval "value=\${$name:-}"
- if [ -z "$value" ]; then
- echo "error: $name is not configured in the oss-production environment" >&2
- exit 1
- fi
- done
-
- - name: Download and verify ossutil
- run: |
- sh scripts/install-ossutil.sh "$RUNNER_TEMP/ossutil-bin"
- echo "$RUNNER_TEMP/ossutil-bin" >> "$GITHUB_PATH"
-
- # Pinned v1 commit. audience must match the client ID configured on the Alibaba Cloud
- # OIDC provider; this project deliberately uses `github-actions`.
- - name: Exchange GitHub OIDC token for Alibaba Cloud credentials
- id: aliyun
- uses: aliyun/configure-aliyun-credentials-action@1e5248c8d5d93a8781ac344a68e19a43341e79e6
- with:
- oidc-provider-arn: ${{ vars.ALIYUN_OIDC_PROVIDER_ARN }}
- role-to-assume: ${{ vars.ALIYUN_ROLE_ARN }}
- role-session-name: penguin-oss-${{ github.run_id }}
- role-session-expiration: 1800
- audience: github-actions
-
- - name: Download exact GitHub Release assets
- env:
- GH_TOKEN: ${{ github.token }}
- TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
- run: |
- mkdir -p release-assets
- gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null
- gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir release-assets
-
- - name: Determine whether the tag is the latest Release
- id: latest
- env:
- GH_TOKEN: ${{ github.token }}
- TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
- run: |
- LATEST_TAG="$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName --jq .tagName)"
- if [ "$TAG" = "$LATEST_TAG" ]; then
- echo "update=true" >> "$GITHUB_OUTPUT"
- else
- echo "update=false" >> "$GITHUB_OUTPUT"
- echo "$TAG will be mirrored without replacing latest.json (current latest: $LATEST_TAG)."
- fi
-
- - name: Mirror and verify OSS objects
- env:
- TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
- GH_TOKEN: ${{ github.token }}
- OSS_ACCESS_KEY_ID: ${{ steps.aliyun.outputs['aliyun-access-key-id'] }}
- OSS_ACCESS_KEY_SECRET: ${{ steps.aliyun.outputs['aliyun-access-key-secret'] }}
- OSS_SESSION_TOKEN: ${{ steps.aliyun.outputs['aliyun-security-token'] }}
- OSS_BUCKET: ${{ vars.OSS_BUCKET }}
- OSS_REGION: ${{ vars.OSS_REGION }}
- OSS_ENDPOINT: ${{ vars.OSS_ENDPOINT }}
- OSS_PUBLIC_BASE_URL: ${{ vars.OSS_PUBLIC_BASE_URL }}
- run: sh scripts/publish-release-to-oss.sh release-assets "$TAG" "${{ steps.latest.outputs.update }}"
-
publish-npm:
name: Publish npm packages
runs-on: ubuntu-latest
@@ -686,8 +591,8 @@ jobs:
done
# The image is built from the tag's source and installs nothing from npm, so this no longer waits
- # for publish-npm. It is gated like mirror-oss, because a dispatch of an already-released tag must
- # still be able to (re)publish the image: `release` skipped is as good as `release` succeeded.
+ # for publish-npm. It is gated on the Release the same way, because a dispatch of an already-released
+ # tag must still be able to (re)publish the image: `release` skipped is as good as `release` succeeded.
docker:
name: Publish the official Docker image
needs: [check-release, release]
diff --git a/README.md b/README.md
index 1b326f6f..dc21dbea 100644
--- a/README.md
+++ b/README.md
@@ -144,10 +144,10 @@ and local models with a custom endpoint.
## Install
Adelie ships its own artifacts — desktop installers, CLI bundles and npm packages, every release on
-[GitHub Releases](https://github.com/lmliheng/Adelie/releases) with the same assets mirrored to an
-Alibaba Cloud OSS bucket (`https://adelie-releases.oss-cn-hangzhou.aliyuncs.com`) for readers in
-China. A release is always a whole version: the desktop app, the CLI, the server and the Web frontend
-are the same number.
+[GitHub Releases](https://github.com/lmliheng/Adelie/releases). That is the only place they are
+published: the Alibaba Cloud OSS mirror this fork used to keep was retired, so there is one address
+to check and it is always current. A release is always a whole version: the desktop app, the CLI,
+the server and the Web frontend are the same number.
### Desktop app
@@ -158,9 +158,8 @@ are the same number.
| macOS | not built yet — the dmg/zip targets wait for an Apple Developer ID |
The Windows installer is **not code-signed yet**, so SmartScreen shows its warning once
-("More info → Run anyway"). The app checks for updates itself: it reads the OSS mirror's
-`latest.yml` first and falls back to GitHub Releases when the mirror is unreachable, so
-"Check for updates" inside the app is the normal way to upgrade.
+("More info → Run anyway"). The app checks for updates itself against this repo's GitHub Releases,
+so "Check for updates" inside the app is the normal way to upgrade.
### Command line and Web App
diff --git a/README.zh.md b/README.zh.md
index 9c757aa3..3c3e7e69 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -125,8 +125,8 @@ Adelie 运行在你的电脑或服务器上,自动串联 Agent 应用的创建
## 安装
Adelie 有自己的产物:桌面安装包、命令行包与 npm 包,每次发布都在
-[GitHub Releases](https://github.com/lmliheng/Adelie/releases) 上,同一份资产也镜像到阿里云 OSS
-(`https://adelie-releases.oss-cn-hangzhou.aliyuncs.com`,给国内的读者)。一次发布是一个整体版本:
+[GitHub Releases](https://github.com/lmliheng/Adelie/releases) 上。**只有这一处**:这个仓库以前
+挂的阿里云 OSS 镜像已经停用,所以只有一条地址要看,而且它始终是最新的。一次发布是一个整体版本:
桌面端、命令行、服务端与 Web 前端同号。
### 桌面应用
@@ -138,8 +138,7 @@ Adelie 有自己的产物:桌面安装包、命令行包与 npm 包,每次
| macOS | 还没打 —— dmg / zip 目标在等一张 Apple 开发者证书 |
Windows 安装包**还没有代码签名**,SmartScreen 会提示一次(「更多信息 → 仍要运行」)。应用自己会
-检查更新:先读 OSS 镜像上的 `latest.yml`,镜像不通时回退到 GitHub Releases —— 升级走应用里的
-「检查更新」就行。
+检查更新,读的就是这个仓库的 GitHub Releases —— 升级走应用里的「检查更新」就行。
### 命令行与 Web App
diff --git a/changelog/unreleased/2026-10-17-drop-oss-mirror.md b/changelog/unreleased/2026-10-17-drop-oss-mirror.md
new file mode 100644
index 00000000..6630085f
--- /dev/null
+++ b/changelog/unreleased/2026-10-17-drop-oss-mirror.md
@@ -0,0 +1,36 @@
+# The Alibaba Cloud mirror is gone: one release address, always current
+
+- **Date:** 2026-10-17
+- **Type:** process
+- **Scope:** `desktop`, `ci`, `docs`
+
+[中文版](2026-10-17-drop-oss-mirror.zh.md)
+
+Every release is published to `lmliheng/Adelie`'s GitHub Releases and nowhere else. The desktop app
+checks for updates there directly, and the release pipeline no longer has a step that copies
+anything to Alibaba Cloud OSS.
+
+## Why
+
+That mirror was Adelie's own bucket, and its account was disabled upstream of this repository
+(`UserDisable` on every request since v0.3.5). A mount pointed at a bucket nobody can write is worse
+than no mount: the release chain had a step that could only fail, and the desktop app's default
+update feed answered 403 before every check fell back to GitHub. The user retired it outright
+(2026-10-17), so the code follows the decision.
+
+## What changed
+
+- `packages/desktop/src/update-support.ts`: `MIRROR_FEED_URL` and `fallsBackToGithub` are gone. A
+ check starts from GitHub Releases, or from `PENGUIN_UPDATE_FEED_URL` when one is set — a
+ deployment running a mirror of its own still points that at itself. What changed for a user of the
+ packaged app is one round-trip that no longer happens first.
+- `packages/desktop/src/updater.ts`: the fallback path in `handleCheckError` is gone with it, and so
+ is the feed kind it keyed on; a failed check is reported where it was asked for.
+- `.github/workflows/release.yml`: the `mirror-oss` job is removed, along with the OSS sentences in
+ its header.
+- Removed: `.github/workflows/oss-staging.yml`, `scripts/publish-release-to-oss.sh`,
+ `scripts/install-ossutil.sh`, `scripts/test-oss-staging.sh`.
+- `README.md` / `README.zh.md` no longer promise a China mirror.
+
+The installers were already GitHub-only (`PENGUIN_DOWNLOAD_SOURCE=auto|github`, with `oss` rejected
+outright), so nothing about downloading or installing changes.
diff --git a/changelog/unreleased/2026-10-17-drop-oss-mirror.zh.md b/changelog/unreleased/2026-10-17-drop-oss-mirror.zh.md
new file mode 100644
index 00000000..26f9aebc
--- /dev/null
+++ b/changelog/unreleased/2026-10-17-drop-oss-mirror.zh.md
@@ -0,0 +1,32 @@
+# 阿里云镜像下线:发布只剩一个地址,而且它一直是最新的
+
+- **Date:** 2026-10-17
+- **Type:** process
+- **Scope:** `desktop`, `ci`, `docs`
+
+[English](2026-10-17-drop-oss-mirror.md)
+
+每次发布只挂在 `lmliheng/Adelie` 的 GitHub Releases 上,别处没有。桌面端直接去那里检查更新,
+发布流水线里也不再有「把资产拷到阿里云 OSS」这一步。
+
+## 为什么
+
+那面镜像是这个仓库自己的桶,而它的账号在本仓库之外就被停用了(v0.3.5 起每个请求都返回
+`UserDisable`)。挂一面谁都没法写的镜像比不挂更糟:发布链里因此多了一步只会失败的作业,桌面端
+默认的更新源每次检查都先撞一次 403 才回退到 GitHub。用户 2026-10-17 决定不再使用它,代码跟上
+这个决定。
+
+## 改了什么
+
+- `packages/desktop/src/update-support.ts`:`MIRROR_FEED_URL` 与 `fallsBackToGithub` 删除。检查
+ 从 GitHub Releases 开始,设了 `PENGUIN_UPDATE_FEED_URL` 就从那里开始 —— 自建镜像的部署仍然把
+ 它指向自己。对装了桌面端的用户,变化是**少了一次注定失败的往返**。
+- `packages/desktop/src/updater.ts`:`handleCheckError` 里的回退随之删除,它依赖的 feed 类型也一
+ 并去掉;检查失败就在被问到的地方如实报出来。
+- `.github/workflows/release.yml`:删掉 `mirror-oss` 作业,以及文件头里讲它的那几句。
+- 一并删除:`.github/workflows/oss-staging.yml`、`scripts/publish-release-to-oss.sh`、
+ `scripts/install-ossutil.sh`、`scripts/test-oss-staging.sh`。
+- `README.md` / `README.zh.md` 不再承诺国内镜像。
+
+两个安装脚本本来就只认 GitHub(`PENGUIN_DOWNLOAD_SOURCE=auto|github`,`oss` 会被明确拒绝),
+所以下载与安装这条路没有任何变化。
diff --git a/docs/FORK.md b/docs/FORK.md
index 16f80a86..8f7787b8 100644
--- a/docs/FORK.md
+++ b/docs/FORK.md
@@ -59,6 +59,10 @@ git merge upstream/develop # 在 main 上
只剩 GitHub,`PENGUIN_DOWNLOAD_SOURCE=oss`(CLI 与两个安装脚本)会被明确拒绝而不是默默回落到
auto。桌面端的「速度探测 + 镜像 feed」子系统与安装脚本里的 `SPEED_PROBE_*` 整套也一并删掉了;
自建镜像改用自己的 base URL / feed(`PENGUIN_DOWNLOAD_BASE_URL`、`PENGUIN_UPDATE_FEED_URL`)。
+ 2026-10-06 一度重新上线过一版 Adelie 自己的阿里云镜像(发布链 `mirror-oss` 作业 +
+ `scripts/publish-release-to-oss.sh` + 桌面端默认 feed),**2026-10-17 用户决定不再使用 OSS**,
+ 那条路连同 `oss-staging` 工作流与三个 ossutil 脚本一起删掉:发布资产只挂 GitHub Release,
+ 桌面端更新源默认就是 GitHub Releases(`MIRROR_FEED_URL` 与「探不通再回退」的那套判断一并移除)。
- **模型库里没有「官方推荐」了**。上游把 TokenDance 分组标为 `recommended` 并在模型库页面挂
「官方推荐 / Recommended」标签;Adelie 删掉了这个标记(推荐哪家网关是上游的商业选择,不是我们
的)。分组的默认顺序没有变。
diff --git a/packages/desktop/src/update-support.ts b/packages/desktop/src/update-support.ts
index 5c0dac57..f2e99c45 100644
--- a/packages/desktop/src/update-support.ts
+++ b/packages/desktop/src/update-support.ts
@@ -51,7 +51,7 @@ export function feedUrlOverride(env: NodeJS.ProcessEnv): string | null {
/**
* Adelie's own GitHub Releases, where the release assets are published: the source of truth, and
- * the feed a check falls back to when the mirror does not answer.
+ * the feed every check reads.
*/
export const GITHUB_FEED = {
provider: "github" as const,
@@ -62,32 +62,14 @@ export const GITHUB_FEED = {
/** The human-facing page the same feed belongs to (the error dialog's "Open Releases"). */
export const RELEASES_URL = "https://github.com/lmliheng/Adelie/releases";
-/**
- * The Alibaba Cloud OSS mirror of those assets — the same bytes, served from `latest/` under
- * version-less names (see `scripts/publish-release-to-oss.sh`). It is the default feed, not a
- * replacement: Adelie's users are in China, where github.com is slow to unusable, and a check
- * that cannot reach the mirror goes to GitHub Releases instead.
- */
-export const MIRROR_FEED_URL = "https://adelie-releases.oss-cn-hangzhou.aliyuncs.com/latest";
-
-/** Which of the three feeds a check is pointed at. */
-export type UpdateFeedKind = "override" | "mirror" | "github";
+/** Which feed a check is pointed at. */
+export type UpdateFeedKind = "override" | "github";
/**
* The feed a check starts from: an explicit `PENGUIN_UPDATE_FEED_URL` (a deployment's own mirror,
- * or the local server an end-to-end update test stands up) wins over everything, the OSS mirror is
- * the default.
+ * or the local server an end-to-end update test stands up) wins over everything; otherwise the
+ * check reads Adelie's GitHub Releases, the only place the assets are published.
*/
export function initialFeedKind(env: NodeJS.ProcessEnv): UpdateFeedKind {
- return feedUrlOverride(env) !== null ? "override" : "mirror";
-}
-
-/**
- * Whether a failed check on this feed is retried against GitHub Releases. Only the mirror falls
- * back: it is a convenience copy of the Release assets, so GitHub still holds what the check was
- * looking for. An override is an instruction about which feed to use, and a check that quietly
- * went elsewhere would answer a different question than the one that was asked.
- */
-export function fallsBackToGithub(kind: UpdateFeedKind): boolean {
- return kind === "mirror";
+ return feedUrlOverride(env) !== null ? "override" : "github";
}
diff --git a/packages/desktop/src/updater.ts b/packages/desktop/src/updater.ts
index 7669f9eb..01f7cfc0 100644
--- a/packages/desktop/src/updater.ts
+++ b/packages/desktop/src/updater.ts
@@ -17,13 +17,10 @@
* check or download is manual too, but its outcomes render in the modal that asked, not
* in dialogs: the native restart prompt follows only a download the native dialog started.
*
- * Adelie fork note (2026-10-06): the assets are published to this fork's own GitHub Releases
- * (`lmliheng/Adelie`) and mirrored to Alibaba Cloud OSS, and the mirror is the feed a check
- * starts from — github.com is slow to unusable for the users this fork is built for. GitHub
- * Releases stays the source of truth: a check the mirror does not answer is retried there, so a
- * mirror that is stale, broken or simply gone costs one round-trip rather than the update.
- * `PENGUIN_UPDATE_FEED_URL` still outranks both — an end-to-end update test points it at the
- * local server it just stood up — and is answered as-is, never followed by a fallback.
+ * Adelie fork note: the assets are published to this fork's own GitHub Releases
+ * (`lmliheng/Adelie`), and that is the feed a check starts from. `PENGUIN_UPDATE_FEED_URL`
+ * outranks it — an end-to-end update test points it at the local server it just stood up, and a
+ * deployment running a mirror of its own can point it there — and is answered as-is.
*
* Release builds use Developer ID signing on macOS and Authenticode signing on Windows;
* unsigned dry-run artifacts can still find updates, but platform trust and release
@@ -38,9 +35,7 @@ import { resolveProfile } from "./app-identity.js";
import { logLine } from "./desktop-log.js";
import {
GITHUB_FEED,
- MIRROR_FEED_URL,
RELEASES_URL,
- fallsBackToGithub,
feedUrlOverride,
initialFeedKind,
updateSupport,
@@ -70,24 +65,18 @@ let downloadInFlight = false;
let nativeDownload = false;
/**
- * The feeds this build can update from, and the one a check is pointed at right now: the OSS
- * mirror by default, an explicit PENGUIN_UPDATE_FEED_URL instead when one is set, and GitHub
- * Releases while a check the mirror did not answer is being retried (`handleCheckError`).
+ * The feeds this build can update from: Adelie's GitHub Releases by default, an explicit
+ * PENGUIN_UPDATE_FEED_URL instead when one is set.
*/
let overrideFeedUrl: string | null = null;
-let activeFeed: UpdateFeedKind = "mirror";
-/** Points electron-updater at one of the three feeds; the kind is remembered for the fallback. */
+/** Points electron-updater at the GitHub feed or at an explicit override. */
function setFeed(kind: UpdateFeedKind): void {
- activeFeed = kind;
if (kind === "github") {
autoUpdater.setFeedURL(GITHUB_FEED);
return;
}
- autoUpdater.setFeedURL({
- provider: "generic",
- url: kind === "override" ? (overrideFeedUrl as string) : MIRROR_FEED_URL,
- });
+ autoUpdater.setFeedURL({ provider: "generic", url: overrideFeedUrl as string });
}
function scheduleChecks(): void {
@@ -143,18 +132,12 @@ function reportUpdaterError(err: Error, step: "check" | "download"): void {
}
/**
- * A check that failed. The default feed is the OSS mirror, a convenience copy of the Release
- * assets — so a check it does not answer is retried against GitHub Releases, which is where those
- * assets are published and which every release leaves current. Only a failure of that second feed
- * is the user's failure. An explicit PENGUIN_UPDATE_FEED_URL never falls back: it names the feed
- * to use, and a check against some other one would answer a different question.
+ * A check that failed. There is no second feed behind GitHub Releases — it holds the published
+ * assets and every release leaves it current — so the failure is the user's to see. An explicit
+ * PENGUIN_UPDATE_FEED_URL is likewise answered as-is: it names the feed to use, and a check
+ * against some other one would answer a different question.
*/
function handleCheckError(err: Error): void {
- if (fallsBackToGithub(activeFeed)) {
- log(`mirror check failed (${err.message}); retrying against GitHub Releases`);
- void check("github");
- return;
- }
reportUpdaterError(err, "check");
}
@@ -303,13 +286,13 @@ export function initUpdater(getWindow: () => BrowserWindow | null): void {
log(
overrideFeedUrl !== null
? `feed override: ${overrideFeedUrl}`
- : `feed: mirror ${MIRROR_FEED_URL} (GitHub Releases as fallback)`,
+ : `feed: GitHub Releases (${GITHUB_FEED.owner}/${GITHUB_FEED.repo})`,
);
scheduleChecks();
}
-/** `startFeed` is what the GitHub fallback passes; an ordinary check starts from the default. */
-async function check(startFeed?: UpdateFeedKind): Promise<void> {
+/** Runs one check against the configured feed. */
+async function check(): Promise<void> {
// A waiting build ends the checking: a re-check that finds a newer release would
// start fetching it and invalidate the downloaded package on disk while the UI still
// points its install action at it. The user installs what they were offered; the next
@@ -322,9 +305,9 @@ async function check(startFeed?: UpdateFeedKind): Promise<void> {
) {
return;
}
- // Every ordinary check starts from the configured default, so a mirror that failed last time
- // gets another chance instead of the session being pinned to the fallback.
- setFeed(startFeed ?? initialFeedKind(process.env));
+ // Every check reads the feed configured for this run — an override when one is set, GitHub
+ // Releases otherwise.
+ setFeed(initialFeedKind(process.env));
try {
await autoUpdater.checkForUpdates();
} catch (err) {
diff --git a/packages/desktop/test/update-support.test.ts b/packages/desktop/test/update-support.test.ts
index a6bf10b0..ef9418f0 100644
--- a/packages/desktop/test/update-support.test.ts
+++ b/packages/desktop/test/update-support.test.ts
@@ -1,8 +1,6 @@
import { describe, expect, it } from "vitest";
import {
GITHUB_FEED,
- MIRROR_FEED_URL,
- fallsBackToGithub,
feedUrlOverride,
initialFeedKind,
updateSupport,
@@ -73,15 +71,7 @@ describe("feedUrlOverride", () => {
});
describe("the default feed", () => {
- it("is Adelie's own OSS mirror, over https, with /latest as the generic feed its assets live under", () => {
- // The mirror is a generic feed: electron-updater appends `/latest.yml` (Windows) or
- // `/latest-linux.yml` (Linux) to this URL, which is exactly what publish-release-to-oss.sh
- // uploads to `latest/`.
- expect(MIRROR_FEED_URL).toBe("https://adelie-releases.oss-cn-hangzhou.aliyuncs.com/latest");
- expect(new URL(MIRROR_FEED_URL).protocol).toBe("https:");
- });
-
- it("is this fork's GitHub Releases when a check falls back, not upstream's", () => {
+ it("is this fork's GitHub Releases, not upstream's", () => {
// Both projects reuse version numbers: a feed left pointing at PenguinHarness would offer —
// and install — a PenguinHarness build over this app.
expect(GITHUB_FEED).toEqual({ provider: "github", owner: "lmliheng", repo: "Adelie" });
@@ -89,21 +79,12 @@ describe("the default feed", () => {
});
describe("initialFeedKind", () => {
- it("starts from the mirror, or from an explicit PENGUIN_UPDATE_FEED_URL when one is set", () => {
- expect(initialFeedKind({})).toBe("mirror");
+ it("starts from GitHub Releases, or from an explicit PENGUIN_UPDATE_FEED_URL when one is set", () => {
+ expect(initialFeedKind({})).toBe("github");
expect(initialFeedKind({ PENGUIN_UPDATE_FEED_URL: "http://127.0.0.1:8080/feed" })).toBe(
"override",
);
- // An unusable override is not a feed; the check still starts from the mirror.
- expect(initialFeedKind({ PENGUIN_UPDATE_FEED_URL: "file:///etc/passwd" })).toBe("mirror");
- });
-});
-
-describe("fallsBackToGithub", () => {
- it("retries the mirror against GitHub Releases, and leaves an override alone", () => {
- expect(fallsBackToGithub("mirror")).toBe(true);
- expect(fallsBackToGithub("override")).toBe(false);
- // Already the fallback: a second failure is the answer, not another retry.
- expect(fallsBackToGithub("github")).toBe(false);
+ // An unusable override is not a feed; the check still starts from GitHub Releases.
+ expect(initialFeedKind({ PENGUIN_UPDATE_FEED_URL: "file:///etc/passwd" })).toBe("github");
});
});
diff --git a/scripts/install-ossutil.sh b/scripts/install-ossutil.sh
deleted file mode 100644
index 1e68a7eb..00000000
--- a/scripts/install-ossutil.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# Install a checksum-pinned ossutil 2 binary into a caller-provided directory.
-# Usage: install-ossutil.sh <bin-dir>
-set -eu
-
-BIN_DIR="${1:?usage: install-ossutil.sh <bin-dir>}"
-VERSION="2.3.0"
-ARCHIVE="ossutil-$VERSION-linux-amd64.zip"
-ARCHIVE_SHA256="3ae4d9fc85a7a6e9f5654d1599766f1a3a42a3692870887b5ae9338d582ef65a"
-DOWNLOAD_URL="https://gosspublic.alicdn.com/ossutil/v2/$VERSION/$ARCHIVE"
-
-command -v curl >/dev/null 2>&1 || {
- echo "error: curl is required" >&2
- exit 1
-}
-command -v sha256sum >/dev/null 2>&1 || {
- echo "error: sha256sum is required" >&2
- exit 1
-}
-command -v unzip >/dev/null 2>&1 || {
- echo "error: unzip is required" >&2
- exit 1
-}
-
-WORK_DIR="$(mktemp -d)"
-trap 'rm -rf "$WORK_DIR"' EXIT
-
-curl --proto '=https' --tlsv1.2 -fsSL "$DOWNLOAD_URL" -o "$WORK_DIR/$ARCHIVE"
-printf '%s %s\n' "$ARCHIVE_SHA256" "$WORK_DIR/$ARCHIVE" | sha256sum -c -
-unzip -q "$WORK_DIR/$ARCHIVE" -d "$WORK_DIR/extracted"
-
-OSSUTIL_SOURCE="$(find "$WORK_DIR/extracted" -type f -name ossutil -print -quit)"
-[ -n "$OSSUTIL_SOURCE" ] || {
- echo "error: ossutil binary not found in $ARCHIVE" >&2
- exit 1
-}
-
-mkdir -p "$BIN_DIR"
-install -m 0755 "$OSSUTIL_SOURCE" "$BIN_DIR/ossutil"
-"$BIN_DIR/ossutil" version
diff --git a/scripts/publish-release-to-oss.sh b/scripts/publish-release-to-oss.sh
deleted file mode 100644
index 16ce20f3..00000000
--- a/scripts/publish-release-to-oss.sh
+++ /dev/null
@@ -1,263 +0,0 @@
-#!/bin/sh
-# Mirror the exact assets of an Adelie GitHub Release into Alibaba Cloud OSS.
-#
-# Usage: publish-release-to-oss.sh <release-dir> <tag> [update-latest]
-# <release-dir> directory holding the Release assets, named exactly as they are on GitHub
-# <tag> the Release tag, e.g. v0.3.1
-# update-latest true only when <tag> is the Release GitHub currently calls latest (default false)
-#
-# Two locations come out of one run:
-#
-# releases/<tag>/… immutable — the tag names a fixed set of bytes, so these are uploaded
-# once, never overwritten, and served with a year-long cache.
-# latest/… stable — the same bytes under version-less names, rewritten on every
-# release with `no-cache`, because a client that asks for
-# `latest/adelie-desktop-win32-x64.exe` must never receive the previous
-# release's copy.
-#
-# `latest/` is what a client points at: the desktop shell's generic feed
-# (PENGUIN_UPDATE_FEED_URL=<public>/latest) reads latest.yml/latest-linux.yml there, the
-# installer and `penguin update` take PENGUIN_DOWNLOAD_BASE_URL=<public>/latest and fetch the
-# named asset beside the metadata, and a browser download of an installer needs no URL that
-# changes per release.
-#
-# Adelie fork note (2026-10-06): upstream's version of this script mirrored upstream's asset
-# names (its `penguin-desktop-*` installers, its darwin bundles, its SHA256SUMS files and its
-# release-download-manifest probes) into releases/<tag>/ plus a latest.json pointer, for an OSS
-# feed the app itself read. Adelie ships different assets and reads the mirror through the two
-# environment variables named above, so the asset list and the `latest/` location are Adelie's.
-# The environment contract, the immutability of releases/<tag>/ and the download-verified upload
-# are upstream's, kept so the two scripts stay recognizably the same tool.
-#
-# Required environment:
-# OSS_BUCKET bucket name, e.g. adelie-releases
-# OSS_REGION region id, e.g. cn-hangzhou
-# OSS_ENDPOINT endpoint host, e.g. oss-cn-hangzhou.aliyuncs.com
-# OSS_PUBLIC_BASE_URL public base URL without a trailing slash, e.g.
-# https://adelie-releases.oss-cn-hangzhou.aliyuncs.com
-# OSS_ACCESS_KEY_ID / OSS_ACCESS_KEY_SECRET credentials with PutObject/GetObject on the bucket
-# OSSUTIL_BIN optional path to the ossutil binary (default: ossutil on PATH)
-set -eu
-
-RELEASE_DIR="${1:?usage: publish-release-to-oss.sh <release-dir> <tag> [update-latest]}"
-TAG="${2:?usage: publish-release-to-oss.sh <release-dir> <tag> [update-latest]}"
-UPDATE_LATEST="${3:-false}"
-OSSUTIL_BIN="${OSSUTIL_BIN:-ossutil}"
-
-require_env() {
- eval "value=\${$1:-}"
- [ -n "$value" ] || {
- echo "error: required environment variable $1 is empty" >&2
- exit 1
- }
-}
-
-for name in OSS_BUCKET OSS_REGION OSS_ENDPOINT OSS_PUBLIC_BASE_URL \
- OSS_ACCESS_KEY_ID OSS_ACCESS_KEY_SECRET; do
- require_env "$name"
-done
-
-[ -d "$RELEASE_DIR" ] || {
- echo "error: release directory not found: $RELEASE_DIR" >&2
- exit 1
-}
-case "$TAG" in
- v[0-9]*) VERSION="${TAG#v}" ;;
- *)
- echo "error: release tag must start with v followed by a digit: $TAG" >&2
- exit 1
- ;;
-esac
-case "$TAG" in
- *[!A-Za-z0-9._+-]*|*..*)
- echo "error: release tag is not safe for an OSS object prefix: $TAG" >&2
- exit 1
- ;;
-esac
-case "$UPDATE_LATEST" in
- true|false) ;;
- *)
- echo "error: update-latest must be true or false: $UPDATE_LATEST" >&2
- exit 1
- ;;
-esac
-command -v "$OSSUTIL_BIN" >/dev/null 2>&1 || {
- echo "error: ossutil not found: $OSSUTIL_BIN" >&2
- exit 1
-}
-command -v sha256sum >/dev/null 2>&1 || {
- echo "error: sha256sum is required" >&2
- exit 1
-}
-
-# The CLI bundles with their published checksums, the two installer scripts, and the desktop
-# installers with the update metadata electron-updater reads (see
-# packages/desktop/electron-builder.yml). macOS artifacts are not built yet, so no
-# latest-mac.yml either — the day a signed dmg exists, it is another line in each group.
-CLI_BUNDLES="
-penguin-linux-x64.tar.gz
-penguin-win32-x64.zip
-penguin-universal.tar.gz
-"
-CLI_CHECKSUMS="
-penguin-linux-x64.tar.gz.sha256
-penguin-win32-x64.zip.sha256
-penguin-universal.tar.gz.sha256
-"
-INSTALLER_SCRIPTS="
-install.sh
-install.ps1
-"
-DESKTOP_INSTALLERS="
-adelie-desktop-win32-x64.exe
-adelie-desktop-linux-x86_64.AppImage
-adelie-desktop-linux-amd64.deb
-"
-DESKTOP_UPDATE_METADATA="
-latest.yml
-latest-linux.yml
-"
-DESKTOP_UPDATE_BLOCKMAPS="
-adelie-desktop-win32-x64.exe.blockmap
-"
-
-FILES="$CLI_BUNDLES
-$CLI_CHECKSUMS
-$INSTALLER_SCRIPTS
-$DESKTOP_INSTALLERS
-$DESKTOP_UPDATE_METADATA
-$DESKTOP_UPDATE_BLOCKMAPS
-"
-
-for file in $FILES; do
- [ -f "$RELEASE_DIR/$file" ] || {
- echo "error: missing GitHub Release asset: $file" >&2
- exit 1
- }
-done
-
-# Every bundle is checked against the checksum file that ships beside it, before anything is
-# uploaded: a truncated download in the release directory must fail here, not on a user's machine.
-for bundle in $CLI_BUNDLES; do
- (cd "$RELEASE_DIR" && sha256sum -c "$bundle.sha256")
-done
-
-WORK_DIR="$(mktemp -d)"
-trap 'rm -rf "$WORK_DIR"' EXIT
-
-oss_cp() {
- if [ -n "$3" ]; then
- "$OSSUTIL_BIN" cp "$1" "$2" \
- --endpoint "$OSS_ENDPOINT" \
- --region "$OSS_REGION" \
- --force \
- --no-progress \
- --cache-control "$3"
- else
- "$OSSUTIL_BIN" cp "$1" "$2" \
- --endpoint "$OSS_ENDPOINT" \
- --region "$OSS_REGION" \
- --force \
- --no-progress
- fi
-}
-
-# Server-side copy, with the destination's cache policy stated instead of inherited.
-oss_copy_between() {
- "$OSSUTIL_BIN" cp "$1" "$2" \
- --endpoint "$OSS_ENDPOINT" \
- --region "$OSS_REGION" \
- --force \
- --no-progress \
- --metadata-directive REPLACE \
- --cache-control "$3"
-}
-
-file_sha256() {
- sha256sum "$1" | awk '{print $1}'
-}
-
-# Downloads the object back and compares it with the local file. The upload is what a user
-# receives; only the round trip proves what is actually stored.
-verify_remote_file() {
- local_file="$1"
- remote_uri="$2"
- remote_file="$WORK_DIR/remote-$(basename "$local_file")"
- rm -f "$remote_file"
- oss_cp "$remote_uri" "$remote_file" ""
- local_hash="$(file_sha256 "$local_file")"
- remote_hash="$(file_sha256 "$remote_file")"
- [ "$local_hash" = "$remote_hash" ] || {
- echo "error: OSS object differs from the release asset: $remote_uri" >&2
- exit 1
- }
-}
-
-# releases/<tag>/ is immutable: an existing object with identical bytes makes a retry
-# idempotent, and one with different bytes is an error rather than an overwrite.
-upload_immutable_file() {
- local_file="$1"
- object_key="$2"
- remote_uri="oss://$OSS_BUCKET/$object_key"
- existing_file="$WORK_DIR/existing-$(basename "$local_file")"
- rm -f "$existing_file"
-
- if oss_cp "$remote_uri" "$existing_file" "" >/dev/null 2>&1; then
- if [ "$(file_sha256 "$local_file")" = "$(file_sha256 "$existing_file")" ]; then
- echo "Already mirrored: $remote_uri"
- return
- fi
- echo "error: immutable OSS object already exists with different content: $remote_uri" >&2
- exit 1
- fi
-
- echo "Uploading: $remote_uri"
- oss_cp "$local_file" "$remote_uri" "public,max-age=31536000,immutable"
- verify_remote_file "$local_file" "$remote_uri"
-}
-
-RELEASE_PREFIX="releases/$TAG"
-LATEST_PREFIX="latest"
-
-for file in $FILES; do
- upload_immutable_file "$RELEASE_DIR/$file" "$RELEASE_PREFIX/$file"
-done
-
-if [ "$UPDATE_LATEST" = "true" ]; then
- # The stable names are copied from the immutable ones, never uploaded twice: one payload
- # transfer per release, and the bytes a client gets under latest/ are the tag's own.
- for file in $FILES; do
- echo "Publishing: oss://$OSS_BUCKET/$LATEST_PREFIX/$file"
- oss_copy_between "oss://$OSS_BUCKET/$RELEASE_PREFIX/$file" \
- "oss://$OSS_BUCKET/$LATEST_PREFIX/$file" "no-cache"
- done
-
- # Verified through the stable location, because that is the one clients read. The versioned
- # copies are the server-side source of exactly these bytes.
- for file in $FILES; do
- verify_remote_file "$RELEASE_DIR/$file" "oss://$OSS_BUCKET/$LATEST_PREFIX/$file"
- done
-
- PUBLIC_LATEST="${OSS_PUBLIC_BASE_URL%/}/$LATEST_PREFIX"
- PUBLIC_RELEASE="${OSS_PUBLIC_BASE_URL%/}/$RELEASE_PREFIX"
-
- # A pointer for anything that needs to learn the newest tag without the GitHub API — the
- # moment a script reads it, this is where the answer is.
- cat > "$WORK_DIR/latest.json" <<JSON
-{
- "schemaVersion": 1,
- "tag": "$TAG",
- "version": "$VERSION",
- "releaseBaseUrl": "$PUBLIC_RELEASE",
- "latestBaseUrl": "$PUBLIC_LATEST"
-}
-JSON
-
- echo "Updating latest release pointer: oss://$OSS_BUCKET/latest.json"
- oss_cp "$WORK_DIR/latest.json" "oss://$OSS_BUCKET/latest.json" "no-cache"
- verify_remote_file "$WORK_DIR/latest.json" "oss://$OSS_BUCKET/latest.json"
-else
- echo "Skipping latest/ and latest.json because update-latest is false."
-fi
-
-echo "OSS mirror verified for $TAG."
diff --git a/scripts/test-oss-staging.sh b/scripts/test-oss-staging.sh
deleted file mode 100644
index 4d51f1bb..00000000
--- a/scripts/test-oss-staging.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-# Verify a GitHub Actions OIDC staging role can round-trip an object under staging/
-# and cannot write either releases/ or the production latest.json pointer.
-set -eu
-
-OSSUTIL_BIN="${OSSUTIL_BIN:-ossutil}"
-RUN_ID="${GITHUB_RUN_ID:-manual}"
-RUN_ATTEMPT="${GITHUB_RUN_ATTEMPT:-1}"
-PREFIX="${1:-staging/$RUN_ID-$RUN_ATTEMPT}"
-
-require_env() {
- eval "value=\${$1:-}"
- [ -n "$value" ] || {
- echo "error: required environment variable $1 is empty" >&2
- exit 1
- }
-}
-
-for name in OSS_BUCKET OSS_REGION OSS_ENDPOINT OSS_PUBLIC_BASE_URL; do
- require_env "$name"
-done
-case "$PREFIX" in
- staging/*) ;;
- *)
- echo "error: staging prefix must start with staging/: $PREFIX" >&2
- exit 1
- ;;
-esac
-command -v "$OSSUTIL_BIN" >/dev/null 2>&1 || {
- echo "error: ossutil not found: $OSSUTIL_BIN" >&2
- exit 1
-}
-command -v curl >/dev/null 2>&1 || {
- echo "error: curl is required" >&2
- exit 1
-}
-
-WORK_DIR="$(mktemp -d)"
-trap 'rm -rf "$WORK_DIR"' EXIT
-PROBE="$WORK_DIR/oidc-probe.txt"
-DOWNLOADED="$WORK_DIR/downloaded.txt"
-printf 'repository=%s\nrun_id=%s\nrun_attempt=%s\ncommit=%s\n' \
- "${GITHUB_REPOSITORY:-unknown}" "$RUN_ID" "$RUN_ATTEMPT" "${GITHUB_SHA:-unknown}" > "$PROBE"
-
-oss_cp() {
- "$OSSUTIL_BIN" cp "$1" "$2" \
- --endpoint "$OSS_ENDPOINT" \
- --region "$OSS_REGION" \
- --force \
- --no-progress
-}
-
-STAGING_URI="oss://$OSS_BUCKET/$PREFIX/oidc-probe.txt"
-oss_cp "$PROBE" "$STAGING_URI"
-oss_cp "$STAGING_URI" "$DOWNLOADED"
-cmp "$PROBE" "$DOWNLOADED"
-echo "Staging upload/download verified: $STAGING_URI"
-
-DENIED_URI="oss://$OSS_BUCKET/releases/_staging-deny-probe/$RUN_ID-$RUN_ATTEMPT.txt"
-if oss_cp "$PROBE" "$DENIED_URI" >"$WORK_DIR/denied.log" 2>&1; then
- echo "error: staging role unexpectedly wrote to production: $DENIED_URI" >&2
- echo "Remove that probe manually and fix the RAM policy before continuing." >&2
- exit 1
-fi
-if ! grep -Eiq 'AccessDenied|Forbidden|(^|[^0-9])403([^0-9]|$)' "$WORK_DIR/denied.log"; then
- echo "error: production probe failed, but not with a recognizable access-denied response" >&2
- cat "$WORK_DIR/denied.log" >&2
- exit 1
-fi
-echo "Production write correctly denied for the staging role."
-
-# Probe the exact latest.json permission without risking an overwrite. The existing public
-# object is used as the body and x-oss-forbid-overwrite makes the request non-destructive:
-# AccessDenied is expected; FileAlreadyExists means the role was incorrectly authorized.
-LATEST_COPY="$WORK_DIR/latest.json"
-LATEST_URL="${OSS_PUBLIC_BASE_URL%/}/latest.json"
-curl --proto '=https' --tlsv1.2 -fsSL "$LATEST_URL" -o "$LATEST_COPY"
-[ -s "$LATEST_COPY" ] || {
- echo "error: downloaded latest.json is empty: $LATEST_URL" >&2
- exit 1
-}
-
-if "$OSSUTIL_BIN" api put-object \
- --bucket "$OSS_BUCKET" \
- --key latest.json \
- --body "file://$LATEST_COPY" \
- --forbid-overwrite \
- --endpoint "$OSS_ENDPOINT" \
- --region "$OSS_REGION" >"$WORK_DIR/latest-denied.log" 2>&1; then
- echo "error: staging role unexpectedly wrote the production latest.json pointer" >&2
- exit 1
-fi
-if grep -Eiq 'AccessDenied|Forbidden|(^|[^0-9])403([^0-9]|$)' "$WORK_DIR/latest-denied.log"; then
- echo "Production latest.json write correctly denied for the staging role."
-elif grep -Eiq 'FileAlreadyExists|(^|[^0-9])409([^0-9]|$)' "$WORK_DIR/latest-denied.log"; then
- echo "error: staging role is authorized to write latest.json; overwrite was blocked by OSS" >&2
- exit 1
-else
- echo "error: latest.json probe failed, but not with a recognizable access-denied response" >&2
- cat "$WORK_DIR/latest-denied.log" >&2
- exit 1
-fi