jenkins-pipeline

Jenkins - Passing parameter to groovy function

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-13 03:14:52
问题 I've been trying to call another groovy function with parameters inside my pipeline without any luck. The groovy function I am passing the parameters to consists of a bash script, but this bash script does not recognize the parameter(s) I am passing to it. If however the parameter passed by i defined as a parameters {} in the pipeline, then it works, but I do not want this. PROBLEM: The shell script does not recognize/understand the arguments, the variables are empty, no value.

Jenkins - Passing parameter to groovy function

与世无争的帅哥 提交于 2020-12-13 03:12:35
问题 I've been trying to call another groovy function with parameters inside my pipeline without any luck. The groovy function I am passing the parameters to consists of a bash script, but this bash script does not recognize the parameter(s) I am passing to it. If however the parameter passed by i defined as a parameters {} in the pipeline, then it works, but I do not want this. PROBLEM: The shell script does not recognize/understand the arguments, the variables are empty, no value.

Jenkins - Passing parameter to groovy function

那年仲夏 提交于 2020-12-13 03:12:04
问题 I've been trying to call another groovy function with parameters inside my pipeline without any luck. The groovy function I am passing the parameters to consists of a bash script, but this bash script does not recognize the parameter(s) I am passing to it. If however the parameter passed by i defined as a parameters {} in the pipeline, then it works, but I do not want this. PROBLEM: The shell script does not recognize/understand the arguments, the variables are empty, no value.

Using groovy to parse JSON object in shell scripts for Jenkin

此生再无相见时 提交于 2020-12-12 12:09:26
问题 Say I have a JSON as following: {"id":"1.0.0-6", "version":"1.0.0", "build":6, "tag":"android-v1.0.0-6", "commitHash":"5a78c4665xxxxxxxxxxe1b62c682f84", "dateCreated":"2020-03-02T08:11:29.912Z"} I want to take out the version id from it in Jenkins Groovy file and pass the version id to a JIRA Plugin called XRAY so that it will create a build version as Label in JIRA. stage('Get App version') { steps { container('devicefarm') { steps { sh "LATEST_VERSION=$(curl ${APP_ARTIFACTORY_URL}/${XRAY

Using groovy to parse JSON object in shell scripts for Jenkin

谁说胖子不能爱 提交于 2020-12-12 12:08:24
问题 Say I have a JSON as following: {"id":"1.0.0-6", "version":"1.0.0", "build":6, "tag":"android-v1.0.0-6", "commitHash":"5a78c4665xxxxxxxxxxe1b62c682f84", "dateCreated":"2020-03-02T08:11:29.912Z"} I want to take out the version id from it in Jenkins Groovy file and pass the version id to a JIRA Plugin called XRAY so that it will create a build version as Label in JIRA. stage('Get App version') { steps { container('devicefarm') { steps { sh "LATEST_VERSION=$(curl ${APP_ARTIFACTORY_URL}/${XRAY

Using groovy to parse JSON object in shell scripts for Jenkin

北战南征 提交于 2020-12-12 12:07:50
问题 Say I have a JSON as following: {"id":"1.0.0-6", "version":"1.0.0", "build":6, "tag":"android-v1.0.0-6", "commitHash":"5a78c4665xxxxxxxxxxe1b62c682f84", "dateCreated":"2020-03-02T08:11:29.912Z"} I want to take out the version id from it in Jenkins Groovy file and pass the version id to a JIRA Plugin called XRAY so that it will create a build version as Label in JIRA. stage('Get App version') { steps { container('devicefarm') { steps { sh "LATEST_VERSION=$(curl ${APP_ARTIFACTORY_URL}/${XRAY

How to cleanup pipeline before checkout of repository in Jenkinsfile

末鹿安然 提交于 2020-12-12 11:39:48
问题 I want to make a clean before checkout operation which is described in Jenkins git plugin documentation: Clean before checkout Clean the workspace before every checkout by deleting all untracked files and directories, including those which are specified in .gitignore. ... But how can add this option to default checkout step which is doing as first step? I feel that it should be an option extended by git plugin which can be included to options block of Jenkinsfile as described in docs: The

Condition in Jenkins pipeline on the triggers directive

一笑奈何 提交于 2020-12-12 11:36:33
问题 Jenkins has a nice relatively comprehensive documentation about Jenkinsfile syntax. But I still not find there an answer is it possible to do a flow control on the top level of pipeline? Literally include something if just in pipeline {} section (Declarative) like: pipeline { if (bla == foo) { triggers { ...configuration } } or pipeline { triggers { if (bla == foo) { something... } } } triggers section is a section which can be included only once and only in the pipeline section. But if

Get SSH slave node hostname/IP in Jenkins pipeline

梦想与她 提交于 2020-12-12 08:29:16
问题 I'm using SSH slaves as nodes in a Jenkins pipeline script. Is there a way to fetch the hostname/IP of the node inside the pipeline (Jenkinsfile) script ? I'm deploying to a parameterized node and would like to echo the IP of the node at the end of the script. i.e: node('master') { checkout scm stash name: 'deploy', includes: 'modules/ci/,modules/compose/' } stage ('Deploy to remote server (SSH)') { node(${NODE}) { unstash 'deploy' withEnv(["BRANCH=${BRANCH}"]) { sh "chmod +x modules/ci

Get SSH slave node hostname/IP in Jenkins pipeline

[亡魂溺海] 提交于 2020-12-12 08:28:48
问题 I'm using SSH slaves as nodes in a Jenkins pipeline script. Is there a way to fetch the hostname/IP of the node inside the pipeline (Jenkinsfile) script ? I'm deploying to a parameterized node and would like to echo the IP of the node at the end of the script. i.e: node('master') { checkout scm stash name: 'deploy', includes: 'modules/ci/,modules/compose/' } stage ('Deploy to remote server (SSH)') { node(${NODE}) { unstash 'deploy' withEnv(["BRANCH=${BRANCH}"]) { sh "chmod +x modules/ci