我有类似mliebelt的情况,而我需要根据其提交消息中使用的问题ID,使用Jira将特定的Jira问题票据推进到其worfklow中的另一个阶段插件和工作流程"进展JIRA问题"动作。
我正在尝试将Hadi Tabani's answer调用到我的Jenkins工作中,但我无法在我的情况下使用它。
这是我在工作中运行的shell脚本:
xmlfile=$(curl -s "http://192.168.156.2:8080/job/TEST_PROJECT/${BUILD_NUMBER}/api/xml?wrapper=changes&xpath=//changeSet//comment")
re="TEST-([0-9])*"
if [[ $xmlfile =~ $re ]];
then issueKey=${BASH_REMATCH[0]}
fi
re2="([0-9])+"
if [[ $issueKey =~ $re2 ]];
then echo ISSUE_ID=${BASH_REMATCH[0]} > env.properties
fi
这是从Jenkins控制台输出的控制台错误。有什么想法吗?
Started by user Test User
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/TEST_PROJECT
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url ssh://192.168.156.2/opt/git/TEST_PROJECT.git # timeout=10
Fetching upstream changes from ssh://192.168.156.2/opt/git/TEST_PROJECT.git
> git --version # timeout=10
using GIT_SSH to set credentials jenkins_git_plugin_openssh_private_key
> git -c core.askpass=true fetch --tags --progress ssh://192.168.156.2/opt/git/TEST_PROJECT.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/development^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/development^{commit} # timeout=10
Checking out Revision f21ae0a0c612b9e9ecbcf213a113213efba6657f (refs/remotes/origin/development)
> git config core.sparsecheckout # timeout=10
> git checkout -f f21ae0a0c612b9e9ecbcf213a113213efba6657f
> git rev-list 2e550f0f99d231451e03d6c49fd0b6f23cba6953 # timeout=10
[TEST_PROJECT] $ /bin/sh -xe /tmp/hudson3294487698607557223.sh
+ javac HelloWorld.java
[TEST_PROJECT] $ /bin/sh -xe /tmp/hudson6212970969648351737.sh
+ curl -s http://192.168.156.2:8080/job/TEST_PROJECT/96/api/xml?wrapper=changes&xpath=//changeSet//comment
+ xmlfile=<changes><comment>TEST-8 starting Jenkins Build
</comment></changes>
+ re=TEST-([0-9])*
+ [[ <changes><comment>TEST-8 starting Jenkins Build </comment></changes> =~ TEST-([0-9])* ]]
/tmp/hudson6212970969648351737.sh: 4: /tmp/hudson6212970969648351737.sh: [[: not found
+ re2=([0-9])+
+ [[ =~ ([0-9])+ ]]
/tmp/hudson6212970969648351737.sh: 8: /tmp/hudson6212970969648351737.sh: [[: not found
[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - [ERROR] - The given properties file path 'env.properties' doesn't exist.
[EnvInject] - [ERROR] - Missing file path was resolved from pattern 'env.properties' .
[EnvInject] - [ERROR] - [EnvInject] - [ERROR] - Problems occurs on injecting env vars as a build step: java.io.IOException: The given properties file path 'env.properties' doesn't exist.
Build step 'Inject environment variables' changed build result to FAILURE
Build step 'Inject environment variables' marked build as failure
Updating TEST-8
Finished: FAILURE