jenkins-pipeline

Send email on jenkins pipeline failure

巧了我就是萌 提交于 2020-01-11 15:37:15
问题 How can i add to a jenkins pipeline an old-style post-build task which sends email when the build fails? I cannot find "Post-build actions" in the GUI for a pipeline. I know that i can wrap the entire build script try/catch, however this seems ugly when the build script is large and continues to send emails even when the job was aborted manually. I would like to achive the same functionality as with the previouse email-ext based post-build action. try { // Do sth } catch(e) { emailext body: '

How to make Pipeline job to wait for all triggered parallel jobs?

强颜欢笑 提交于 2020-01-10 09:57:16
问题 I've Groovy script as part of the Pipeline job in Jenkins as below: node { stage('Testing') { build job: 'Test', parameters: [string(name: 'Name', value: 'Foo1')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Bar1')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Baz1')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Foo2')], quietPeriod: 2, wait: false build job:

How can I disable security checks for Jenkins pipeline builds

送分小仙女□ 提交于 2020-01-10 03:51:12
问题 I'm running Jenkins in a local trusted environment where I'm trying to run this pipeline. This Jenkinsfile is checked into git. #!groovy node('master') { def ver = pomVersion() echo "Building version $ver" } def pomVersion(){ def pomtext = readFile('pom.xml') def pomx = new XmlParser().parseText(pomtext) pomx.version.text() } The first few times I ran the build, I needed to manually approve changes (Jenkins->Mange Jenkins-> In-process Script Approval). Now I get this Exception and there is

Upload file in Jenkins input step to workspace

雨燕双飞 提交于 2020-01-10 03:18:05
问题 I would like to use the "input step" of Jenkins to upload a binary file to the current workspace. However, the code below seems to upload the file to the Jenkins master, not to the workspace of the current job on the slave where the job is running. Is there any way to fix that? Preferably without having to add an executor on the master or clutter the master disk with files. def inFile = input id: 'file1', message: 'Upload a file', parameters: [file(name: 'data.tmp', description: 'Choose a

How to print each element of Multi-line String Parameter?

夙愿已清 提交于 2020-01-09 11:39:50
问题 I've Pipeline job in Jenkins (v2.7.1) where I'd like to print each element of Multi-line String parameter ( Params ) with 3 strings in each line: Foo , Bar , Baz as an input. So I've tried the following syntax (using split and each ): Params.split("\\r?\\n").each { param -> println "Param: ${param}" } but it fails with: java.lang.UnsupportedOperationException : Calling public static java.lang.Object org.codehaus.groovy.runtime.DefaultGroovyMethods.each(java.lang.Object,groovy.lang.Closure) on

How to print each element of Multi-line String Parameter?

懵懂的女人 提交于 2020-01-09 11:38:21
问题 I've Pipeline job in Jenkins (v2.7.1) where I'd like to print each element of Multi-line String parameter ( Params ) with 3 strings in each line: Foo , Bar , Baz as an input. So I've tried the following syntax (using split and each ): Params.split("\\r?\\n").each { param -> println "Param: ${param}" } but it fails with: java.lang.UnsupportedOperationException : Calling public static java.lang.Object org.codehaus.groovy.runtime.DefaultGroovyMethods.each(java.lang.Object,groovy.lang.Closure) on

How to read properties file from Jenkins 2.0 pipeline script

◇◆丶佛笑我妖孽 提交于 2020-01-09 11:02:46
问题 I am attempting to write a pipeline script to use with Jenkins 2.0 to replicate our existing build. This original build used the envInject plugin to read a Java properties file, but I can't see how to do this from the pipeline Groovy script. I have Googled and found the following, but it doesn't work (FileNotFoundException): Properties props = new Properties() File propsFile = new File('./Builder/project.properties') props.load(propsFile.newDataInputStream()) Thanks! 回答1: I just fought with

file parameter uploaded file in Jenkins is missing

做~自己de王妃 提交于 2020-01-07 09:25:16
问题 Per File Parameter 'help text' on Jenkins build, Accepts a file submission from a browser as a build parameter. The uploaded file will be placed at the specified location in the workspace, which your build can then access and use. This is useful for many situations, such as: Letting people run tests on the artifacts they built. Automating the upload/release/deployment process by allowing the user to place the file. Perform data processing by uploading a dataset. The name of the submitted file

term <C:\Users\myuser\Desktop\New folder\abc.def.ps1> is not recognized as the name of a cmdlet, function, script file, or operable

放肆的年华 提交于 2020-01-07 09:23:36
问题 I am creating a jenkins pipeline with stages. In this pipeline stages calls the powershell file and execute the needful and completed the task. My issue here is, when executing the below code in one configured agent its working fine and in another agent when i trigger this pipeline job "term is not recognized as the name of a cmdlet, function, script file, or operable" error message is thrown in console. I am not sure why this stuff is happening. pipeline{ agent { label 'abc' } stages{ stage(

term <C:\Users\myuser\Desktop\New folder\abc.def.ps1> is not recognized as the name of a cmdlet, function, script file, or operable

孤者浪人 提交于 2020-01-07 09:23:08
问题 I am creating a jenkins pipeline with stages. In this pipeline stages calls the powershell file and execute the needful and completed the task. My issue here is, when executing the below code in one configured agent its working fine and in another agent when i trigger this pipeline job "term is not recognized as the name of a cmdlet, function, script file, or operable" error message is thrown in console. I am not sure why this stuff is happening. pipeline{ agent { label 'abc' } stages{ stage(