rollForward: latestMajor installs the latest LTS SDK even when it is older than sdk.version

未关闭
#802 1 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看

@kamronbatman 已经在做这个了。

开始于 2026年11月11日。

  • #803 来自 @kamronbatman —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
github-actions, typescript
领域
ci-cd, devops

调研方向

Start at getVersionFromGlobalJson and createChannelArgument, then trace how minimumVersion is used when selecting or installing an SDK; the issue describes the failing latestMajor path. Reproduce with the provided global.json and workflow on an Ubuntu runner, then check relevant tests for global.json and channel selection. Done when the selected SDK satisfies the declared minimum and the step cannot succeed after installing an incompatible SDK.

由索引模型根据 Issue 内容生成。

描述

bug

Description:
With rollForward: "latestMajor", getVersionFromGlobalJson clears the version (case 'latestMajor': version = ''), and createChannelArgument then resolves the empty version to --channel LTS. The declared sdk.version is kept only as minimumVersion, which filters already-installed SDKs but is never checked against what gets downloaded. When the required SDK belongs to a newer STS release, the action installs an older LTS SDK that does not satisfy global.json, and the step still succeeds.

dotnet-channel: STS cannot work around it: it only applies when dotnet-version: latest, and the version taken from global.json is empty, so the channel is ignored with a warning.

Task version:
v6.1.0

Platform:

  • Ubuntu
  • macOS
  • Windows

(Observed on Ubuntu; the code path is platform-independent.)

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
global.json:

{
  "sdk": {
    "version": "11.0.100",
    "rollForward": "latestMajor",
    "allowPrerelease": false
  }
}

Workflow step:

- uses: actions/setup-dotnet@v6
  with:
    global-json-file: global.json

Expected behavior:
The newest SDK that satisfies global.json: at least 11.0.100, or the newest active release if that is higher, matching how the dotnet host resolves latestMajor.

Actual behavior:
The SDK step resolves to the LTS channel and installs 10.0.x, below the declared sdk.version:

/__w/_actions/actions/setup-dotnet/v6/externals/install-dotnet.sh --skip-non-versioned-files --channel LTS
dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.404/dotnet-sdk-10.0.404-linux-x64.tar.gz
...
dotnet-install: Installed version is 10.0.404
dotnet-install: Installation finished successfully.

The step succeeds, so the mismatch only surfaces later, when the build cannot find an SDK that satisfies global.json.

Suggested fix:
For latestMajor, pick the newest active channel in the releases index whose version is at least minimumVersion, rather than always using LTS; or fail when the installed SDK is older than minimumVersion.

主要语言
TypeScript
星标
1.2k
派生
579
平均合并
6 天 4 小时
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

actions/setup-dotnet 的其他 Issue

查看 actions/setup-dotnet 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。