jenkins-pipeline

Sending email from jenkins pipeline

萝らか妹 提交于 2020-04-18 05:35:49
问题 Hi I am trying to send email notification from jenkins pipeline but it is not sending any email. I am using the below script to send email: pipeline { agent any stages{ stage('Test'){ steps{ echo 'Ok' } } stage('Email'){ steps{ emailext (to: 'abc@xyz.com', replyTo:'abc@xyz.com', subject: "Email report from - '${env.JOB_NAME}'", body: 'test') } } } } The pipeline is being executed but I am not receiving any mail. 来源: https://stackoverflow.com/questions/60996636/sending-email-from-jenkins

Jenkins pass value of Active Choices Parameter

99封情书 提交于 2020-04-17 22:51:58
问题 I have a jenkins job with "Active Choices Parameter" and "Active Choices Reactive Parameter". pipeline { agent { label 'Agent_Name' } stages { stage('Build') { steps { script { def res=build job: 'App_Build', parameters: [string(name: 'ActiveChoicesParam', value: 'Dev'),string(name: 'ActiveChoicesReactiveParam', value: 'Server1')] } } } } } I am trying to call the jenkins job and pass parameter values using pipeline script. However, I am getting the following error: The parameter

Jenkins pass value of Active Choices Parameter

落花浮王杯 提交于 2020-04-17 22:51:02
问题 I have a jenkins job with "Active Choices Parameter" and "Active Choices Reactive Parameter". pipeline { agent { label 'Agent_Name' } stages { stage('Build') { steps { script { def res=build job: 'App_Build', parameters: [string(name: 'ActiveChoicesParam', value: 'Dev'),string(name: 'ActiveChoicesReactiveParam', value: 'Server1')] } } } } } I am trying to call the jenkins job and pass parameter values using pipeline script. However, I am getting the following error: The parameter

How to use Active Choices Reactive Reference Parameter in Jenkins pipeline(jenkinsfile)

江枫思渺然 提交于 2020-04-17 18:43:48
问题 I want achieve Picture 3. If no need update, give default value. If need update, then give user input area. I'd like use active reactive Reference in Jenkins pipeline code, not the jenkins GUI. Checked the example, but user cannot input the value by them self, only provide choices. As we can see the Jenkins GUI picture 1 and 2 can use "Formatted HTML" do this, but how can we use it in pipeline or convert it to pipeline? 来源: https://stackoverflow.com/questions/60802191/how-to-use-active

Run jenkins agent in docker container, issue with jenkins pipeline and /var/run/docker.socket

旧街凉风 提交于 2020-04-16 03:20:32
问题 I've created image that use for jenkins agent slave Here it is: https://hub.docker.com/r/kondaurov/jenkins_agent/~/dockerfile/ Than i run it: docker run -d -p 2222:22 --name=jenkins_agent -v /var/run/docker.sock:/var/run/docker.sock -v kondaurov/jenkins_agent Then i create new node in jenkins and it connects successfully via ssh I try to run this pipeline: pipeline { agent { docker { label 'agent01' image 'hello-world' } } stages { stage('Compile') { steps { sh 'whoami' sh 'echo $PATH' } } }

Can you identify from inside a jenkins pipeline if its the first run of a new branch?

半城伤御伤魂 提交于 2020-04-16 02:38:07
问题 Is it possible to see if a pipeline job is the first run of a newly discovered branch from inside the pipeline itself? If you could get a list of all the runs of a job maybe you could see if there are 0 previous runs and thereby know its the first run? 回答1: Use env.BUILD_NUMBER . env.BUILD_NUMBER == '1' if this is the first build. For newly discovered branches in Multibranch Pipeline (which I assume you use) this will work. 回答2: In case you mean to identify the build number from within the

java.io.NotSerializableException Error in Pipeline Scripting

偶尔善良 提交于 2020-04-11 08:21:49
问题 I'm using below code to load a Groovy file and to pass parameter: Pipeline Script in jenkins @NonCPS def ld() { def pck = load '/tmp/Provsioning/e.groovy'; return pck.xmlParseData("${params.hos_nam}"); } node { stage ('Deploying Packages'){ def aby = ld(); } } where ${params.hos_nam} is a build parameter and the installpackage groovy follows as below /tmp/Provsioning/e.groovy public class ReadXMLFile { def xmlParseData(String g){ installPackage(a,b,c); input 'proceed' aemRestart(b); } def

Declarative Pipeline with dynamic matrix axis values

前提是你 提交于 2020-04-11 06:17:43
问题 Hi I am trying to get a Jenknis-Declarative-Pipeline-Job work. The Use-Case should be pretty simple: I want to build multiple Plugins with the same Jenkins-pipeline. To do so I wrote a "JenkinsLibrary" with an interface the Plugins can use for parameters. One of this parameters is the axis-values. The Problem I have is pretty similar to this reddist post. I want to set the "values" of the "axis" of the matrix-build from a variable. I am out of Ideas, is this even possible? So here is my

trigger jenkins build on tag creation with multibranch pipeline

霸气de小男生 提交于 2020-04-10 14:28:20
问题 I've got a stage in my Jenkinsfile for building from a tag matching a tag name filter: stage('Build Release from Tag') { when { tag '*RELEASE' } In order to get tags to be discovered I've had to add tag discovery and a match for the tag name regex and to my pipeline under Branch sources > GitHub : The pipeline does discover tags that I push which match the filter. And if I click on one to run a build for it then it does run the build stage that matches the tag conditional. But I was expecting

Jenkins Choice parameter Passing to a pipeline Job

╄→尐↘猪︶ㄣ 提交于 2020-04-07 18:41:11
问题 Currently I have a pipeline job which has different paramters where one of this parameters is a Choice parameter. Here is the config.xml output of that job parameter: <hudson.model.ChoiceParameterDefinition> <choices class="java.util.Arrays$ArrayList"> <a class="string-array"> <string>f1</string> <string>f2</string> <string>f3</string> <string>f4</string> </a> </choices> <name>WHERE</name> <description>Something</description> </hudson.model.ChoiceParameterDefinition> Now I can call this job