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
15
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 ...
1
vote
1answer
1k views

Trigger a job and get the job log on the same page in Jenkins

I would like to trigger the job in Jenkins and also get the log on the same page. E.g. Kind of IDE where we can run the code in one side and get the output on the other side. Are there any tools ...
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 ...
6
votes
1answer
118 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 ...
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('...
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). ...
2
votes
1answer
2k views

Trigger downstream pipeline job via generated variable in upstream freestyle job

I have an upstream freestyle job and a downstream pipeline job. The freestyle job is triggered via a Bitbucket hook to run whenever code is pushed to Bitbucket. The freestyle job should capture ...
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. ...
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 ...
3
votes
4answers
5k 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 ...
1
vote
0answers
167 views

Is it possible to connect Jenkins Groovy Pipelines with Artifactory? [closed]

I have a Groovy Pipeline with Jenkins 2.32.1 I can read Pipeline definition from Pipeline script Pipeline script from SCM (Git, Mercurial or Subversion) Is there any method or plugin to read from ...
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 ...
3
votes
1answer
6k views

How can I push multiple containers, created with docker-compose, to a registry

I am using Jenkins pipeline and run a shell command to bring up my linked containers for testing. Once the testing is complete, I want to push the containers to a registry (I would prefer AWS ERC, but ...
0
votes
2answers
3k views

How to use Jenkins Pipeline and choose triggers for email notifications?

Before Pipeline, I used Email-ext plugin to define triggers for sending emails (on first failure, and when back to success). But in the Pipeline version, I can't control the triggers, I can only "...
0
votes
1answer
190 views

Jenkins, Jenkins SSH Plug-In, EC2, “ubuntu” user and “www-data”

I am trying to install Jenkins to achieve a Github -> EC2 instance folder pipeline. So far everything works well when I target an empty folder... however, when I target my production folder owned by ...
8
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. ...
11
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, ...
1
vote
1answer
6k views

How set and get var with Path?

I write script for deploy files by ssh via Jenkins #!groovy node('superhost01'){ String HOSTNAME="host01" String USERNAME="tech_user" withEnv(['PATH=/data/jdbc_connector']) stage('...
5
votes
1answer
7k 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:...
8
votes
4answers
7k 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 ...
1
vote
3answers
7k views

How can I clean/delete a Jenkins workspace after merge?

I would like to keep a workspace in Jenkins until after the pull request is merged. Meaning, I don't want to clear the workspace after every build, but I also don't want to clear the workspace only ...
1
vote
1answer
1k views

How to integrate docker-compose or docker run command arguments into SCM and Jenkins build?

When I do docker run I have to give extensive argument options for my container setup. To mitigate this and ensure all developers are using the same arguments I switched to docker-compose. Now ...
0
votes
1answer
844 views

Using Jenkins to control docker image build flow

I'm trying to figure out the proper way to get build environments into a CI pipeline. What I want to achieve is: someone pushes to the docker source repo (not registry, a repo with the docker folder)...
12
votes
2answers
24k 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 ...
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 ...
1
vote
1answer
618 views

Compatibility of http-builder-ng Groovy module with Jenkins 2

Did somebody had a chance to use http-builder-ng Groovy module in Jenkins pipeline? When I use this module with any kind of request/URL it always returns me null object when the same source code ...
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 ...
4
votes
2answers
507 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++) { ...
6
votes
2answers
950 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 ...
9
votes
1answer
6k 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 ...
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 ...
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 ...
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?
2
votes
0answers
834 views

Duplicate Class Definition when calling library code [closed]

I've got a jenkinsfile which is breaking on a second call to a custom library step. These calls are made inside another custom library step. I'm not sure if this is something not supported or what. ...
2
votes
1answer
74 views

What are best practices for running Pipeline tests into a CI framework?

According to this github repo it is possible to test the Jenkinsfile, but this is run by Jenkins and if there are issues it will not run. Should one run such unit test in another CI? What are best ...
2
votes
1answer
5k views

What is the best way to share maven repository using Docker build (dynamic) image with maven?

We have created a Docker build container to be run by Jenkins for Java based projects. We are using Maven for building our software. The problem we are facing is that, the builds are taking way 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, ...
12
votes
3answers
15k 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 { ...
8
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: ...
2
votes
1answer
8k views

Jenkins API call (or Groovy builtin) that returns list of all currently running builds of jobs

There's plenty of questions asking how to return a list of all jobs on your Jenkins instance, or even to get a list of which jobs are currently running, but I have a more specific use-case. I need ...
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 ...
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(...
4
votes
1answer
539 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-...
3
votes
3answers
9k 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). ...
2
votes
1answer
2k views

Disable a Jenkins pipeline on failure? Issue with a central deployment job

Consider a structure of X micro services and 2 environments; staging and production. Each of these micro services is represented by a separate git repository, when a merge to master happens on any of ...
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 ...
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 ...
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 ...