A plugin tool for Jenkins which presents a simplified and opinionated syntax on top of the Pipeline sub-systems.
Questions tagged [jenkins-declarative-pipeline]
483 questions
0
votes
1 answer
Declarative pipeline step for waiting for process to finish in order to mark stage as completed
Using declarative pipeline, how could i mark an stage completed based on a given condition?
For the following example, I want to mark the stage as completed when there's no processes running.
This example will be applied for checking when a given…

thclpr
- 5,778
- 10
- 54
- 87
0
votes
1 answer
Can i create a shared library .groovy script for a method in scripted pipeline into declarative
I am trying to convert all of the scripted pipelines at my workplace into declarative pipeline. I am new to this. I have a scripted pipeline that has 2 methods. I was able to finish the rest of the scripted to declarative but got stuck on methods.…

ameya
- 89
- 2
- 10
0
votes
1 answer
notify when Life of a git branch is greater than X days in Jenkins pipeline (declarative)
I am trying to achieve, posting a notification once the lifetime of a branch from Git is more than X days through jenkins declarative pipeline ... I have written some other emailext for post success and failures, but unable to do so the same for…

ameya
- 89
- 2
- 10
0
votes
1 answer
Jenkins declarative Pipeline: How to define UNSTABLE state
In Declarative Pipelines it's not possible to use the try{} catch{} method to parse result of a stage.
I need to set the status to UNSTABLE depending on the output of an sh script, any idea of how to achieve it?

Oriol Tauleria
- 199
- 1
- 5
0
votes
1 answer
How can I generate dynamic parameters in jenkins build pipeline using active choice parameter by reading from a file?
Currently I am using the following piece of code to generate dynamic parameters by reading from a properties file using the 'groovy script' option in 'active choice parameter'
jenkinsURL=jenkins.model.Jenkins.instance.getRootUrl()
def…

Aswini Vayyala
- 43
- 1
- 8
0
votes
1 answer
Calling a Jenkinsfile from a remote repo into build pipeline
I would like to pull a source controlled version of a Declarative Jenkinsfile into a multibranch jenkins job.
For example, I have 20 multibranch build job each building an application and deploying, each build job will have a static jenkinsfile…

Jason E
- 1
- 1
0
votes
0 answers
Jenkins declarative pipeline docker agent: Timeout run
I'm trying to improve my build times for my Jenkins jobs and am trying to build docker containers with my dependencies preinstalled.
I have the following (partial) Jenkinsfile:
pipeline {
agent {
docker {
image…

Paul Sachs
- 905
- 2
- 11
- 22
0
votes
1 answer
Archiving artifacts with same name
I'm using declarative pipeline as Jenkins job.
Stages 'Build' and 'Archive' run both in parallel to build and gather artifacts from nodes of different platforms (linux 32 & 64, windows, etc...)
Unfortunately, the artifacts are all of the same name.…

qdbp
- 109
- 1
- 1
- 12
0
votes
1 answer
Jenkins 2 Declarative pipelines - Is it possible to run all stages within a node (agent any) but having some of them running without it?
I have a CD pipeline that requires user confirmation at some stages, so I would like to free up server resources while the pipeline is waiting for the user input.
pipeline {
agent any
stages {
stage ('Build Stage') {
steps {
…

codependent
- 23,193
- 31
- 166
- 308
0
votes
1 answer
Jenkinsfile load groovy file doesn't work as expected
I have a Jenkinsfile with the following :
node('buildprod_iamsg'){
echo "\u001B[34mSending status to dynamodb pib-deployments ...\u001B[0m"
checkout scm
def dynamo = load "aws/dynamo.groovy"
…

Scooby
- 3,371
- 8
- 44
- 84
0
votes
1 answer
Jenkins Pipeline Collection method grep
I am trying to use the method grep from java.util.Collection inside a declarative pipeline, but it seems to have a different signature. In the script console I can execute the following simple example code, without problems:
[1,2,3,4].grep({ it == 4…

autarch princeps
- 170
- 1
- 2
- 11
0
votes
1 answer
Jenkinsfile access existing environment variable
How do I access an existing environment variable SOME_VAR inside of the environment block?
I want to redefine it under a new name NEW_VAR?
pipeline {
agent {
label any
}
environment {
SECRET =…

friederbluemle
- 33,549
- 14
- 108
- 109
-1
votes
1 answer
Convert Jenkins Pipeline script from SCM to Pipeline script
I want to convert it to Pipeline script. I have the following Jenkins 'Pipeline script from SCM':
How can I convert this to the 'Pipeline script'. I want to do this to make use of some Jenkin plugins. I know there is a 'Pipeline Syntax' helper…

Huckleberry Carignan
- 2,002
- 4
- 17
- 33
-1
votes
1 answer
Jenkins declarative pipeline to trigger another build, disable it & wait for it to complete
I have a use case wherein
I want to trigger another build from jenkins declarative pipeline
then as soon as another job is triggered I want to disable it
then I want to wait for it to complete
lastly I want to enable it again
Is there any clever…

Roshan007
- 658
- 2
- 7
- 15
-1
votes
1 answer
Jenkins declarative pipeline - How to assign an expression to a shell variable
stage ('Build image') {
steps {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'user', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh "tempPass=\$(aws…

user10916892
- 825
- 12
- 33