Questions tagged [jenkins-declarative-pipeline]

A plugin tool for Jenkins which presents a simplified and opinionated syntax on top of the Pipeline sub-systems.

483 questions
0
votes
0 answers

in a jenkins pipeline, how can I access test metrics per stage?

Using a declarative pipeline, I have a many stages, including 8 that involve testing in which standardized results are published via the junit publisher. Unfortunately, any test failures in any stage automatically mark all stages as unstable (ugh).…
0
votes
1 answer

Pipeline syntax not recognized in PR build

I have a Jenkins pipeline for my github org using the shared library. The library works well for normal build when manually trigger or commit event. Library code like below: vars/MyPipeline.groovy call(body) { def usercfg = [:] …
0
votes
2 answers

Declrative Pipeline script with setting variables well before entering stages

i have a question on declarative pipeline scripting,am trying to set the variables dynamically depends on parameters passed before the stages start,say in environment block or node block Just with one parameter, i wanted to construct the other…
0
votes
0 answers

Post directive at pipeline level of jenkins declarative pipeline does not get executed on failure

Below is the skeleton of my Jenkinsfile. The post directive is executed on success but not in case of failure. Is this the expected behavior of jenkins? Thanks #!/usr/bin/env groovy pipeline { agent { node { label 'ent_linux_node' } } …
0
votes
1 answer

Jenkins Declarative Pipeline - SCM

I am taking some Jenkins tutorial. The sample code I read is pipeline { agent none stages { stage('Build') { agent { docker { image 'python:2-alpine' } } …
user6934519
0
votes
1 answer

Try Catch in Jenkins File

I am very new to jenkins pipeline and groovy . Please ignore environment variable i will use it in future Here i want to send start to slack and upon git pull if have to send success or failure based on project status. I am getting error at try for…
0
votes
0 answers

Jenkinsfile | Upload documents from Jenkins workspace to confluence

I need to upload documents from Jenkins workspace to confluence via Jenkinsfile. I followed up this link and started writing the basic code and sure that this will not work. Can anyone please add or comment or suggest me few links. void…
asur
  • 1,759
  • 7
  • 38
  • 81
0
votes
1 answer

Jenkins pipeline: use parent job's params and add to them to call child job

I have x2 declarative pipeline Jobs, both with many many params. How can I take the params provided to the parent, and add to them, to pass to the child job? I currently define them all individually, but this is prone to mistakes as there's a lot of…
Mark W
  • 5,824
  • 15
  • 59
  • 97
0
votes
1 answer

Best way for calling a variable inside jenkins groovy

I have written a shared library in groovy which is being used by many other Jenkins Declarative jobs. Those jobs use this shared library function and pass in the required values which then will be loaded into the shared library when the function…
0
votes
1 answer

Jenkins Pipeline Multibranch doesn't run post steps if there is merge conflicts

I have a multibranch pipeline with the following behaviors: And the following Jenkinsfile: pipeline { agent { label 'apple' } stages { stage('Lint') { when { changeRequest() …
0
votes
2 answers

Changed Environment Variable not reflecting inside the shell in Jenkins Pipeline

In Jenkins, I tried to set a environment variable with a empty value, and in stages I will update the value of the variable. but the shell script failed to get the latest value and the old value is echo. pipeline { agent { label…
0
votes
1 answer

How can I manipulate a string in environment section of Jenkins declarative pipeline

Here is the structure of my pipeline: def call(String microservice_param) { pipeline { environment { MICROSERVICE_NAME = "${microservice_param}".split("-")[1] } } I would like to manipulate the string parameter as shown above but I…
0
votes
2 answers

Jenkins declarative single pipeline if branch condition not working

Using a single declarative pipeline (not multibranch pipeline) Is there a way I can trigger a certain stage only if its the Master Branch ? I've been unsuccessful with the following: Stage('Deploy') { steps { script { if…
0
votes
0 answers

Jenkins declarative pipeline 1.3 run parallel for all jobs

I have setup a pipeline project similar to https://jenkins.io/doc/book/pipeline/syntax/#parallel-stages-example and it works fine. But I have created the same project for different jobs, so rather than creating new jobs can I run for loop for all…
0
votes
1 answer

Jenkins Declarative Pipeline

I am using Declarative Pipeline in Jenkins and i have more than 200 tests. I want to split them to many machines. i have a piece of code that i have to repair but i dont konw how. The documentation is not so good. Can someone explain me what is…