jenkins-pipeline

Sort map by value in Groovy jenkins pipeline script

陌路散爱 提交于 2020-08-10 19:13:09
问题 How to do custom sort of Map for example by value in Jekins pipeline script? This code doesn't quite work in Jenkins pipeline script: Map m =[ james :"silly boy", janny :"Crazy girl", jimmy :"funny man", georges:"massive fella" ] Map sorted = m.sort { a, b -> a.value <=> b.value } The map is still not sorted. I decided to crate a separate question with better name and tags, because many people were struggling to find an answer here: Groovy custom sort a map by value 回答1: You will have to

How can I override a jenkinsfile's default parameters?

烂漫一生 提交于 2020-08-08 19:24:49
问题 Sometimes, we want to create multiple jobs that use the same Jenkinsfile instead of a single one. This could happen for example because we want to maintain logs divided based on parameters, instead of having a single job on which look for the right log. However, in this case, we can't use the parameter definition in the Jenkinsfile, because whatever default value we would define on the job instance would be overwritten by the following execution with whatever is defined in the Jenkinsfile

How can I override a jenkinsfile's default parameters?

╄→гoц情女王★ 提交于 2020-08-08 19:24:40
问题 Sometimes, we want to create multiple jobs that use the same Jenkinsfile instead of a single one. This could happen for example because we want to maintain logs divided based on parameters, instead of having a single job on which look for the right log. However, in this case, we can't use the parameter definition in the Jenkinsfile, because whatever default value we would define on the job instance would be overwritten by the following execution with whatever is defined in the Jenkinsfile

How can I override a jenkinsfile's default parameters?

雨燕双飞 提交于 2020-08-08 19:24:38
问题 Sometimes, we want to create multiple jobs that use the same Jenkinsfile instead of a single one. This could happen for example because we want to maintain logs divided based on parameters, instead of having a single job on which look for the right log. However, in this case, we can't use the parameter definition in the Jenkinsfile, because whatever default value we would define on the job instance would be overwritten by the following execution with whatever is defined in the Jenkinsfile

In Jenkins pipeline parallel stages, how to promptly kill other stages if one fail?

橙三吉。 提交于 2020-08-06 17:29:40
问题 If the job failed, I don't have to wait everybody to finish. Is it possible to abort the parallel stages that are still running. They must display as "aborted", not with a red cross icon, since the failed one must be highlighted. 回答1: Add parallelsAlwaysFailFast to your options and the whole pipelilne will stop if any (parallelized) stage fails. Quoting the source: parallelsAlwaysFailFast Set failfast true for all subsequent parallel stages in the pipeline. For example: options {

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

Multibranch pipeline with jenkinsfile in svn:external

邮差的信 提交于 2020-07-23 07:28:59
问题 I have set up a multibranch pipeline job for a repository in SVN. Since I want to keep the jenkinsfiles the same in all branches, they are not really located in the branches, but in a different location and only referenced via svn:externals. Unfortunately the multibranch pipeline does not seem to follow these references and doesn't find the jenkinsfiles (the paths are correctly set): Checking candidate branch /branches/aaa/bbb/ccc@HEAD ‘ddd\eee\fff\jenkinsfile' not found Does not meet

Multibranch pipeline with jenkinsfile in svn:external

喜你入骨 提交于 2020-07-23 07:27:28
问题 I have set up a multibranch pipeline job for a repository in SVN. Since I want to keep the jenkinsfiles the same in all branches, they are not really located in the branches, but in a different location and only referenced via svn:externals. Unfortunately the multibranch pipeline does not seem to follow these references and doesn't find the jenkinsfiles (the paths are correctly set): Checking candidate branch /branches/aaa/bbb/ccc@HEAD ‘ddd\eee\fff\jenkinsfile' not found Does not meet

Multibranch pipeline with jenkinsfile in svn:external

不打扰是莪最后的温柔 提交于 2020-07-23 07:26:28
问题 I have set up a multibranch pipeline job for a repository in SVN. Since I want to keep the jenkinsfiles the same in all branches, they are not really located in the branches, but in a different location and only referenced via svn:externals. Unfortunately the multibranch pipeline does not seem to follow these references and doesn't find the jenkinsfiles (the paths are correctly set): Checking candidate branch /branches/aaa/bbb/ccc@HEAD ‘ddd\eee\fff\jenkinsfile' not found Does not meet