-
Notifications
You must be signed in to change notification settings - Fork 3k
ci: auto-update ECS runners on stable publish and harden update job #8343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a009a12
4f73a70
0e223d0
c9dc82d
2cd1dbb
99bef80
66e0ff7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -611,6 +611,28 @@ jobs: | |
| --notes-file "${NOTES_FILE}" \ | ||
| ${PRERELEASE_FLAG} | ||
|
|
||
| - name: 'Trigger ECS runner qwen update' | ||
| # Stable releases only: nightly/preview must not move the fleet. | ||
| if: |- | ||
| ${{ github.repository == 'QwenLM/qwen-code' && | ||
| needs.prepare.outputs.is_dry_run == 'false' && | ||
| needs.prepare.outputs.npm_tag == 'latest' }} | ||
|
Comment on lines
+617
to
+619
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] This 中文说明[Suggestion](建议)这个 — qwen3.8-max-preview via Qwen Code /review |
||
| # The packages are already published; a dispatch failure must not | ||
| # fail the release — report it and let maintainers re-run the update | ||
| # workflow manually instead. | ||
| continue-on-error: true | ||
| env: | ||
| GITHUB_TOKEN: '${{ secrets.CI_BOT_PAT }}' | ||
|
Comment on lines
+623
to
+625
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] With 中文说明[Suggestion](建议)由于 — qwen3.8-max-preview via Qwen Code /review |
||
| RELEASE_VERSION: '${{ needs.prepare.outputs.release_version }}' | ||
| run: |- | ||
| gh api "repos/${GITHUB_REPOSITORY}/dispatches" \ | ||
| --method POST \ | ||
| -f 'event_type=npm-published' \ | ||
| -f "client_payload[version]=${RELEASE_VERSION}" || { | ||
| echo "::error::npm-published dispatch failed; run the 'Update ECS Runner Qwen' workflow manually." | ||
| exit 1 | ||
| } | ||
|
|
||
| notify_failure: | ||
| name: 'Notify Release Failure' | ||
| runs-on: 'ubuntu-latest' | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||||||||||
| /** | ||||||||||||
| * @license | ||||||||||||
| * Copyright 2026 Qwen Team | ||||||||||||
| * SPDX-License-Identifier: Apache-2.0 | ||||||||||||
| */ | ||||||||||||
|
|
||||||||||||
| import { readFileSync } from 'node:fs'; | ||||||||||||
| import { describe, expect, it } from 'vitest'; | ||||||||||||
|
|
||||||||||||
| const workflow = readFileSync('.github/workflows/release.yml', 'utf8'); | ||||||||||||
|
|
||||||||||||
| describe('release workflow', () => { | ||||||||||||
| it('fires the fleet-moving npm-published dispatch on stable releases only', () => { | ||||||||||||
| // This gate is the sole protection keeping a nightly/preview/dry-run | ||||||||||||
| // release from moving the ECS fleet; the triggered update workflow | ||||||||||||
| // installs whatever version it is handed, so there is no downstream | ||||||||||||
| // guard. Pin all three clauses together so dropping or inverting one | ||||||||||||
| // fails review instead of silently shipping a non-stable fleet. | ||||||||||||
| expect(workflow).toContain( | ||||||||||||
| 'if: |-\n' + | ||||||||||||
| " ${{ github.repository == 'QwenLM/qwen-code' &&\n" + | ||||||||||||
| " needs.prepare.outputs.is_dry_run == 'false' &&\n" + | ||||||||||||
| " needs.prepare.outputs.npm_tag == 'latest' }}", | ||||||||||||
| ); | ||||||||||||
| expect(workflow).toContain("-f 'event_type=npm-published'"); | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] This dispatch test pins the event type but not the version payload. The payload line
Suggested change
中文说明该 dispatch 测试只固定了事件类型,未固定版本 payload。payload 行 — qwen3.8-max-preview via Qwen Code /review (v0.21.3) |
||||||||||||
| expect(workflow).toContain( | ||||||||||||
| '-f "client_payload[version]=${RELEASE_VERSION}"', | ||||||||||||
| ); | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| it('keeps a dispatch failure from failing an already-published release', () => { | ||||||||||||
| // The packages are published before this step runs, so it must not fail | ||||||||||||
| // the release; but the failure must still surface (as an error, not a | ||||||||||||
| // warning) so the fleet can be reconciled via a manual re-run. | ||||||||||||
| expect(workflow).toContain( | ||||||||||||
| 'continue-on-error: true\n' + | ||||||||||||
| ' env:\n' + | ||||||||||||
| " GITHUB_TOKEN: '${{ secrets.CI_BOT_PAT }}'", | ||||||||||||
| ); | ||||||||||||
| expect(workflow).toContain('echo "::error::npm-published dispatch failed;'); | ||||||||||||
| }); | ||||||||||||
| }); | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,4 +17,18 @@ describe('ECS runner qwen update workflow', () => { | |
| expect(workflow).toContain('cd "${RUNNER_TEMP:?}"'); | ||
| expect(workflow).toContain('sudo env -u NPM_CONFIG_PREFIX npm install -g'); | ||
| }); | ||
|
|
||
| it('annotates a retry and a terminal failure distinctly', () => { | ||
| // The final attempt must not log a "retrying" warning that never | ||
| // retries; a sustained failure ends with an explicit exhausted error. | ||
|
Comment on lines
+21
to
+23
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] This test's comment claims to guard that "the final attempt must not log a 'retrying' warning that never retries", but the two expect(workflow).toContain('for attempt in 1 2 3; do');
expect(workflow).toContain('if [[ "${attempt}" -lt 3 ]]; then');
expect(workflow).toContain('sudo rm -rf "${PKG_DIR}"/.qwen-code-*');中文说明此测试的注释声称要保护“最后一次尝试不会记录一个永不重试的 'retrying' 警告”,但两个 expect(workflow).toContain('for attempt in 1 2 3; do');
expect(workflow).toContain('if [[ "${attempt}" -lt 3 ]]; then');
expect(workflow).toContain('sudo rm -rf "${PKG_DIR}"/.qwen-code-*');— qwen3.8-max-preview via Qwen Code /review |
||
| expect(workflow).toContain( | ||
| 'echo "::warning::npm install attempt ${attempt} failed; retrying"', | ||
| ); | ||
| expect(workflow).toContain( | ||
| 'echo "::error::npm install of @qwen-code/qwen-code@${VERSION} failed after 3 attempts"', | ||
| ); | ||
| expect(workflow).toContain('for attempt in 1 2 3; do'); | ||
| expect(workflow).toContain('if [[ "${attempt}" -lt 3 ]]; then'); | ||
| expect(workflow).toContain('sudo rm -rf "${PKG_DIR}"/.qwen-code-*'); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The triage version-pin — this PR's central bugfix — has no test, while the PR adds readFileSync/string-match tests for the other two workflow changes and the repo has an established convention of pinning workflow invariants this way (
scripts/tests/qwen-triage-workflow.test.js, ~5500 lines, reads this same workflow intoworkflow). A repo-wide grep forqwen_cli_version/ensure_qwen/ theversion=$(qwen --version)capture matches only the action's docs — nothing inscripts/tests/. — Failure scenario: a future edit deletes theqwen_cli_version:line, or breaks theecho "version=$(qwen --version)" >> "${GITHUB_OUTPUT}"capture so the output resolves empty; the action's unconditional global reinstall then silently falls back tolatestresolved through the runner's stale npm cache — the exact downgrade this PR fixes — with no failing test. Suggested fix (inscripts/tests/qwen-triage-workflow.test.js):中文说明
triage 的版本固定——本 PR 的核心修复——没有测试;而本 PR 为另外两处 workflow 改动都加了 readFileSync/字符串匹配测试,且仓库已有用这种方式固定 workflow 不变量的约定(
scripts/tests/qwen-triage-workflow.test.js,约 5500 行,读取的正是同一个 workflow 并存入workflow)。全仓库 grepqwen_cli_version/ensure_qwen/version=$(qwen --version)捕获,只命中该 action 的文档,scripts/tests/中没有任何命中。— 失败场景:未来某次编辑删除qwen_cli_version:行,或破坏echo "version=$(qwen --version)" >> "${GITHUB_OUTPUT}"捕获使输出解析为空;action 的无条件全局重装会静默回退到经 runner 陈旧 npm 缓存解析的latest——正是本 PR 修复的降级——且没有任何测试失败。建议的修复(在scripts/tests/qwen-triage-workflow.test.js)见上方代码块。— qwen3.8-max-preview via Qwen Code /review (v0.21.3)