jenkins-pipeline

Jenkins Multibranch Pipeline Lightweight Checkout

放肆的年华 提交于 2021-02-08 21:48:31
问题 The Jenkins Pipeline plugin has a feature known as "lightweight checkout", where the master only pulls the Jenkinsfile from the repo, as opposed to the entire repo. There's a corresponding checkbox in the configuration screen. I'd like to do a lightweight checkout in a multibranch pipeline, but I'm not seeing a checkbox in the multibranch configuration screen. Any ideas how to make this happen? I noticed some closed issues that suggest this feature is available, but I wasn't able to find any

No such DSL method 'pipeline' found among steps

不羁岁月 提交于 2021-02-08 14:59:57
问题 I keep getting this error for the declarative pipeline script in Jenkins. No such DSL method 'pipeline' found among steps My script is like this pipeline { agent any stages { stage('Example Build') { steps { echo 'Hello World' } } } } I have Jenkins version 2.19.4. Hopefully i have installed all the required plugins. Why do i get this exception ? 回答1: I think you have installed the latest plugins, 1.2. I had the same issue that after I upgraded the Pipeline: Model Definition to 1.2 my

Jenkins:How to Achieve parallel dynamic stages in jenkins declarative pipeline

ぐ巨炮叔叔 提交于 2021-02-08 11:03:53
问题 I am working on declarative pipeline. I am trying to achieve dynamic stages which should distribute the stages parallel with the agents defined. When i explored i learned how to achieve Dynamic sequential stages. Below is my sample code. My problem now is, how to achieve parallel stages with agents i have. For example, if i have 3 agents all the 5 stages should run parallel in the agents parallel. I tried using parallel tests but not working. Please help me to improve further ! def learn

Dynamic variable in Jenkins pipeline with groovy method variable

♀尐吖头ヾ 提交于 2021-02-08 08:01:34
问题 I have a Jenkinsfile in Groovy for a declarative pipeline and two created Jenkins variables with names OCP_TOKEN_VALUE_ONE and OCP_TOKEN_VALUE_TWO and the corresponding values. The problem comes when I try to pass a method variable and use it in an sh command. I have the next code: private def deployToOpenShift(projectProps, environment, openshiftNamespaceGroupToken) { sh """/opt/ose/oc login ${OCP_URL} --token=${openshiftNamespaceGroupToken} --namespace=${projectProps.namespace}-$

jenkins pipeline def new string parameter

◇◆丶佛笑我妖孽 提交于 2021-02-08 07:27:31
问题 I have a parameterized job with pipeline. for example: Predefined String Parameter: IP I'm trying to define a new String in the pipeline in order to use it as a new parameter when I'm calling to another "build job" I have tried the following method: import hudson.model.* node('master'){ if(ipaddr =='192.168.1.1'){ def parameter = new StringParameterValue("subnet", '255.255.255.0') //not working echo parameter //not working } stage ('Stage A'){ build job: 'jobA', parameters: [ [$class:

Difference between different jenkins pipeline plugin

柔情痞子 提交于 2021-02-07 17:55:01
问题 I am working on to setup regression for one of my project through jenkins. I am new to jenkins and kind of confused with so many available pipeline plugins. To name a few: Pipeline Plugin Build Pipeline Plugin Delivery Pipeline Plugin They all seem same to me. Can anyone help me decide when to use which plugin? Thanks. 回答1: While the idea is the same, they are very different in the way how you implement a deployment pipeline. Long story short: use the Pipeline plugin, which is the "new" way

Get list of branches in Jenkins multibranch pipeline

…衆ロ難τιáo~ 提交于 2021-02-07 04:18:49
问题 The Blue Ocean interface to a Jenkins multibranch pipeline project shows several branches that were automatically created. Is there a programmatic way to list the branches in the pipeline from code to be added to a Jenkinsfile? This question asks about Jenkins Project branch information located inside the Jenkins application object model, which should be accessible via the Jenkins API or CLI. I looked at all the variables that are available at http://<jenkins-home>/env-vars.html/ , but none

Get list of branches in Jenkins multibranch pipeline

≡放荡痞女 提交于 2021-02-07 04:17:20
问题 The Blue Ocean interface to a Jenkins multibranch pipeline project shows several branches that were automatically created. Is there a programmatic way to list the branches in the pipeline from code to be added to a Jenkinsfile? This question asks about Jenkins Project branch information located inside the Jenkins application object model, which should be accessible via the Jenkins API or CLI. I looked at all the variables that are available at http://<jenkins-home>/env-vars.html/ , but none

Get list of branches in Jenkins multibranch pipeline

最后都变了- 提交于 2021-02-07 04:17:03
问题 The Blue Ocean interface to a Jenkins multibranch pipeline project shows several branches that were automatically created. Is there a programmatic way to list the branches in the pipeline from code to be added to a Jenkinsfile? This question asks about Jenkins Project branch information located inside the Jenkins application object model, which should be accessible via the Jenkins API or CLI. I looked at all the variables that are available at http://<jenkins-home>/env-vars.html/ , but none

Jenkinsfile: permission denied when running sh step in Docker container

久未见 提交于 2021-02-06 20:49:56
问题 I have trouble running a simple Jenkinsfile - e.g. pipeline { agent { label 'ssh-slave' } stages { stage('Shell Test') { steps { sh 'echo "Hello World"' } } } } The logfiles of Jenkins on the master show that the container was started successfully but the build job crashes with a message like sh: 1: /home/jenkins/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied Here are some additional things that we configured / figured out: We are running the agent on a VM with RHEL We