go - 通过 Jenkins 工具安装 go-1.17 时输入格式错误或输入包含不可映射的字符

标签 go jenkins jenkins-pipeline agent

嗨,我正在尝试为 jenkins 代理设置 go-1.17 env,但我遇到了与不可映射字符相关的问题 有什么解决办法吗?

输出:

Unpacking Go from https://golang.org/dl/go1.17.linux-amd64.tar.gz to /home/ubuntu/Jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/go-1.17 on api2
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from <some_ip>
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1797)
        at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
        at hudson.remoting.Channel.call(Channel.java:1001)
        at hudson.FilePath.act(FilePath.java:1165)
        at hudson.FilePath.act(FilePath.java:1154)
        at hudson.FilePath.installIfNecessaryFrom(FilePath.java:1010)
        at hudson.FilePath.installIfNecessaryFrom(FilePath.java:946)
        at org.jenkinsci.plugins.golang.GolangInstaller.performInstallation(GolangInstaller.java:57)
        at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:70)
        at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
        at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:220)
        at org.jenkinsci.plugins.golang.GolangInstallation.forNode(GolangInstallation.java:44)
        at org.jenkinsci.plugins.golang.GolangInstallation.forNode(GolangInstallation.java:22)
        at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:155)
        at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:136)
        at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: /home/ubuntu/Jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/go-1.17/go/test/fixedbugs/issue27836.dir/Äfoo.go

Jenkins 文件

pipeline {
    agent any
    tools {
        go 'go-1.17'
    }
    environment {
        GO111MODULE = 'on'
    }
    stages {
    stage('Setting up dependencies'){
        steps {
            echo 'Setting up dependencies'
            sh 'go mod vendor'
        }
    }
        stage('Build') {
            steps {
                echo 'Running build automation'
                sh 'go build -o main'
            }
        }
    }
}

代理和主文件编码为UTF-8(通过系统信息检查)

最佳答案

在代理配置中单击高级,然后在JWM 选项中键入

-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8

然后重新连接你的代理,可能就OK了

关于go - 通过 Jenkins 工具安装 go-1.17 时输入格式错误或输入包含不可映射的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70622257/

相关文章:

arrays - 在结构体的数组字段中转义 HTML

go - 我可以创建共享测试实用程序吗?

json - 在 Go 中加速 JSON 解析

docker - 如何让 docker-compose 在 Windows 上的 docker 生成的 jenkins 管道中工作?

jenkins - 在 groovy 文件/Jenkins 文件中运行一些 bash 代码

jenkins - 在 Jenkins 中正确配置多分支管道

go - 如何静态链接使用 crypto/tls 的 Go 二进制文件?

jenkins - "Project coverage is set to 0%"– Jenkins 中的 JaCoCo 和 Sonar with Ant

Jenkins 立即禁用构建

Jenkinsfile ${steps.env.BUILD_NUMBER} : bad substitution