forked from cflmy/deepseek-harness
fix(desktop): read Actions EdgeOne zone from publisher config
This commit is contained in:
1 parent
adbd69f13f
commit
9812fa5854
15 files changed
+78
-36
No files matched your search
@@ -74,7 +74,6 @@ jobs:
|
||||
DESKTOP_STAGING_PERCENTAGE: ${{ inputs.staging_percentage }}
|
||||
DESKTOP_PACKAGE_SELECTION: ${{ needs.route.outputs.selection }}
|
||||
DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }}
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: ${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}
|
||||
DSH_TELEMETRY_DISABLED: '1'
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.1
|
||||
@@ -188,7 +187,6 @@ jobs:
|
||||
env:
|
||||
DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }}
|
||||
DESKTOP_WEBSITE_APPROVAL: ${{ needs.prepare.outputs.website-approval }}
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: ${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
@@ -233,7 +231,6 @@ jobs:
|
||||
env:
|
||||
DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }}
|
||||
DESKTOP_WEBSITE_APPROVAL: ${{ needs.prepare.outputs.website-approval }}
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: ${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
|
||||
@@ -75,7 +75,6 @@ jobs:
|
||||
DESKTOP_ROLLOUT_PERCENTAGE: ${{ inputs.rollout_percentage }}
|
||||
DESKTOP_PACKAGE_SELECTION: ${{ needs.route.outputs.selection }}
|
||||
DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }}
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: ${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}
|
||||
DSH_TELEMETRY_DISABLED: '1'
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.1
|
||||
@@ -121,7 +120,6 @@ jobs:
|
||||
DESKTOP_ROLLOUT_PERCENTAGE: ${{ inputs.rollout_percentage }}
|
||||
DESKTOP_ROLLOUT_APPROVAL: ${{ needs.prepare.outputs.approval }}
|
||||
DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }}
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: ${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}
|
||||
DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }}
|
||||
DSH_TELEMETRY_DISABLED: '1'
|
||||
steps:
|
||||
@@ -175,7 +173,6 @@ jobs:
|
||||
DESKTOP_ROLLOUT_APPROVAL: ${{ needs.prepare.outputs.approval }}
|
||||
DESKTOP_ROLLOUT_PERCENTAGE: ${{ inputs.rollout_percentage }}
|
||||
DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }}
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: ${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
@@ -230,7 +227,6 @@ jobs:
|
||||
DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }}
|
||||
DESKTOP_WEBSITE_APPROVAL: ${{ needs.prepare.outputs.website-approval }}
|
||||
DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }}
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: ${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
|
||||
@@ -9,6 +9,7 @@ const schema = z.strictObject({
|
||||
bucket: z.string().regex(/^[a-z0-9-]+-\d+$/u),
|
||||
origin: z.url().refine((value) => { const url = new URL(value); return url.protocol === 'https:' && !url.username && !url.password && url.pathname === '/' && !url.search && !url.hash }, 'expected an HTTPS origin'),
|
||||
credentialsFile: absolutePath,
|
||||
edgeOneZoneId: z.string().regex(/^zone-[a-z0-9]+$/u).optional(),
|
||||
macOS: z.strictObject({ signingIdentity: z.string().min(1), teamId: z.string().regex(/^[A-Z0-9]{10}$/u) }).optional(),
|
||||
windows: z.strictObject({ certificateThumbprint: z.string().regex(/^[A-Fa-f0-9]{40}$/u) }).optional(),
|
||||
githubApp: z.strictObject({ clientId: singleLine, privateKeyFile: absolutePath }).optional(),
|
||||
@@ -44,3 +45,13 @@ export async function readDesktopUploadCredentials(config: DesktopPublishConfig)
|
||||
throw new Error('desktop publish: cannot read valid upload credentials from the configured file')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Require the configured EdgeOne destination before website upload or cache recovery.
|
||||
* @param config Validated machine publication settings.
|
||||
* @returns Configured EdgeOne zone identifier.
|
||||
*/
|
||||
export function requireDesktopEdgeOneZoneId(config: DesktopPublishConfig): string {
|
||||
if (!config.edgeOneZoneId) throw new Error('website publication: configure edgeOneZoneId in publishing/production.json before uploading')
|
||||
return config.edgeOneZoneId
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto'
|
||||
import { appendFile } from 'node:fs/promises'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { z } from 'zod'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials } from './desktop-publish-config.ts'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials, requireDesktopEdgeOneZoneId } from './desktop-publish-config.ts'
|
||||
import { desktopReleasesRoot } from './desktop-releases-root.ts'
|
||||
import { readRetainedDesktopManifest, retainedDesktopPath } from './desktop-release-store.ts'
|
||||
import { resolveRetainedDesktopPublication, retainedDesktopPublishApi } from './resolve-retained-desktop-publish-ci.ts'
|
||||
@@ -36,8 +36,8 @@ export async function prepareDesktopRolloutCi(env: NodeJS.ProcessEnv) {
|
||||
const target = input === '' ? undefined : Number(input)
|
||||
const website = env.DESKTOP_UPLOAD_WEBSITE === 'true'
|
||||
if (target === undefined && !website) throw new Error('desktop rollout: select a percentage or website publication')
|
||||
if (website && (route.preset !== 'production' || !/^zone-[a-z0-9]+$/u.test(env.DOWNLOAD_PROD_EO_ZONE_ID || ''))) {
|
||||
throw new Error('desktop rollout: website publication requires production and DOWNLOAD_PROD_EO_ZONE_ID')
|
||||
if (website && route.preset !== 'production') {
|
||||
throw new Error('desktop rollout: website publication requires production')
|
||||
}
|
||||
const root = desktopReleasesRoot(env)
|
||||
const manifest = await readRetainedDesktopManifest(root, route.runId, route.attempt)
|
||||
@@ -50,6 +50,7 @@ export async function prepareDesktopRolloutCi(env: NodeJS.ProcessEnv) {
|
||||
throw new Error('desktop rollout: repository or release qualification mismatch')
|
||||
}
|
||||
const config = await readDesktopPublishConfig(z.string().parse(env.DSH_PACKAGING_CONFIG_DIR), source.preset)
|
||||
const zoneId = website ? requireDesktopEdgeOneZoneId(config) : undefined
|
||||
const environment = source.preset === 'test'
|
||||
? { DSH_DESKTOP_AUTO_UPDATE_ENV: 'test', DOWNLOAD_TEST_ORIGIN: config.origin,
|
||||
DOWNLOAD_TEST_RELEASE_ID: source.testReleaseId ?? '', DOWNLOAD_TEST_COS_BUCKET: config.bucket }
|
||||
@@ -62,7 +63,7 @@ export async function prepareDesktopRolloutCi(env: NodeJS.ProcessEnv) {
|
||||
throw new Error('desktop rollout: initial COS feed publication is not confirmed for this package')
|
||||
}
|
||||
const approval = createHash('sha256').update(JSON.stringify({ manifest, plan, target, website,
|
||||
zoneId: website ? env.DOWNLOAD_PROD_EO_ZONE_ID : undefined })).digest('hex')
|
||||
zoneId })).digest('hex')
|
||||
return { route, root, recordsRoot, config, manifest, plan, target, website, destination, approval }
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { appendFile, mkdir, readFile, rename, writeFile } from 'node:fs/promises
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { setTimeout as sleep } from 'node:timers/promises'
|
||||
import { z } from 'zod'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials } from './desktop-publish-config.ts'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials, requireDesktopEdgeOneZoneId } from './desktop-publish-config.ts'
|
||||
import { desktopReleasesRoot } from './desktop-releases-root.ts'
|
||||
import { readRetainedDesktopManifest, retainedDesktopPath } from './desktop-release-store.ts'
|
||||
import { prepareWebsiteInstaller, uploadWebsiteInstaller } from './desktop-website-installer.ts'
|
||||
@@ -48,8 +48,7 @@ export async function publishWebsiteCi(mode: 'upload' | 'purge', env: NodeJS.Pro
|
||||
const config = await readDesktopPublishConfig(z.string().parse(env.DSH_PACKAGING_CONFIG_DIR), 'production')
|
||||
const approval = websiteApproval(manifest, config.bucket)
|
||||
if (!env.DESKTOP_WEBSITE_APPROVAL || env.DESKTOP_WEBSITE_APPROVAL !== approval) throw new Error('website publication: approved build or destination changed')
|
||||
const zoneId = env.DOWNLOAD_PROD_EO_ZONE_ID
|
||||
if (!zoneId || !/^zone-[a-z0-9]+$/u.test(zoneId)) throw new Error('website publication: configure DOWNLOAD_PROD_EO_ZONE_ID before uploading')
|
||||
const zoneId = requireDesktopEdgeOneZoneId(config)
|
||||
const directory = join(dirname(root), 'upload-records', `website-${env.GITHUB_RUN_ID}-${route.target}`)
|
||||
await mkdir(directory, { recursive: true, mode: 0o700 })
|
||||
const stateFile = join(directory, 'state.json')
|
||||
|
||||
@@ -2,7 +2,7 @@ import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { expect, it } from 'vitest'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials } from '@deepseek-ai/dsh-desktop-publisher/desktop-publish-config.ts'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials, requireDesktopEdgeOneZoneId } from '@deepseek-ai/dsh-desktop-publisher/desktop-publish-config.ts'
|
||||
|
||||
it('reads public settings without opening the absent credential file and requires production App settings', async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'publish-config-'))
|
||||
@@ -45,3 +45,21 @@ it('rejects multiline App outputs before writing Actions output fields', async (
|
||||
}
|
||||
} finally { await rm(root, { recursive: true, force: true }) }
|
||||
})
|
||||
|
||||
it('validates optional EdgeOne settings and requires them only for website operations', async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'publish-zone-'))
|
||||
try {
|
||||
await mkdir(join(root, 'publishing'))
|
||||
const config = { bucket: 'test-123', origin: 'https://example.com', credentialsFile: join(root, 'absent.json') }
|
||||
const file = join(root, 'publishing/test.json')
|
||||
await writeFile(file, JSON.stringify(config))
|
||||
const selected = await readDesktopPublishConfig(root, 'test')
|
||||
expect(() => requireDesktopEdgeOneZoneId(selected)).toThrow('edgeOneZoneId in publishing/production.json')
|
||||
await writeFile(file, JSON.stringify({ ...config, edgeOneZoneId: 'zone-fixture' }))
|
||||
expect(requireDesktopEdgeOneZoneId(await readDesktopPublishConfig(root, 'test'))).toBe('zone-fixture')
|
||||
for (const edgeOneZoneId of ['', 'invalid', 'zone-example\n', 123]) {
|
||||
await writeFile(file, JSON.stringify({ ...config, edgeOneZoneId }))
|
||||
await expect(readDesktopPublishConfig(root, 'test')).rejects.toHaveProperty('issues.0.path', ['edgeOneZoneId'])
|
||||
}
|
||||
} finally { await rm(root, { recursive: true, force: true }) }
|
||||
})
|
||||
@@ -11,7 +11,7 @@ import { publishWebsiteCi, websiteApproval } from '@deepseek-ai/dsh-desktop-publ
|
||||
vi.mock('node:timers/promises', () => ({ setTimeout: async () => {} }))
|
||||
afterEach(() => vi.restoreAllMocks())
|
||||
|
||||
it.each(['accepted', 'unconfirmed', 'incomplete', 'wrong-journal', 'upload', 'put', 'uploaded', 'metadata', 'metadata-retry', 'stable', 'approval'] as const)('preserves publication recovery for %s', async (scenario) => {
|
||||
it.each(['accepted', 'unconfirmed', 'incomplete', 'wrong-journal', 'upload', 'put', 'uploaded', 'metadata', 'metadata-retry', 'stable', 'approval', 'missing-zone'] as const)('preserves publication recovery for %s', async (scenario) => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'website-ci-'))
|
||||
try {
|
||||
const config = join(root, 'packaging')
|
||||
@@ -22,7 +22,7 @@ it.each(['accepted', 'unconfirmed', 'incomplete', 'wrong-journal', 'upload', 'pu
|
||||
const credentialsFile = join(root, 'credentials.json')
|
||||
await writeFile(credentialsFile, JSON.stringify({ secretId: 'fixture-id', secretKey: 'fixture-key' }))
|
||||
await writeFile(join(config, 'publishing', 'production.json'), JSON.stringify({
|
||||
bucket: 'production-123', origin: 'https://download.deepseek.com', credentialsFile,
|
||||
edgeOneZoneId: scenario === 'missing-zone' ? undefined : 'zone-fixture', bucket: 'production-123', origin: 'https://download.deepseek.com', credentialsFile,
|
||||
githubApp: { clientId: 'app', privateKeyFile: join(root, 'app.pem') },
|
||||
}))
|
||||
const route = { runId: '12', attempt: '1', commit: 'a'.repeat(40), sourceRef: 'master', channel: scenario === 'stable' ? 'stable' : 'nightly',
|
||||
@@ -38,7 +38,15 @@ it.each(['accepted', 'unconfirmed', 'incomplete', 'wrong-journal', 'upload', 'pu
|
||||
if (scenario === 'metadata-retry') await writeFile(join(records, 'state.json'), JSON.stringify({ approval, upload: 'upload-intent', uploadConfirmed: true }))
|
||||
const env = { RUNNER_NAME: 'mini', GITHUB_REPOSITORY: 'owner/repo', GITHUB_RUN_ID: '99',
|
||||
GITHUB_RUN_ATTEMPT: '1', DSH_PACKAGING_CONFIG_DIR: config, DESKTOP_PUBLISH_ROUTE: JSON.stringify(route),
|
||||
DESKTOP_WEBSITE_APPROVAL: approval, DOWNLOAD_PROD_EO_ZONE_ID: 'zone-fixture', GITHUB_OUTPUT: join(root, 'output') }
|
||||
DESKTOP_WEBSITE_APPROVAL: approval, DOWNLOAD_PROD_EO_ZONE_ID: 'zone-ignored', GITHUB_OUTPUT: join(root, 'output') }
|
||||
if (scenario === 'missing-zone') {
|
||||
await rm(credentialsFile)
|
||||
for (const mode of ['upload', 'purge'] as const) {
|
||||
await expect(publishWebsiteCi(mode, { ...env, DOWNLOAD_PROD_EO_ZONE_ID: 'zone-legacy' }))
|
||||
.rejects.toThrow('edgeOneZoneId in publishing/production.json')
|
||||
}
|
||||
return
|
||||
}
|
||||
if (scenario === 'upload' || scenario === 'put' || scenario === 'uploaded' || scenario === 'metadata' || scenario === 'metadata-retry' || scenario === 'stable' || scenario === 'approval') {
|
||||
await writeFile(join(root, 'releases', '12', '1', manifest.files[0]!.name), 'x')
|
||||
if (scenario === 'upload' || scenario === 'put') await rm(join(records, 'state.json'))
|
||||
@@ -89,6 +97,7 @@ it.each(['accepted', 'unconfirmed', 'incomplete', 'wrong-journal', 'upload', 'pu
|
||||
vi.spyOn(teo.v20220901.Client.prototype, 'DescribePurgeTasks').mockRejectedValue(new Error('unavailable'))
|
||||
await publishWebsiteCi('purge', env)
|
||||
expect(submit).toHaveBeenCalledOnce()
|
||||
expect(submit.mock.calls[0]?.[0]).toMatchObject({ ZoneId: 'zone-fixture' })
|
||||
expect(JSON.parse(await readFile(join(records, 'state.json'), 'utf8'))).toMatchObject({ purge: { jobId: 'new-job' } })
|
||||
}
|
||||
}
|
||||
@@ -111,8 +120,9 @@ it.each(['accepted', 'unconfirmed', 'incomplete', 'wrong-journal', 'upload', 'pu
|
||||
const summary = join(root, 'summary.md')
|
||||
await publishWebsiteCi('purge', { RUNNER_NAME: 'mini', GITHUB_REPOSITORY: 'owner/repo', GITHUB_RUN_ID: '99',
|
||||
GITHUB_RUN_ATTEMPT: '1', DSH_PACKAGING_CONFIG_DIR: config, DESKTOP_PUBLISH_ROUTE: JSON.stringify(route),
|
||||
DESKTOP_WEBSITE_APPROVAL: approval, DOWNLOAD_PROD_EO_ZONE_ID: 'zone-fixture', GITHUB_STEP_SUMMARY: summary })
|
||||
DESKTOP_WEBSITE_APPROVAL: approval, GITHUB_STEP_SUMMARY: summary })
|
||||
expect(submit).toHaveBeenCalledOnce()
|
||||
expect(submit.mock.calls[0]?.[0]).toMatchObject({ ZoneId: 'zone-fixture' })
|
||||
expect(query).toHaveBeenCalledTimes(2)
|
||||
expect(output.mock.calls.map(call => String(call[0])).join('')).toContain('::warning title=官网缓存刷新结果未确认::')
|
||||
expect(JSON.parse(await readFile(join(records, 'state.json'), 'utf8'))).toMatchObject({ upload: 'uploaded', purge: { status: 'unknown' } })
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"bucket": "replace-with-bucket-1250000000",
|
||||
"edgeOneZoneId": "zone-replacewithproductionzone",
|
||||
"origin": "https://download.deepseek.com",
|
||||
"credentialsFile": "/absolute/path/to/packaging/secrets/cos-production.json",
|
||||
"macOS": {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"bucket": "replace-with-bucket-1250000000",
|
||||
"edgeOneZoneId": "zone-replacewithproductionzone",
|
||||
"origin": "https://download.deepseek.com",
|
||||
"credentialsFile": "C:/absolute/path/to/packaging/secrets/cos-production.json",
|
||||
"windows": {
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
en: ee7a9ab8c66df979
|
||||
zh: c355668bc9bdb635
|
||||
/desktop-ci-publication/recovery-and-records:
|
||||
en: d6eb9cbac5b819a0
|
||||
zh: 0de1ec24055d1007
|
||||
en: 43d8c0ca778691a4
|
||||
zh: 1823ea4b68081617
|
||||
/desktop-ci-publication/restore-a-channel:
|
||||
en: d82e2ccf70cce397
|
||||
zh: d93dcb77cc4b463e
|
||||
|
||||
@@ -99,7 +99,7 @@ The packaging workflows separate `package` from `upload-artifact` (GitHub artifa
|
||||
|
||||
Production COS publication enables website installer upload and cache refresh by default (`upload_website=true`). Clear it to publish only versioned resources and automatic-update feeds; test publication never changes the production website. `upload-website-installer` uploads the fixed installer and `purge-website-installer` refreshes its URL. The website installer validator needs only the final DMG/EXE and retained manifest. It matches production qualification, build identity and target, hashes the installer once and uploads through the same open file handle. Both production nightly and stable packages can replace the fixed website installer. Operators select the intended version; the fixed object has no downgrade protection, so rerunning an older publication can replace a newer installer. The pre-approval summary names the fixed website URL, selected version and lack of downgrade protection when website upload is selected. The existing version/update publication retains its own checks.
|
||||
|
||||
Set the repository variable `DOWNLOAD_PROD_EO_ZONE_ID` to the production EdgeOne zone. The production COS credential pair also needs `teo:CreatePurgeTask` and `teo:DescribePurgeTasks`. Website uploads serialize by bucket/target in Actions and by bucket/object on the original machine. Cache observation runs separately. Version publication, website upload and cache refresh each use the production approval Environment; later jobs and reruns may require another approval. GitHub concurrency retains at most one pending job per group, so a newer pending job can cancel an older pending job; inspect canceled jobs before rerunning them.
|
||||
Set `edgeOneZoneId` in each publishing runner’s `publishing/production.json` to the production EdgeOne zone (for example, `"edgeOneZoneId": "zone-example"`). Website publication requires this field before approval; COS-only publication and rollout do not. Actions do not read the repository variable `DOWNLOAD_PROD_EO_ZONE_ID`. The production COS credential pair also needs `teo:CreatePurgeTask` and `teo:DescribePurgeTasks`. Website uploads serialize by bucket/target in Actions and by bucket/object on the original machine. Cache observation runs separately. Version publication, website upload and cache refresh each use the production approval Environment; later jobs and reruns may require another approval. GitHub concurrency retains at most one pending job per group, so a newer pending job can cancel an older pending job; inspect canceled jobs before rerunning them.
|
||||
|
||||
Website state lives in `upload-records/website-<publication run ID>-<target>/state.json`, beside the retained releases root. macOS and Windows use the same record format on separate local disks. Website URLs and download filenames follow the [fixed-download rules](../README.md#fixed-downloads). Upload retries reconcile both bytes and `Content-Disposition`; identical bytes with a missing or different header receive one upload and readback. A completed journal with different remote bytes stops recovery and requires a newly approved publication. Completion evidence survives failed metadata repairs. Each new upload intent clears the previous purge record, so repaired metadata requires a new cache refresh; inspect EdgeOne history for the previous task ID and diagnostics. Unknown writes are read before any retry; CDN header forwarding requires real-environment validation. Rerun only the purge job to inspect its saved task when the original routing and preparation outputs remain available. With website upload enabled, website jobs skip only an explicitly selected test deployment. Each job requires its injected `route` or `selection` output for local preflight. Missing or changed website approval fails before upload or purge submission. Missing `website-destination` broadens both website concurrency groups. Missing `runner` output can prevent scheduling before preflight. Stop partial retries when outputs are missing; the workflow does not reconstruct them. Before restarting the publication workflow, inspect current remote state and obtain approval for its upload scope; this is not cache-only recovery. Do not rerun packaging to recover publication outputs. A manually rerun purge may submit once after confirming the previous task failed. A lost submission response queries matching history instead of resubmitting. An unknown result with a task ID means submission was confirmed; without an ID it may never have been submitted. Inspect EdgeOne history before manual recovery, and a fresh publication run is one recovery option. Operators may instead use the documented [fixed-download purge command](../README.md#fixed-downloads); Windows operators use the existing DPAPI credential launcher described there. This submits only a fixed-URL purge: it does not observe completion or update this Actions run’s journal. Inspect the returned task in EdgeOne before considering recovery complete.
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ Environment 审批限制此工作流,不限制同一机器账户运行的任
|
||||
|
||||
生产 COS 发布默认启用官网安装包上传和缓存刷新(`upload_website=true`)。取消后仅发布版本化资源及自动更新清单;test 发布不修改生产官网。`upload-website-installer` 上传固定安装包,`purge-website-installer` 刷新该 URL。官网安装包校验器只需要最终 DMG/EXE 和保留的 manifest,匹配生产资格、构建身份及平台,只计算一次安装包 hash,并通过同一打开的文件句柄上传。production nightly 和 stable 包都可以替换官网固定安装包。操作者负责选择预期版本;固定对象没有防降级保护,重跑旧发布可能覆盖新安装包。勾选官网上传时,审批前摘要展示固定官网 URL、选定版本和无防降级保护的说明。原有版本与自动更新发布保留自身校验。
|
||||
|
||||
将仓库变量 `DOWNLOAD_PROD_EO_ZONE_ID` 配置为生产 EdgeOne 站点。生产 COS 凭据还需要 `teo:CreatePurgeTask` 和 `teo:DescribePurgeTasks` 权限。官网上传在 Actions 中按 bucket/平台互斥,在原机器上按 bucket/对象互斥;缓存观察单独运行。版本发布、官网上传和缓存刷新分别使用生产审批 Environment,后续 job 和重跑可能需要再次审批。GitHub 每个并发组最多保留一个排队 job,新排队 job 可能取消旧排队 job;重跑前应检查取消记录。
|
||||
在每台发布 runner 的 `publishing/production.json` 中将 `edgeOneZoneId` 配置为生产 EdgeOne 站点(例如 `"edgeOneZoneId": "zone-example"`)。官网发布在审批前要求该字段;仅 COS 发布和放量不需要。Actions 不读取仓库变量 `DOWNLOAD_PROD_EO_ZONE_ID`。生产 COS 凭据还需要 `teo:CreatePurgeTask` 和 `teo:DescribePurgeTasks` 权限。官网上传在 Actions 中按 bucket/平台互斥,在原机器上按 bucket/对象互斥;缓存观察单独运行。版本发布、官网上传和缓存刷新分别使用生产审批 Environment,后续 job 和重跑可能需要再次审批。GitHub 每个并发组最多保留一个排队 job,新排队 job 可能取消旧排队 job;重跑前应检查取消记录。
|
||||
|
||||
官网状态保存在 releases 根目录同级的 `upload-records/website-<发布 run ID>-<target>/state.json`。macOS 和 Windows 在各自本地磁盘使用相同记录格式。官网 URL 和保存文件名遵循[固定下载规则](../README.zh.md#fixed-downloads)。上传重跑同时核对字节和 `Content-Disposition`;字节相同但响应头缺失或错误时,上传一次并读回验证。记录已完成但远端字节改变时停止恢复,需要重新审批发布。完成标记在元数据修复失败后仍保留。每次新的上传意图清除旧刷新记录,因此修复元数据后需重新刷新缓存;上一次任务 ID 和诊断需查 EdgeOne 历史。未知写入先读取再决定重试;CDN 响应头透传仍需实测。原机器路由和准备阶段输出完整时,仅重跑刷新 job 即可查询已保存任务。启用官网上传时,官网 job 仅跳过明确选择的 test 环境。各 job 的本地预检要求其注入的 `route` 或 `selection` 输出存在。官网审批缺失或变化时,在上传或提交刷新任务前失败。`website-destination` 缺失会扩大两个官网并发组的互斥范围。`runner` 输出缺失可能导致无法调度,尚未进入预检。输出缺失时停止局部重试,workflow 不重建这些输出。重新启动发布 workflow 前,先检查当前远端状态并确认上传范围的审批;这不属于仅缓存恢复。不要为恢复发布输出重跑打包。人工重跑确认旧任务失败后可提交一次。提交响应丢失时查询匹配的历史记录,不重新提交。unknown 带任务 ID 表示提交已确认;没有 ID 则可能从未提交。人工恢复前应检查 EdgeOne 历史,重新发起发布运行是恢复方式之一。操作者也可使用已有的[固定下载刷新命令](../README.zh.md#fixed-downloads);Windows 操作者使用该处说明的 DPAPI 凭据启动器。该命令只提交固定 URL 刷新,不观察完成状态,也不更新本次 Actions 运行的 journal。确认恢复完成前应在 EdgeOne 检查返回的任务。
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto'
|
||||
import { appendFile } from 'node:fs/promises'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { z } from 'zod'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials } from '@deepseek-ai/dsh-desktop-publisher/desktop-publish-config.ts'
|
||||
import { readDesktopPublishConfig, readDesktopUploadCredentials, requireDesktopEdgeOneZoneId } from '@deepseek-ai/dsh-desktop-publisher/desktop-publish-config.ts'
|
||||
import { desktopReleasesRoot } from './retain-desktop-ci.ts'
|
||||
import { retainedDesktopPath, verifyRetainedDesktopRelease } from '@deepseek-ai/dsh-desktop-publisher/desktop-release-store.ts'
|
||||
import { verifyRetainedDesktopSignatures } from './verify-retained-desktop.ts'
|
||||
@@ -70,10 +70,7 @@ if (process.argv[1] !== undefined && resolve(process.argv[1]) === import.meta.fi
|
||||
const env = process.env
|
||||
const { route, manifest, config, plan, root, approval, stagingPercentage } = await prepareDesktopPublication(env)
|
||||
if (mode === '--publish' && !env.DESKTOP_APPROVED_PACKAGE) throw new Error('desktop publish: approved package digest is required')
|
||||
if (env.DESKTOP_UPLOAD_WEBSITE === 'true' && route.preset === 'production'
|
||||
&& !/^zone-[a-z0-9]+$/u.test(env.DOWNLOAD_PROD_EO_ZONE_ID || '')) {
|
||||
throw new Error('desktop publish: configure DOWNLOAD_PROD_EO_ZONE_ID before approving website upload')
|
||||
}
|
||||
if (env.DESKTOP_UPLOAD_WEBSITE === 'true' && route.preset === 'production') requireDesktopEdgeOneZoneId(config)
|
||||
if (mode === '--check') {
|
||||
if (env.GITHUB_OUTPUT) await appendFile(env.GITHUB_OUTPUT, `website-destination=${createHash('sha256').update(`${config.bucket}/${plan.target}`).digest('hex')}\nwebsite-approval=${websiteApproval(manifest, config.bucket)}\napproval=${approval}\nlabel=${plan.version} → ${manifest.source.channel} / ${plan.target} / ${plan.environment}\n`)
|
||||
if (env.GITHUB_STEP_SUMMARY && !env.DESKTOP_APPROVED_PACKAGE) await appendFile(env.GITHUB_STEP_SUMMARY,
|
||||
|
||||
@@ -155,14 +155,21 @@ it('requires initial publication evidence and prepares approval without installe
|
||||
await expect(prepareDesktopRolloutCi({ ...env, DESKTOP_ROLLOUT_PERCENTAGE: '' })).rejects.toThrow(/select a percentage/u)
|
||||
await expect(prepareDesktopRolloutCi({ ...env, DESKTOP_ROLLOUT_PERCENTAGE: 'NaN' })).rejects.toThrow(/integer/u)
|
||||
await expect(prepareDesktopRolloutCi({ ...env, RUNNER_NAME: 'other' })).rejects.toThrow(/original machine/u)
|
||||
await expect(prepareDesktopRolloutCi({ ...env, DESKTOP_UPLOAD_WEBSITE: 'true' })).rejects.toThrow(/production and/u)
|
||||
expect((await prepareDesktopRolloutCi({ ...env, DESKTOP_ROLLOUT_PERCENTAGE: '',
|
||||
DESKTOP_UPLOAD_WEBSITE: 'true', DOWNLOAD_PROD_EO_ZONE_ID: 'zone-example' })).website).toBe(true)
|
||||
await expect(prepareDesktopRolloutCi({ ...env, DESKTOP_UPLOAD_WEBSITE: 'true' })).rejects.toThrow(/edgeOneZoneId/u)
|
||||
const configPath = join(config, 'publishing/production.json')
|
||||
const settings = JSON.parse(await readFile(configPath, 'utf8'))
|
||||
await writeFile(configPath, JSON.stringify({ ...settings, edgeOneZoneId: 'zone-example' }))
|
||||
const websiteEnv = { ...env, DESKTOP_ROLLOUT_PERCENTAGE: '', DESKTOP_UPLOAD_WEBSITE: 'true' }
|
||||
const websiteContext = await prepareDesktopRolloutCi(websiteEnv)
|
||||
expect(websiteContext.website).toBe(true)
|
||||
await writeFile(configPath, JSON.stringify({ ...settings, edgeOneZoneId: 'zone-changed' }))
|
||||
expect((await prepareDesktopRolloutCi(websiteEnv)).approval).not.toBe(websiteContext.approval)
|
||||
} finally { await rm(f.root, { recursive: true, force: true }) }
|
||||
})
|
||||
|
||||
it('keeps rollout approval and website recovery separate without tag creation or full package verification', async () => {
|
||||
const text = await readFile('.github/workflows/desktop-rollout.yml', 'utf8')
|
||||
expect(text).not.toContain('DOWNLOAD_PROD_EO_ZONE_ID')
|
||||
const workflow = load(text) as {
|
||||
name: string
|
||||
on: { workflow_dispatch: { inputs: Record<string, { required?: boolean; default?: unknown }> } }
|
||||
@@ -189,7 +196,7 @@ it.each(['apply', 'changed-approval', 'replaced-feed', 'website'] as const)('che
|
||||
await mkdir(join(config, 'publishing'), { recursive: true })
|
||||
await writeFile(credentialsFile, JSON.stringify({ secretId: 'fixture', secretKey: 'fixture' }))
|
||||
await writeFile(join(config, 'publishing/production.json'), JSON.stringify({
|
||||
bucket: 'bucket-123', origin: 'https://download.deepseek.com', credentialsFile,
|
||||
edgeOneZoneId: 'zone-fixture', bucket: 'bucket-123', origin: 'https://download.deepseek.com', credentialsFile,
|
||||
githubApp: { clientId: 'app', privateKeyFile: join(f.root, 'absent-key') },
|
||||
}))
|
||||
const record = await createDesktopPublicationRecord(join(f.root, 'upload-records'), {
|
||||
@@ -200,7 +207,7 @@ it.each(['apply', 'changed-approval', 'replaced-feed', 'website'] as const)('che
|
||||
const env = { RUNNER_NAME: 'runner', GITHUB_REPOSITORY: 'owner/repo', DSH_PACKAGING_CONFIG_DIR: config,
|
||||
DESKTOP_PUBLISH_ROUTE: JSON.stringify({ ...f.manifest.source, runnerLabel: 'dsh-runner' }),
|
||||
DESKTOP_ROLLOUT_PERCENTAGE: scenario === 'website' ? '' : '30', DESKTOP_UPLOAD_WEBSITE: scenario === 'website' ? 'true' : 'false',
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: 'zone-fixture', GITHUB_OUTPUT: join(f.root, 'output'), GITHUB_STEP_SUMMARY: join(f.root, 'summary') }
|
||||
GITHUB_OUTPUT: join(f.root, 'output'), GITHUB_STEP_SUMMARY: join(f.root, 'summary') }
|
||||
const context = await prepareDesktopRolloutCi(env)
|
||||
await publishDesktopRolloutCi('check', env)
|
||||
expect(await readFile(env.GITHUB_OUTPUT, 'utf8')).toContain(`approval=${context.approval}`)
|
||||
@@ -342,9 +349,14 @@ it.each(['missing-yaml', 'wrong-approval', 'not-uploaded', 'wrong-zone', 'not-se
|
||||
await mkdir(join(config, 'publishing'), { recursive: true })
|
||||
await writeFile(credentialsFile, JSON.stringify({ secretId: 'fixture-id', secretKey: 'fixture-key' }))
|
||||
await writeFile(join(config, 'publishing/production.json'), JSON.stringify({
|
||||
bucket: 'bucket-123', origin: 'https://download.deepseek.com', credentialsFile,
|
||||
edgeOneZoneId: 'zone-fixture', bucket: 'bucket-123', origin: 'https://download.deepseek.com', credentialsFile,
|
||||
githubApp: { clientId: 'app', privateKeyFile: join(f.root, 'absent-key') },
|
||||
}))
|
||||
if (scenario === 'wrong-zone') {
|
||||
const configPath = join(config, 'publishing/production.json')
|
||||
const settings = JSON.parse(await readFile(configPath, 'utf8'))
|
||||
await writeFile(configPath, JSON.stringify({ ...settings, edgeOneZoneId: 'zone-changed' }))
|
||||
}
|
||||
await rm(join(f.directory, f.filename))
|
||||
const directory = join(f.root, 'upload-records', 'website-99-mac-arm64')
|
||||
await mkdir(directory, { recursive: true })
|
||||
@@ -365,7 +377,6 @@ it.each(['missing-yaml', 'wrong-approval', 'not-uploaded', 'wrong-zone', 'not-se
|
||||
DSH_PACKAGING_CONFIG_DIR: config, DESKTOP_PUBLISH_ROUTE: JSON.stringify({ ...f.manifest.source, runnerLabel: 'dsh-runner' }),
|
||||
DESKTOP_UPLOAD_WEBSITE: scenario === 'not-selected' ? 'false' : 'true',
|
||||
DESKTOP_WEBSITE_APPROVAL: scenario === 'wrong-approval' ? 'changed' : approval,
|
||||
DOWNLOAD_PROD_EO_ZONE_ID: scenario === 'wrong-zone' ? 'zone-changed' : 'zone-fixture',
|
||||
})
|
||||
if (scenario === 'missing-yaml') {
|
||||
await execution
|
||||
|
||||
@@ -83,7 +83,7 @@ it('rejects non-master dispatch before scheduling a self-hosted job', () => {
|
||||
it('defaults to production website upload and separates cache-only recovery', () => {
|
||||
expect(workflow.on.workflow_dispatch).toMatchObject({ inputs: { upload_website: { type: 'boolean', default: true } } })
|
||||
expect(workflow.jobs.prepare!.env?.DESKTOP_UPLOAD_WEBSITE).toBe('${{ inputs.upload_website }}')
|
||||
expect(workflow.jobs.prepare!.env?.DOWNLOAD_PROD_EO_ZONE_ID).toBe('${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}')
|
||||
expect(JSON.stringify(workflow)).not.toContain('DOWNLOAD_PROD_EO_ZONE_ID')
|
||||
const upload = workflow.jobs['upload-website-installer']!
|
||||
const purge = workflow.jobs['purge-website-installer']!
|
||||
expect(purge.needs).toEqual(['route', 'prepare', 'upload-website-installer'])
|
||||
|
||||
Reference in new issue
Block a user