Questions tagged [jenkins-pipeline]

For questions specifically about Jenkins 2.0's pipeline architecture. This includes both declarative and scripted pipelines.

Filter by
Sorted by
Tagged with
73
votes
6answers
144k views

Cleanest way to prematurely exit a Jenkins Pipeline job as a success?

I have a job that will create files, unless one of the values being fed to it matches an older value. What's the cleanest way in Jenkins to abort or exit the job, without it being FAILED? It exiting ...
20
votes
2answers
27k views

How to build a complex parallel Jenkins pipeline?

I've been interested in converting our bespoke Jenkins integrations into a pipeline. However, I can't seem to figure out how to do it. Can anyone help me with the Jenkins script that could do the ...
17
votes
2answers
21k views

Running a background process in Pipeline job

I am looking for a way to run a java process in background using Jenkins declarative pipeline. Below is the snippet of code stage('Deploy'){ steps{ script{ withEnv(...
13
votes
2answers
14k views

Triggering specific pipeline builds for monorepos in Jenkins

I'm in the process of converting multiple repositories into a single repository, our CI tool of choice is Jenkins due to the conversion of multiple repository structures into a single one 2 main ...
13
votes
3answers
9k views

Using Artifactory plugin in Jenkins declarative pipeline

I am using Jenkins Declarative Pipeline to automate my build process. We want to publish our artifacts to a remote JFrog repository only if certain conditions (Sonar,Checkmarx) pass. After a bit of ...
12
votes
3answers
14k views

Jenkins: Permission issue using Docker as build environment

I installed Jenkins on an Ubuntu 16.04 machine. The Jenkins itself is not run in a container. What I want to do is simply call yarn install using a node image. So here is my Jenkinsfile: pipeline { ...
11
votes
3answers
8k views

One Jenkinsfile or multiple?

So I have a Jenkinsfile defining a build pipeline and then a Jenkins job (not pipeline) with a very simple deployment script for our Docker stacks. Seeing that Jenkinsfiles can become as complex and ...
11
votes
2answers
14k views

Get all change logs of since last successful build in Jenkins Pipeline

In my Jenkins pipeline, I can get change logs of the current build by this. def changeLogSets = currentBuild.changeSets Is there a way to get all change-logs since last successful build?
11
votes
1answer
7k views

Jenkins Pipeline job; proper quoting for slackSend step

This is probably 100% user error, but I can't get a pipeline job to use a variable as the channel name in a slackSend step. This uses both the Slack plugin and the Build User Vars Plugin. I'm trying ...
10
votes
2answers
23k views

How to disable some branches in Multibranch Jenkins Builds?

I have a multibranch job set to run any branch with a Jenkinsfile. I have some options I can think of if I want to remove a branch from the list of jobs running for the multi-branch pipeline. I can ...
10
votes
2answers
7k views

Is there a way to run the Jenkinsfile from command line?

I don't want to use Jenkins UI, instead I would like to use the command line, from command line I want to execute Jenkinsfile to the Jenkins server. Is this possible? Let's say I have a Jenkinsfile, ...
9
votes
1answer
5k views

How do I trigger scripts on a merge or when a branch is deleted?

I am using jenkins multibranch pipelines. If a branch is merged and deleted jenkins removes the branch from the pipeline as well. This is great, but I want to run a command/script when a branch is ...
9
votes
1answer
293 views

Force Jenkins to reschedule parallel pipeline step as soon as node goes offline

Exactly this. In our environment, we're using GCE preemptible nodes and the Jenkins GCE plugin. As a consequence of this, it's highly likely (even expected) that a node will go away during the course ...
8
votes
3answers
38k views

How to define variable in Jenkins scripted pipeline?

I defined variable in declarative Jenkins pipeline script but having issues with simple variable declaration. Here is my script: pipeline { agent none stages { stage("first") { ...
8
votes
4answers
6k views

How to restore default Jenkins plugins?

I do a lot of testing in my Jenkins VM which I have on my local laptop. I found this time-consuming to remove Jenkins and installing again from scratch. It would be better if I have a simple way to ...
8
votes
3answers
8k views

Jenkins Pipeline and stash Pull Request Builder not working on PR create/update

Below is the requirement needed to achieve using the Jenkins Pipeline and i am new bee into Jenkins Pipeline. After completing development work and pushing his changes to Bitbucket the user creates a ...
8
votes
1answer
571 views

Jenkins Artifactory plugin not downloading in multi-thread

In my company we're having a bad time trying to download with the Artifactory plugin in Jenkins because we have a lot of tiny files in our repository and apparently the plugin works in a single thread,...
7
votes
1answer
20k views

sshagent and jenkinsfile

I am new to Jenkinsfile. I have previously configured my Jenkins job from GUI, and we are now upgrading our server to use Jenkinsfile. My job contains a section which needs to SSH to another server. ...
7
votes
2answers
6k views

How to check out GitHub repo after specifying skipDefaultCheckout in Jenkins declarative pipeline?

I have a Jenkins pipeline in which I build in one stage and test in another. I'd like them to be different machines since they have different capabilities. I have something like the following so far: ...
7
votes
1answer
11k views

How not to break Jenkins Pipeline when adding new parameters (declarative pipeline)

An Issue I have been struggling with is whenever I add a new parameter to a Jenkins Pipeline, the next job will not correctly get this parameter. This is especially an issue if those parameters are ...
7
votes
1answer
5k views

In Jenkins, how can parameters that contain spaces be referenced?

Google has failed to even lead me to a proper answer as to why spaces are permitted in names of Jenkins parameters, let alone how to reference them. Assuming it's not just a major oversight, how does ...
7
votes
3answers
5k views

Where should we keep application properties file while doing build promotion using Jenkins?

We are using spring boot to develop Java backend services. application.properties file has the database configurations. We are deploying in 4 different environments (dev, test, UAT, and production). ...
7
votes
1answer
7k views

Jenkins Pipeline - input only if branch matches

I want to ask for input but only if we are on a certain branch. But the input is run before the when. Can this be done with declarative syntax? For example this will always prompt even when the ...
6
votes
2answers
922 views

Jenkins managing a pool of servers across restarts

I have a pool of servers to test a provisioning process my team owns. One server is needed per branch or PR. The process requires reboots. Once the process is run, we run some tests. A Jenkins ...
6
votes
2answers
13k views

Is it possible to use a JenkinsFile in one repo to build and deploy a related repo?

Our team has two separate repositories for a frontend/backend system. They would like to have these two repositories deployed to the shared team environment together. My understanding of the ...
6
votes
2answers
4k views

PRs not automatically getting trigger in Jenkins github organization

We are using Github for source control and Jenkins for our builds. In Jenkins, we are using GitHub Organization Folder plugin along with Multibranch pipeline plugin. This causes the repository to ...
6
votes
3answers
3k views

Is there something like Jenkins pipeline scripts for Bamboo?

In Jenkins I setup my tasks using groovy pipline scripts stored in git or subversion. This way I only need to setup the input of the required parameters. The processing (additional checkouts, ...
5
votes
3answers
7k views

How to retrigger a Jenkins build after failure using declarative syntax?

I am using declarative pipeline syntax. I want to re trigger my build for 3 times if it fails. I want to add this step in my pipeline may be in post step: Something like below: post { failure{ ...
5
votes
3answers
3k views

Jenkins Pipeline downstream job; exit unless it hasn't run in the last x hours

Is there a way in Groovy directly or by integrating Jenkins plugins to have a downstream job complete only if it hasn't been run in the last X hours already? Let's say I have unit tests, when green, ...
5
votes
3answers
2k views

Why does the Jenkins bitbucket-build-status-notifier-plugin post the status to the shared pipeline library repository?

I am attempting to implement the Jenkins bitbucket-build-status-notifier-plugin, found here: https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin We used the shared-pipeline code ...
5
votes
1answer
9k views

Jenkins Pipeline “Build when a change is pushed to GitLab”

I have a Jenkins declarative pipeline that is ran via a webhook from GitLab whenever a change is pushed to my repo. In Jenkins, I have the following trigger option selected: Is there a way for me to ...
5
votes
3answers
145 views

What is the optimal size of a Jenkins Pipeline Stage?

Should I create single checkout stage or multiple stages like checkout scripts, checkout code, checkout something else? How should I decide on what piece of logic to put into separate stage? Or are ...
5
votes
1answer
7k views

Trigger jenkins pipeline job with Bitbucket hook

I'm missing something obvious here. Is there no way to trigger a Jenkins scripted pipeline job via Bitbucket hook? There's a bug out about it but it's been around for years with apparently no fix. ...
5
votes
1answer
6k views

Get changes of the parameterized pipeline on the fly in Jenkins

Is it possible to get changes of the parameterized pipeline on the fly after making changes there? For example I have a pipeline code: properties([ parameters([ string(name:...
5
votes
1answer
2k views

Jenkins Promote Build across different pipeline?

In my workplace, we are using a monolithic repo. It contains many project and micro services that run on different Jenkins pipeline. I know that using Promoted Build Plugin, we can promote build of ...
5
votes
1answer
117 views

How to properly automate CM based on log events?

Let's say I have a number of tools like Docker bench security, some static security scanners, etc. Now I have let's say free Ansible edition (no expenses are considered). I have lots of logs, but not ...
5
votes
3answers
2k views

Determine the URL for a SCM trigger from inside the build

My Jenkins is affected by a known Jenkins bug where it will trigger jobs that have an SCM poll set if a change to the shared library happens. I can't have this, so I thought I would get the trigger ...
4
votes
2answers
499 views

How to perform continuous Integration using Jenkins?

I've the basic idea about the Continuous Integration using Jenkins like- basic project setup, setting up source code management bit-bucket and build the project. I have done this so far and following ...
4
votes
2answers
4k views

How to check return status of parallel branches in jenkins pipeline

I am running a Jenkins job on multiple slaves. Following is the code structure: def branches = [:] def allNodes = Jenkins.getInstance().getNodes() for (int i =0; i < allNodes.size(); i++) { ...
4
votes
1answer
515 views

How to stop VPN connection started from Jenkins?

I've just discovered this site and I would like to ask my first question. I have a pipeline project on Jenkins that basically do this: SVN update Build Deploy As the deploy target machine is on a ...
4
votes
2answers
7k views

How to export Cucumber Reports via Jenkins Pipeline

I'm using the Cucumber Reports Plugin for Jenkins and I want to be able to export the HTML reports so they can be posted on an external portal. I can see that there is a folder named cucumber-html-...
4
votes
1answer
6k views

Multiple levels of parallel stages in a Jenkins declarative pipeline

I need to define a declarative pipeline with multiple levels of parallel stages as such: 1 Prebuild_action1 2 Prebuild_action2 3.1 Build platform_1 4.1 Test1 platform_1 4.2 Test2 platform_1 4....
4
votes
1answer
9k views

Jenkins Job vs Jenkins Pipeline

BACKGROUND : We have one Selenium automation project which is shared in BitBucket repository. Project is maven project. we have 10 testng.xml files for all modules OVERVIEW: Now we want to trigger ...
4
votes
1answer
7k views

How to test whether a variable exists in the declarative pipeline

I am using the Build User Vars Plugin which sets various variables in the pipeline. Here is what I am currently trying: wrap([$class: 'BuildUser']) { def safeBuildUser = binding.hasVariable('...
4
votes
2answers
624 views

Is containerized deployment of jenkins on ECS better than running jenkins inside EC2 instance to secure pipeline information?

I am new to AWS, docker and jenkins. I want to run a jenkins build pipeline and I have tried using following two ways on AWS: Running jenkins inside the EC2 instance following the steps at this AWS ...
4
votes
1answer
2k views

Should I run CI on merge state or HEAD of branch in a PR?

I'm using Jenkins Pipeline with Github for our CI purposes and I'm trying to think what the strategy should be for what is checked out to run. Jenkins provides three options when discovering pull ...
4
votes
2answers
7k views

How to start a VPN connection using Jenkins?

I'm on a Windows Server and I want to have a pipeline project on Jenkins that basically does this: SVN update Build Deploy As the deploy target machine is on a different network, I want to know how ...
3
votes
3answers
8k views

Jenkins shows the job as failed if there is nothing to commit to gitlab

I have been using one Jenkins job, that will pull repository from gitlab. Then it will modify the files and push it into gitlab (only if any user added any new files/modify contents in gitlab). ...
3
votes
4answers
4k views

Jenkins declarative pipeline: use branch if it exist

I'm currently trying to adopt my declarative pipeline in the following way: I have multiple stages, some apply for all branches, some only for specific names. What I'm now searching for is a way to ...
3
votes
1answer
19k views

Passing variables between scripts in a Jenkins pipeline

I have a declarative Jenkins pipeline that looks like the following: pipeline{ agent { ... } stages { stage("Provision EC2 Instance and Set ENV Variable"){ ...

1
2 3 4 5