我正试图在我的maven项目中使用Jenkins主从架构。我有windows机器上的Jenkins master和Linux机器上的slave。现在的问题是,当我运行Jenkins脚本时,它会给我一个错误,比如无法初始化git存储库,因为Jenkins正在尝试执行git。Linux从机上的exe。有人能告诉我怎么解决吗?
以下是我的Jenkins管道脚本和错误日志
node ('lx-dotoolsd1')
{
stage 'Checkout'
git branch: 'master', credentialsId: 'ee44e971-4cce-4e59-95b6-
da222007775b', url: ' http://o-heena@bitbucket:7990/scm/phoen/audit-
confirmation.git'
stage 'Test'
def pom = readMavenPom file: 'pom.xml'
print "Build: " + pom.version
env.POM_VERSION = pom.version
//batch 'mvn clean compile install'
//junit '**/target/surefire-reports/TEST-*.xml'
currentBuild.description = "v${pom.version} (${env.branch})"
}
错误如下
Started by user Patel,Heena
[Pipeline] node
Running on lx-dotoolsd1 in /var/jenkins/workspace/pipelineTest
[Pipeline] {
[Pipeline] stage (Checkout)
Entering stage Checkout
Proceeding
[Pipeline] git
Cloning the remote Git repository
Cloning repository http://o-heena@bitbucket:7990/scm/phoen/audit-confirmation.git
> git.exe init /var/jenkins/workspace/pipelineTest # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /var/jenkins/workspace/pipelineTest
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:656)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:463)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
at hudson.remoting.UserRequest.perform(UserRequest.java:152)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
此问题发生在您的Linux节点从全局工具配置访问Git路径时。
由于您的主计算机是Windows,因此路径指向Git。exe。
我想您还没有为您的从机设置Git路径。
超文本传输协议
问题内容: 我最近将bash执行命令重写为Jenkins管道。旧代码就像 现在,我使用管道脚本来包装命令,像这样 但是,我遇到了一个错误。当我尝试时,它会正确显示。所以我怀疑内部有问题。 在使用管道之前,命令在外壳执行中工作正常。因此,源代码安装在Jenkins服务器上,似乎管道脚本不知道源命令是什么。 如何在sh wrapd块中运行source命令? 问题答案: 替换为 请注意,第一个点后有一个
我想通过JobDSL生成基于管道插件的作业,该作业包含在Jenkins签出的git存储库中。 然而,我认为在作业DSL脚本中使用引用字符串的管道脚本不是很好。因此,我想将它们读入一个字符串,并将其传递给函数: 我必须把放在哪里才能工作?我试着把它放在我的DSL脚本旁边,也放在我的DSL源代码的文件夹中。但是Jenkins总是抛出一个“未找到文件”。
问题内容: 我正在尝试在我的Jenkins版本中屏蔽密码。 我一直在尝试mask-passwords插件。 但是,这似乎不适用于我的Jenkins管道脚本,因为如果定义了密码,然后在这样的脚本中使用它,则会得到: 如果使用,则其值将解析为。 那么,如何在Jenkins管道脚本中屏蔽密码? 问题答案: 最简单的方法是使用Credentials插件。 您可以在此处定义不同类型的凭据,无论是单个密码(“
问题内容: 我正在尝试编写管道脚本以与Jenkins 2.0一起使用来复制我们现有的构建。这个原始版本使用envInject插件读取Java属性文件,但是我看不到如何从管道Groovy脚本中执行此操作。我已经用Google搜索并找到了以下内容,但是它不起作用(FileNotFoundException): 谢谢! 问题答案: 我只是昨天和今天为此而战。我希望此功能更容易找到。 抓住“ Pipeli
问题内容: 我正在尝试从Jenkins管道中的文件运行Powershell脚本。 我已经阅读了本文,该文章显示了如何运行输入到管道中的Powershell脚本,但是我无法从文件中运行脚本。 我努力了: 和各种组合,但无法弄清楚该如何做。 问题答案: 很快就弄清楚了,该行应该已经阅读
我有一个Maven SpringBoot项目。我想把它推到云工厂。为此,我为Jenkins编写了一个groovy管道脚本。我要补充什么?在脚本和/或pom中。xml将其发布到Artifactory中,这样Jenkins将从Git中提取代码并将其发布到Artifactory。在另一个环境中,我将拉出artifactory版本化的JAR,并将其推送到Cloud Foundry。 假设我的项目的grou