gpt4 book ai didi

java - Jenkins 和 Perforce 密码问题

转载 作者:行者123 更新时间:2023-11-30 07:06:06 25 4
gpt4 key购买 nike

我正在使用 Jenkins 和 Perforce 来构建一个 maven 项目,我需要使用 maven-release 插件。我已经配置了我的项目并且构建进展顺利,直到我尝试使用相关的 Jenkins 插件使用 maven 发布插件。空运行一切顺利,但在尝试发布时我收到了这个令人讨厌的错误消息(如下)。由于某种原因,Jenkins 无法连接到 P4 服务器。此外,选中“在环境中公开 P4PASSWD”。

编辑 - 回答 Technext 的问题

  • 当您说试运行时,您是仅使用 Jenkins 还是从命令行执行它? 两者
  • 您具体在哪里设置 P4 的密码?在“全局证书”部分? 在项目配置中,在 Source Code Management->Perforce->Password 下
  • 您从哪里获得“在环境中公开 P4PASSWD”选项? 同一个地方
  • 在上面的日志中,这一行是否设置了 P4 "d:\program files\perforce\p4.exe"set 的密码? 此行公开了 P4 参数 - 所有参数(包括 P4PASSWD)均已正确设置。由于显而易见的原因,我已经删除了实际值...

这是错误信息:

Started by user David 
[EnvInject] - Loading node environment variables.
Building on master in workspace X:\hudson\jobs\myproject\workspace
Using master perforce client: myproject
[workspace] $ "D:\Program Files\Perforce\p4.exe" workspace -o myproject
[workspace] $ "D:\Program Files\Perforce\p4.exe" login -a -p
[workspace] $ "D:\Program Files\Perforce\p4.exe" -P *** workspace -o myproject
Last build changeset: 1062732
[workspace] $ "D:\Program Files\Perforce\p4.exe" -P *** changes -s submitted -m 1 //myproject/...
Sync'ing workspace to changelist 1062732 (forcing sync of unchanged files).
[workspace] $ "D:\Program Files\Perforce\p4.exe" -P *** -s sync -f //myproject/...@1062732
Sync complete, took 108 ms
[workspace] $ cmd /c call D:\apache-tomcat-6\temp\hudson368187580614800030.bat

X:\hudson\jobs\myproject\workspace>"d:\program files\perforce\p4.exe" set
P4CLIENT=myproject
P4PASSWD=***
P4PORT=***
P4USER=***

X:\hudson\jobs\myproject\workspace>exit 0
Parsing POMs
Downloaded artifact ...
[workspace] $ D:/ins/Java/jdk1.7.0_10.x64/bin/java -DcreateChecksum=true -cp X:\hudson\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.4.jar;X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1\boot\plexus-classworlds-2.5.1.jar;X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1/conf/logging jenkins.maven3.agent.Maven31Main X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1 D:\apache-tomcat-6\webapps\hudson\WEB-INF\lib\remoting-2.37.jar X:\hudson\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.4.jar X:\hudson\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.4.jar 51470
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f X:\hudson\jobs\myproject\workspace\pom.xml -DdevelopmentVersion=0.0.2-SNAPSHOT -DreleaseVersion=0.0.1 -Dresume=false release:prepare release:perform -X
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 18:22:22+0300)
Maven home: X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1
Java version: 1.7.0_10, vendor: Oracle Corporation
Java home: D:\ins\Java\jdk1.7.0_10.x64\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2008", version: "6.0", arch: "amd64", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1\conf\settings.xml
[DEBUG] Reading user settings from C:\...\.m2\settings.xml
[INFO] Scanning for projects...
[INFO] Downloading: ...
[INFO] Downloaded: ...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] proj-parent
[INFO] proja
[INFO] projb
[INFO] projc
[INFO] test-reactor
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test-reactor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.5:prepare (default-cli) @ test-reactor ---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **\release.properties, **\pom.xml.next, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.branch, **\pom.xml.tag
[INFO] No password found, proceeding without it.
[DEBUG] SCM path in pom: //depot/myproject
[DEBUG] Executing: cmd.exe /X /C "p4 -p *** where X:\hudson\jobs\myproject\workspace\pom.xml"
[DEBUG] Perforce password (P4PASSWD) invalid or unset.
[DEBUG] cannot find depot => using //depot/myproject
[DEBUG] Executing cmd.exe /X /C "p4 -d X:\hudson\jobs\myproject\workspace -p *** opened //depot/myproject/..."
[ERROR] CommandLineException Exit code: 1 - Perforce password (P4PASSWD) invalid or unset.

编辑 2 - 打印环境变量

根据 Technext 的要求,我在调用 release:prepare 时打印了相关的 P4 环境变量。变量都显示正确的值(隐藏在这里),但之后运行 p4.exe 声称 P4PASSWD 未设置

[INFO] Executing tasks
Build sequence for target(s) `main' is [main]
Complete build sequence is [main, ]

main:
[echo] P4CLIENT [myproject]
[echo] P4PASSWD [***]
[echo] P4PORT [***]
[echo] P4USER [***]
[INFO] Executed tasks
Notifying upstream projects of job completion
Join notifier requires a CauseAction
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test-reactor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.5:prepare (default-cli) @ test-reactor ---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **\release.properties, **\pom.xml.next, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.branch, **\pom.xml.tag
[INFO] No password found, proceeding without it.
[DEBUG] SCM path in pom: //depot/myproject
[DEBUG] Executing: cmd.exe /X /C "p4 -p *** where ***\pom.xml"
[DEBUG] Perforce password (P4PASSWD) invalid or unset.
[DEBUG] cannot find depot => using //depot/myproject
[DEBUG] Executing cmd.exe /X /C "p4 -d ****\workspace -p *** opened //depot/myproject/..."
[ERROR] CommandLineException Exit code: 1 - Perforce password (P4PASSWD) invalid or unset.

最佳答案

终于找到解决办法了。 Jenkins perforce 插件进行登录并发出票证,所以我不得不添加 -Dpassword=${P4TICKET}到“发布目标和选项”字段。它会导致 perforce SCM 提供程序运行带有 -P <P4TICKET> 的 p4 命令。旗帜。

感谢@Technext 的协助。

关于java - Jenkins 和 Perforce 密码问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25958838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com