安装go-1.17时通过Jenkins工具出现输入格式错误或输入包含无法映射的字符。

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

Malformed input or input contains unmappable characters when installing go-1.17 via Jenkins tool

问题

你好,我正在尝试在Jenkins代理中设置go-1.17环境,但遇到了与无法映射字符相关的问题。是否有任何解决方案?

输出:

正在从https://golang.org/dl/go1.17.linux-amd64.tar.gz解压Go到/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] Pipeline结束
还有:hudson.remoting.Channel$CallSiteStackTrace: 从<some_ip>的JNLP4-connect连接的远程调用
		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: 输入格式错误或输入包含无法映射的字符:/home/ubuntu/Jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/go-1.17/go/test/fixedbugs/issue27836.dir/Äfoo.go

Jenkinsfile

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(通过系统信息进行检查)

英文:

Hi, i'm trying to set up go-1.17 env to a jenkins agent but i have an issue related to unmappable characters
Is there are any solution ?

Output:

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

Jenkinsfile

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'
            }
        }
    }
}

Agent and master file encodings are UTF-8 (Checked via system information)

答案1

得分: 2

在代理配置中,点击高级,在JWM选项中输入以下内容:

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

然后重新连接代理,应该就可以了。

英文:

In the agent configuration click Advanced and in JWM Options type

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

Then reconnect your agent and it will probably OK

huangapple
  • 本文由 发表于 2022年1月7日 21:55:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/70622257.html
匿名

发表评论

匿名网友

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

确定