jenkins-pipeline

Xcode Build Error Jenkins: Your session has expired. Please log in

对着背影说爱祢 提交于 2019-11-29 11:59:41
问题 I'm trying to build my application using jenkins pipeline using shell command. Below is the command i'm using to build the app. sh 'xcodebuild -workspace projectname.xcworkspace - allowProvisioningUpdates -scheme projectname_UAT -sdk iphoneos - configuration Debug clean build' Below is the error i'm getting i console. note: Using new build system note: Planning build 2018-10-11 11:19:36.638 xcodebuild[92399:5181481] DVTPortal: Service '' encountered an unexpected result code from the portal (

Impossibility to iterate over a Map using Groovy within Jenkins Pipeline

爱⌒轻易说出口 提交于 2019-11-29 11:51:11
问题 We are trying to iterate over a Map , but without any success. We reduced our issue to this minimal example: def map = [ 'monday': 'mon', 'tuesday': 'tue', ] If we try to iterate with: map.each{ k, v -> println "${k}:${v}" } Only the first entry is output: monday:mon The alternatives we know of are not even able to enter the loop: for (e in map) { println "key = ${e.key}, value = ${e.value}" } or for (Map.Entry<String, String> e: map.entrySet()) { println "key = ${e.key}, value = ${e.value}"

Correct usage of stash\unstash into a different directory

点点圈 提交于 2019-11-29 11:30:33
问题 In one of my stages I need to copy the contents of two folders after a build is completed and copy to a different directory. I am actually converting a freestyle job to pipeline, and have been using the artifact deployer plugin. Reading around, it looks like stash and unstash commands should help with what I want to achieve. Can someone verify if this is the correct approach below please? stage('Build') { steps { sh ''' gulp set-staging-node-env gulp prepare-staging-files gulp webpack '''

How can I disable security checks for Jenkins pipeline builds

早过忘川 提交于 2019-11-29 09:51:52
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 nothing to approve. All I want to do is parse an XML file. Can these security checks be bypassed

How to determine the current operating system in a Jenkins pipeline

吃可爱长大的小学妹 提交于 2019-11-29 09:46:48
问题 What would be the way to determine the current OS a Jenkins pipeline is running? Context: I'm building a shared Jenkins pipeline script that should run on all platforms (windows, OSX, linux) and execute something different in each platform. I tried something like: import org.apache.commons.lang.SystemUtils if (SystemUtils.IS_OS_WINDOWS){ bat("Command") } if (SystemUtils.IS_OS_MAC){ sh("Command") } if (SystemUtils.IS_OS_LINUX){ sh("Command") } But even it is running on windows or mac node it

Initializing Jenkins 2.0 with pipeline in init.groovy.d script

我的未来我决定 提交于 2019-11-29 09:42:59
问题 For automation, I would like to initialize a Jenkins 2.0 instance with a pipeline job. I want to create a Groovy script that is copied to the /usr/share/jenkins/ref/init.groovy.d/ folder on startup. The script should create a Jenkins 2.0 Pipeline job for processing a Jenkinsfile from SCM. I cannot find the relevant Javadoc for the 2.0 pipeline classes or examples of how to do this. Previously, using Job DSL to create a pipeline, I used a Groovy script to create a FreeStyleProject with an

run jenkins pipeline agent with sudo

谁说胖子不能爱 提交于 2019-11-29 09:25:49
问题 I have an Jenkins Server running in an docker container and have access to docker an the host system, so far it is working well. Now I want to set up a pipeline testing an script inside an docker container. Jenkinsfile: pipeline { agent { docker 'nginx:1.11' } stages { stage('build') { steps { sh 'nginx -t' } } } } Error Message: > + docker pull nginx:1.11 > > Warning: failed to get default registry endpoint from daemon (Got > permission denied while trying to connect to the Docker daemon

Pipeline jobs - pass parameters upstream?

只谈情不闲聊 提交于 2019-11-29 07:33:48
TL;DR: Obviously in a Jenkins pipeline job you can easily pass parameters downstream. What I want to know is if you can pass them upstream . Use case: We have three jobs; job_one , job_two , and job_three . These are frequently run separately as only one stage is needed, but in increasingly more-frequent cases we'd like to be able to run all three back to back. The first and second rely on parameters you can define ahead of time, but the third needs a parameter that is generated from the second job (a file name whose structure is unknown until job_two runs). I have built umbrella , which calls

Check if a file exists in jenkins pipeline

丶灬走出姿态 提交于 2019-11-29 05:23:51
I am trying to run block if a directory exists in my jenkins workspace and the pipeline step "fileExists: Verify file exists" in workspace doesn't seem to work correctly. I'm using Jenkins v 1.642 and Pipeline v 2.1. and trying to have a condition like if ( fileExists 'test1' ) { //Some block } What are the other alternatives I have within pipeline? You need to use brackets when using the fileExists step in an if condition or assign the returned value to a variable Using variable: def exists = fileExists 'file' if (exists) { echo 'Yes' } else { echo 'No' } Using brackets: if (fileExists('file'

Hiding password in Jenkins pipeline script

馋奶兔 提交于 2019-11-29 05:23:41
问题 I'm trying to mask a password in my Jenkins build. I have been trying the mask-passwords plugin. However, this doesn't seem to work with my Jenkins pipeline script, because if I define the password PASSWD1 and then I use it in the script like this ${PASSWD1} , I am getting: No such DSL method '$' found among steps [addToClasspath, ansiColor, ansiblePlaybook, ....] If I use env.PASSWD1 , then its value will be resolved to null . So how should I mask a password in a Jenkins pipeline script? 回答1