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
2 answers
How to assign value to jenkins node using a value from a property file
I am able to load a property file in Jenkins declarative pipeline. On echo, the values get printed too, in the console output. I want to use one of the values in the property file, say slavenode, as Jenkins label. However, I am not able to do so. I…

Shivani
- 219
- 1
- 14
0
votes
0 answers
Jenkins running docker save in parallel steps
I was trying to run docker save after build to store my docker image in a .tar file
snippet of script.sh:
#build new docker image
$docker build -f Dockerfile -t "$module":$imageversion .
#creating a copy
$docker save "$module":$imageversion >…

sailhenz
- 1,052
- 9
- 22
0
votes
1 answer
Jenkinsfile | Declarative pipeline | Run a Job after some specified time (in background)
I have a requirement to run a destroy job (which will destroy the instances) after testing. The testing will take around 1hr. So the instances can be destroyed after that, adding some leisure time, say after 2hrs.
Jenkins file
Run job-1
Run job-2 -…

smilyface
- 5,021
- 8
- 41
- 57
0
votes
0 answers
How to create a mask with parameters from the pipeline source code automatically in Jenkins?
I have some pipelines in Jenkins (storeed on github) and they successfully work when run.
All of these pipelines have the own set of parameters written in this way:
pipeline {
agent any
environment {
...
}
parameters {
…

Randomize
- 8,651
- 18
- 78
- 133
0
votes
1 answer
How to write a dynamic declarative pipeline that contains sequential job inside parallel job
I'm trying to write a declarative pipeline code that accepts a map and create a pipeline. I can able to achieve sequential stages or parallel stages but facing problems while making a pipeline that contains sequential stages inside parallel…

june
- 101
- 2
- 10
0
votes
1 answer
Parallel checkout in declarative Jenkins pipeline on multiple nodes
I'm developing a declarative Jenkins pipeline for CI builds, triggered from Gitlab. What I have now:
// variable definitions
pipeline {
agent none
parameters {
string(defaultValue: 'develop',
description:…

wl2776
- 4,099
- 4
- 35
- 77
0
votes
2 answers
Declarative Jenkins Pipeline: How can I iterate the same stage for different repositories?
I have several maven projects which are all treated in the same way to make a release.
Is it possible to reuse the same stage and iterate it just with a different repository name to clone?
stage('Maven_microservices') {
steps {
…

echedey lorenzo
- 377
- 1
- 5
- 19
0
votes
1 answer
Variable expansion in Jenkins declarative pipeline on Windows
Consider the following pipeline:
pipeline {
/* continuous build pipeline for jenkins */
agent any
environment {
/* initialize vairables for this job */
path_msbuild = 'C:\\Program Files…

DWRoelands
- 4,878
- 4
- 29
- 42
0
votes
1 answer
Compiling Visual Studio 2015 solutions from Jenkins declarative pipeline
I have a simple declarative pipeline as follows:
pipeline {
/* continuous build pipeline for jenkins */
agent any
environment {
path_visualstudio = 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe'
…

DWRoelands
- 4,878
- 4
- 29
- 42
0
votes
1 answer
What exactly is "Declarative Pipeline" in Jenkins? How to switch from the previous "pipeline" concept?
I am a bit confused about the concept of "Declarative Pipeline" in Jenkins.
Right now, I am using several Jobs of the "Multibranch-Pipeline" type of job.
I maintain "Shared Libraries", which combine a vars folder with reusable functionality. In the…

Thomas Hirsch
- 2,102
- 3
- 19
- 39
0
votes
1 answer
jenkins pipeline : How to execute a function on a list of agents in parallel?
I have a bunch of nodes serving labels rhel6, rhel7.
How do I execute myFunc() on any 2 nodes of rhel6 and any 3 nodes rhel7 - in parallel?
def slaveList = ['rhel6', 'rhel6', 'rhel7', 'rhel7', 'rhel7']
def stageFunc (String slaveLabel) {
return…

Mugdha Nene
- 11
- 3
0
votes
2 answers
How to unescape json response in pipeline DSL using groovy?
How do parse this json in jenkins pipeline. I tried several options link
org.groovy.StringEscapeUtils , JsonSlurper.
Nothing seems to work , Need help on the same
import groovy.json.JsonException
import groovy.json.JsonSlurper
try {
print…

Bit pattern
- 5
- 6
0
votes
0 answers
How to access number of tests passed, failed and total number of tests in declarative pipeline?
I have requirement to find number of passed tests, failed tests and total number of tests executed in declarative pipeline, so that I can put some condition and do my next actions.
I checked…

Swanand Gajendragadkar
- 101
- 10
0
votes
1 answer
how do i get a variable out of powershell in jenkins declarative pipeline?
steps {
script{
env.StorysTested = ''
try{
powershell('''
//some code here
foreach ( $item in $Comments )
{
…

Hitesh
- 36
- 4
0
votes
2 answers
How to fail declarative Jenkins pipeline if maven tests fail?
I am running a declarative pipeline like this -
stage ('Integration Tests') {
steps {
bat "mvn clean verify"
}
}
How can I fail this pipeline if integration tests fail? I have tried wrapping the step inside a script with try-catch…

Saikat
- 14,222
- 20
- 104
- 125