How to use Go Beta/RC version in azure pipeline

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

How to use Go Beta/RC version in azure pipeline

问题

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

Pipeline

$(go_version) = 1.17rc1

steps:
  - task: GoTool@0
    displayName: Install Go tools in version $(go_version)
    inputs:
      version: $(go_version)

Output

2021-07-15T08:01:13.5566938Z ##[section]Starting: Install Go tools in version 1.17rc1
2021-07-15T08:01:13.5573377Z ==============================================================================
2021-07-15T08:01:13.5573650Z Task         : Go tool installer
2021-07-15T08:01:13.5574064Z Description  : 在缓存中查找或下载特定版本的 Go,并将其添加到 PATH 中
2021-07-15T08:01:13.5574305Z Version      : 0.180.0
2021-07-15T08:01:13.5574495Z Author       : Microsoft Corporation
2021-07-15T08:01:13.5574776Z Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/tool/go-tool
2021-07-15T08:01:13.5575073Z ==============================================================================
2021-07-15T08:01:13.8414712Z Downloading: https://storage.googleapis.com/golang/go1.17rc1.linux-amd64.tar.gz
2021-07-15T08:01:16.3008064Z Extracting archive
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
2021-07-15T08:01:19.0933870Z Caching tool: go null x64
2021-07-15T08:01:19.1004014Z ##[error]TypeError: Cannot read property 'trim' of null
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

steps:
  - task: GoTool@0
    displayName: Install Go tools in version $(go_version)
    inputs:
      version: $(go_version)

Output

2021-07-15T08:01:13.5566938Z ##[section]Starting: Install Go tools in version 1.17rc1
2021-07-15T08:01:13.5573377Z ==============================================================================
2021-07-15T08:01:13.5573650Z Task         : Go tool installer
2021-07-15T08:01:13.5574064Z Description  : Find in cache or download a specific version of Go and add it to the PATH
2021-07-15T08:01:13.5574305Z Version      : 0.180.0
2021-07-15T08:01:13.5574495Z Author       : Microsoft Corporation
2021-07-15T08:01:13.5574776Z Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/tool/go-tool
2021-07-15T08:01:13.5575073Z ==============================================================================
2021-07-15T08:01:13.8414712Z Downloading: https://storage.googleapis.com/golang/go1.17rc1.linux-amd64.tar.gz
2021-07-15T08:01:16.3008064Z Extracting archive
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
2021-07-15T08:01:19.0933870Z Caching tool: go null x64
2021-07-15T08:01:19.1004014Z ##[error]TypeError: Cannot read property 'trim' of null
2021-07-15T08:01:19.1090132Z ##[section]Finishing: Install Go tools in version 1.17rc1

答案1

得分: 2

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

async function run() {
    try {
        let version = tl.getInput('version', true).trim();
        await getGo(version);
        telemetry.emitTelemetry('TaskHub', 'GoToolV0', { version });
    }
    catch (error) {
        tl.setResult(tl.TaskResult.Failed, error);
    }
}

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

英文:

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

async function run() {
    try {
        let version = tl.getInput('version', true).trim();
        await getGo(version);
        telemetry.emitTelemetry('TaskHub', 'GoToolV0', { version });
    }
    catch (error) {
        tl.setResult(tl.TaskResult.Failed, error);
    }
}

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:

确定