jenkins-pipeline

How to link Jenkins build information with JIRA issue

帅比萌擦擦* 提交于 2021-01-28 10:43:56
问题 I am looking for an API to add build information to JIRA issues. My CI is Jenkins. I would assume it would behave in the same manner as Bamboo builds I have been searching in here: https://developer.atlassian.com/cloud/jira/platform/rest/ https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/ https://jenkinsci.github.io/jira-steps-plugin/ and I haven't found anything. Is this feature reserved for Bamboo? 回答1: I think you need to install jira plugin and that will enable you to use JIRA

How to link Jenkins build information with JIRA issue

[亡魂溺海] 提交于 2021-01-28 10:42:40
问题 I am looking for an API to add build information to JIRA issues. My CI is Jenkins. I would assume it would behave in the same manner as Bamboo builds I have been searching in here: https://developer.atlassian.com/cloud/jira/platform/rest/ https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/ https://jenkinsci.github.io/jira-steps-plugin/ and I haven't found anything. Is this feature reserved for Bamboo? 回答1: I think you need to install jira plugin and that will enable you to use JIRA

Jenkins pipeline - how to load a Jenkinsfile without first calling node()?

喜夏-厌秋 提交于 2021-01-28 09:00:40
问题 I have a somewhat unique setup where I need to be able to dynamically load Jenkinsfiles that live outside of the src I'm building. The Jenkinsfiles themselves usually call node() and then some build steps. This causes multiple executors to be eaten up unnecessarily because I need to have already called node() in order to use the load step to run a Jenkinsfile, or to execute the groovy if I read the Jenkinsfile as a string and execute it. What I have in the job UI today: @Library(value=

How can i read Jenkins pipeline console output during execution using Python Script?

泄露秘密 提交于 2021-01-28 07:51:44
问题 I have a requirement to read the console output of a previous stage(of the pipeline) during the pipeline execution. The console output from previous stage will be input to a python script, which i am running in the next stage. Please suggest 回答1: If you use Blue Ocean Plugin, you can retrieve stage-wise console output using Blue Ocean REST API. A stage in Blue Ocean URL is denoted by a node number when you click that stage. For example, in the URL .../blue/organizations/jenkins/<job_name>

Error while executing another process through Groovy script

若如初见. 提交于 2021-01-28 05:30:23
问题 I'm invoking another process through Groovy script of Jenkins pipeline. Following is simple one script - pipeline { agent {label 'xxx.xxx.xx.xx} stages { stage('Test') { steps { script { sh 'pwd' def path = "pwd".execute().text } } } } } sh 'pwd' works perfectly fine. However "pwd".execute().text results into following error - java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>

Jenkins Pipeline - inserting variable in shell creates a new line

喜欢而已 提交于 2021-01-28 05:25:37
问题 I am using Choice param in my jenkins file to select environment as follows: pipeline { agent any parameters { choice( name: 'ENVIRONMENT_URL', choices: "https://beta1.xyz.com\nhttps://beta2.xyz.com\nhttps://beta3.xyz.com", description: 'interesting stuff' ) } in the Stage section, i have the following piece stage('execute tests') { steps { script { sh """URL=${ENVIRONMENT_URL} npm run e2e:tests""" sh 'echo -e "\nTest Run Completed.\n"' } } } However, when i run the pipeline job by selecting

No closing tags while building xml file with MarkupBuilder

倾然丶 夕夏残阳落幕 提交于 2021-01-28 01:55:08
问题 I want to use Groovy in my Jenkins-Pipeline-Job to build a Statuslist of my Jenkins Slaves and the installed nodes. Therefore I have some lists which should be displayed in xml. While testing with IntelliJ i wrote the following code. import groovy.xml.MarkupBuilder def listNodeNames = [] listNodeNames << 'SLAVE1_NODE_1' listNodeNames << 'SLAVE1_NODE_2' listNodeNames << 'SLAVE2_NODE_1' listNodeNames << 'SLAVE2_NODE_2' def listComputerNames = [] listComputerNames << 'SLAVE1' listComputerNames <

Jenkinsfile windows cmd output variable reference

十年热恋 提交于 2021-01-27 23:45:30
问题 I'm pretty new to groovy.In my Jenkinsfile i am trying to store a windows cmd output in a variable, use it in the next command, but nothing seems to be working. This is the closest i got: pipeline { agent any stages { stage('package-windows') { when { expression { isUnix() == false} } steps { script { FILENAME = bat(label: 'Get file name', returnStdout: true, script:"dir \".\\archive\\%MY_FOLDER%\\www\\main.*.js\" /s /b") } bat label: 'replace content', script: "powershell -Command \"(gc \"

How to persist Properties in jenkins pipeline?

南楼画角 提交于 2021-01-27 23:11:14
问题 In my jenkins pipeline I am working with properties stored in file. I can read properties from file and add new items to the map using this code, but I do not understand how to persist my changes. node('hozuki-best-girl') { def propertiesPath = "${env.hozuki_properties}" def props = readProperties file: propertiesPath props['versionCode'] = 100500 } What should I do in order to persist my changes? There is no writeProperties method here https://jenkins.io/doc/pipeline/steps/pipeline-utility

How to copy artifacts from upstream project in Jenkins?

不羁岁月 提交于 2021-01-27 20:12:01
问题 I have two upstream projects(Pro1, Pro2). Both of the upstream projects archive artifacts. I want to create one downstream projects to copy artifacts from the upstream project who trigger the downstream project. For example, if the downstream is triggered by Pro1 , then it will copy the artifacts from Pro1 not Pro2 . In Jenkins, I can configure a project to copy artifacts from other projects but I have to specify the other project name. How can I specify a runtime project name in this case?