How to use Go Beta/RC version in azure pipeline

huangapple go评论114阅读模式
英文:

How to use Go Beta/RC version in azure pipeline

问题

我想在 Azure Pipeline 中使用 Go 的 beta 版本或候选版本,但是 "Go 工具安装程序" 任务无法使用像 "1.17rc1" 这样的版本。

Pipeline

$(go_version) = 1.17rc1

  1. steps:
  2. - task: GoTool@0
  3. displayName: Install Go tools in version $(go_version)
  4. inputs:
  5. version: $(go_version)

Output

  1. 2021-07-15T08:01:13.5566938Z ##[section]Starting: Install Go tools in version 1.17rc1
  2. 2021-07-15T08:01:13.5573377Z ==============================================================================
  3. 2021-07-15T08:01:13.5573650Z Task : Go tool installer
  4. 2021-07-15T08:01:13.5574064Z Description : 在缓存中查找或下载特定版本的 Go,并将其添加到 PATH
  5. 2021-07-15T08:01:13.5574305Z Version : 0.180.0
  6. 2021-07-15T08:01:13.5574495Z Author : Microsoft Corporation
  7. 2021-07-15T08:01:13.5574776Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/tool/go-tool
  8. 2021-07-15T08:01:13.5575073Z ==============================================================================
  9. 2021-07-15T08:01:13.8414712Z Downloading: https://storage.googleapis.com/golang/go1.17rc1.linux-amd64.tar.gz
  10. 2021-07-15T08:01:16.3008064Z Extracting archive
  11. 2021-07-15T08:01:16.3027619Z [command]/usr/bin/tar xC /home/vsts/work/_temp/50a79994-bdb5-417d-8374-cd9746166c5f -f /home/vsts/work/_temp/d2be4a68-029c-4393-8492-5b804e41857e
  12. 2021-07-15T08:01:19.0933870Z Caching tool: go null x64
  13. 2021-07-15T08:01:19.1004014Z ##[error]TypeError: Cannot read property 'trim' of null
  14. 2021-07-15T08:01:19.1090132Z ##[section]Finishing: Install Go tools in version 1.17rc1
英文:

I want to use a beta or release candiate of Go in the azure pipeline, but the Task "Go tool installer" doesn't work with a version like "1.17rc1".

Pipeline

$(go_version) = 1.17rc1

  1. steps:
  2. - task: GoTool@0
  3. displayName: Install Go tools in version $(go_version)
  4. inputs:
  5. version: $(go_version)

Output

  1. 2021-07-15T08:01:13.5566938Z ##[section]Starting: Install Go tools in version 1.17rc1
  2. 2021-07-15T08:01:13.5573377Z ==============================================================================
  3. 2021-07-15T08:01:13.5573650Z Task : Go tool installer
  4. 2021-07-15T08:01:13.5574064Z Description : Find in cache or download a specific version of Go and add it to the PATH
  5. 2021-07-15T08:01:13.5574305Z Version : 0.180.0
  6. 2021-07-15T08:01:13.5574495Z Author : Microsoft Corporation
  7. 2021-07-15T08:01:13.5574776Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/tool/go-tool
  8. 2021-07-15T08:01:13.5575073Z ==============================================================================
  9. 2021-07-15T08:01:13.8414712Z Downloading: https://storage.googleapis.com/golang/go1.17rc1.linux-amd64.tar.gz
  10. 2021-07-15T08:01:16.3008064Z Extracting archive
  11. 2021-07-15T08:01:16.3027619Z [command]/usr/bin/tar xC /home/vsts/work/_temp/50a79994-bdb5-417d-8374-cd9746166c5f -f /home/vsts/work/_temp/d2be4a68-029c-4393-8492-5b804e41857e
  12. 2021-07-15T08:01:19.0933870Z Caching tool: go null x64
  13. 2021-07-15T08:01:19.1004014Z ##[error]TypeError: Cannot read property 'trim' of null
  14. 2021-07-15T08:01:19.1090132Z ##[section]Finishing: Install Go tools in version 1.17rc1

答案1

得分: 2

看起来是任务本身的问题。它在这里抛出错误:

  1. async function run() {
  2. try {
  3. let version = tl.getInput('version', true).trim();
  4. await getGo(version);
  5. telemetry.emitTelemetry('TaskHub', 'GoToolV0', { version });
  6. }
  7. catch (error) {
  8. tl.setResult(tl.TaskResult.Failed, error);
  9. }
  10. }

这有点奇怪,因为我没有看到任何逻辑阻止在这里放置1.17rc1。我在GitHub上为此创建了一个问题。

英文:

It looks like an issue with the task itself. It throws here:

  1. async function run() {
  2. try {
  3. let version = tl.getInput('version', true).trim();
  4. await getGo(version);
  5. telemetry.emitTelemetry('TaskHub', 'GoToolV0', { version });
  6. }
  7. catch (error) {
  8. tl.setResult(tl.TaskResult.Failed, error);
  9. }
  10. }

And this is kind of strange as I don't see here any logic preventing from putting there 1.17rc1. I created and issue for this on GitHub

huangapple
  • 本文由 发表于 2021年7月15日 16:10:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/68390160.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定