jenkins-declarative-pipeline

When I use Kubernetes as my agent in Jenkins it will not allow another executor in stage

别来无恙 提交于 2020-12-11 02:45:33
问题 This is a subset of my declarative Jenkinsfile: pipeline { agent { kubernetes { yamlFile 'pod.yml' defaultContainer 'tools' } } stages { stage('Init') { // <- this stage executes in Kubernetes and works very well steps { sh "echo init" } } stage('Build') { agent { label 'B202981' } // <- This wont work; B202981 is computer on my network steps { sh "echo build" } } } } When this pipelines runs it fails with an exception which you can see here and googling this exception didn't helped me. java

Using Building Blocks in Jenkins Declarative Pipeline

情到浓时终转凉″ 提交于 2020-08-06 03:06:12
问题 I'm just starting with using Jenkins declarative pipelines. As I'm supporting a few similar projects I was thinking of putting similar pipeline steps (or even stages) into reusable building blocks. These blocks should be maintained at a central spot and then included by individual pipelines (speak: DRY). I saw shared libraries as an option for scripted pipelines but I'm not sure if it works for declarative pipelines, too. Do you know a way to use something like building blocks in Jenkins

Using Building Blocks in Jenkins Declarative Pipeline

浪子不回头ぞ 提交于 2020-08-06 03:06:10
问题 I'm just starting with using Jenkins declarative pipelines. As I'm supporting a few similar projects I was thinking of putting similar pipeline steps (or even stages) into reusable building blocks. These blocks should be maintained at a central spot and then included by individual pipelines (speak: DRY). I saw shared libraries as an option for scripted pipelines but I'm not sure if it works for declarative pipelines, too. Do you know a way to use something like building blocks in Jenkins

How would I store all failed stages of my declarative Jenkins pipeline

浪子不回头ぞ 提交于 2020-07-10 01:48:46
问题 In my Jenkins pipeline, I have 15 stages. Now I have a post function at the end of the Jenkins file to send me an email about whether the whole process is failed or success. I would like to include all the stages that are failed in the email too. Using post in each stage is not a good idea, because I would receive 15 emails each time the job runs. I am thinking of creating a list and save all failed env.STAGE_NAME in the list and print it at the end? But it would not allow me to do such a

How would I store all failed stages of my declarative Jenkins pipeline

北城以北 提交于 2020-07-10 01:47:28
问题 In my Jenkins pipeline, I have 15 stages. Now I have a post function at the end of the Jenkins file to send me an email about whether the whole process is failed or success. I would like to include all the stages that are failed in the email too. Using post in each stage is not a good idea, because I would receive 15 emails each time the job runs. I am thinking of creating a list and save all failed env.STAGE_NAME in the list and print it at the end? But it would not allow me to do such a