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
4
votes
1answer
8k 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
2answers
839 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 ...
15
votes
2answers
16k 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
2answers
4k views

Jenkins Dockerfile declarative pipelines: getting the built image tag

I'm trying to get the image tag generated with the help of the dockerfile agent in Jenkins declarative pipelines. This Jenkinsfile is incomplete though, because I still need the deployment steps. ...
0
votes
2answers
107 views

Equivalent of GitLab's “before_script” for Jenkins?

I'm looking for Jenkins' equivalent of the before_script keyword provided by GitLab. So far what I found is the input keyword that you can use before entering the steps part of the stage, but this ...
0
votes
1answer
2k views

Can “When” like keyword be used in scripted pipeline?

stage('My Conditional Stage') { when { branch 'master' } steps { echo 'Do that only on master branch' } } For Scripted pipeline ; if value of i is 0 then we need skip ...
-1
votes
1answer
1k views

How to restrict only one parameter in jenkins pipeline

I have the below pipeline script with string parameters. The Target parameter will fail if multiple comma separated inputs are provided in Jenkins. How can I restrict the Jenkins pipeline to accept ...
0
votes
1answer
1k views

Jenkinsfile for monorepo & monobranch

I'm currently working on a Microservice architecture-based project and writing Jenkins Pipeline for it. The project structure is as follows: Web Service (master) Jenkinsfile Service 1/ Jenkinsfile ...
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 ...
7
votes
1answer
12k 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 ...
5
votes
3answers
180 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 ...
6
votes
3answers
9k 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{ ...
4
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). ...
0
votes
1answer
3k views

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 ...
1
vote
2answers
3k views

Jenkins pipeline lock resources

I need to run commands on my pipeline during a certain stage, on devices which connected to my Jenkins as slaves. But I want them to run only when another one finished. On the other hand, I want them ...
0
votes
1answer
98 views

What options are available to report the build status of Jenkins Multi Pipeline's first branch build on k8s to bitbucket-cloud?

Background The Bitbucket Status Notifier plugin has been configured. The status was reported, but since more and more jobs have been moved to Jenkins-on-steroids that is running on k8s, buildStats ...
1
vote
1answer
10k views

Set environment variables then run script in Jenkins Scripted Pipeline

I am new to Jenkins, Groovy and pipelines. I have created a simple pipeline stage like so: //working build but not setting env variables node('build-01') { stage('Building') { echo "[*] ...
2
votes
1answer
4k views

Jenkins Pipeline Kubernetes Agent shared Volumes

I have a Jenkins Pipeline using Kubernetes Agent. I schedule multiple containers in my pod template. I recently wanted to add volumes that would be shared some of the containers and am having ...
1
vote
2answers
809 views

what is better between Jenkins & AWS CodeDeploy for CI/CD

I'm considering what is better and easier to use for CI/CD pipeline between Jenkins and AWS CodeDeploy. e.g. Jenkins server request webhook to git repo(github), and deploy to EC2. e.g. When push to ...
4
votes
1answer
28k 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"){ ...
2
votes
2answers
14k views

Jenkins pipeline pass upstream build number to downstream job using Pipeline script

How to pass upstream build number to downstream job in Pipeline job using (Trigger parameter build on other projects) ? Agenda: To pass upstream job build number to downstream job to download ...
2
votes
1answer
9k views

Jenkins - Scripted Pipeline - Input String

I am struggling to set up an input step in a scripted Jenkins pipeline that will let me as the user to input a string. Scenario: I am building a Docker image. I want to ask the user what tags to tag ...
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 ...
4
votes
2answers
8k 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
4k views

Jenkins parameters default to env variable?

I am trying to crate parameters field which is default to current build no. parameters { string( name: 'DEPLOY_BUILD_NUMBER', defaultValue: '${BUILD_NUMBER}', description: ...
0
votes
2answers
738 views

How to get list of env variables from the root folder to jenkins job?

Using configure option, when we check the environment variables, we get only the variables which are available with in the folder or job. But, I want to get complete list of env variable from the ...
0
votes
1answer
56 views

Does Jenkins job create Jenkinsfile? On execution

On creation of a new job(as free style project), and running it, I see that Jenkinsfile is generated in job's workspace, after running the job. But I see that all the pipeline code is commented. ...
7
votes
1answer
8k 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 ...
8
votes
2answers
7k 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: ...
4
votes
2answers
8k 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-...
1
vote
1answer
1k views

Jenkins Pipeline GitLab API Credentials Management

I have a Jenkins pipeline that executes a build whenever a change is pushed to the appropriate branch. Jenkins uses an API token to authenticate with the GitLab server and checkout the repository. ...
0
votes
1answer
3k views

Jenkins Pipeline project can't when on branch

I want to use when on branch condition. The Jenkinsfile is like this stages{ stage('Checkout project branch master'){ steps{ withCredentials([...
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). ...
1
vote
2answers
1k views

Jenkins pipelines vs matrix vs multiple jobs for multiple branches across multiple platforms

I've never done any CI work before, so I'm struggling to decide how to set up Jenkins as my first project at my new job. From what I (sort of) understand: Jobs are the generic work unit Pipelines ...
4
votes
1answer
9k 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('...
2
votes
1answer
14k views

Jenkins Groovy to parse console output and mark build failure

What would be a Groovy or pipeline step to parse Jenkins console output, identify a string and mark the build as failure if the string is matched?
3
votes
1answer
11k views

jenkins pipeline nested parallel

Jenkins pipeline, declarative. simple question, how do I create a parallel stages inside stage which is parallel by itself? pipeline { agent { label 'master' } options { timestamps() timeout(...
1
vote
1answer
656 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 ...
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 ...
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:...
2
votes
3answers
4k views

Jenkins UUIDs … oh the humanity

I have an environment block environment { SUITE_RUN_ID = UUID.randomUUID().toString() SMOKE_CMD = "runtests.sh SUITE_RUN_ID=${SUITE_RUN_ID}" FAILED_TESTS = "output_rerun_info.rb SUITE_RUN_ID=${...
5
votes
1answer
10k 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 ...
13
votes
3answers
17k 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
1answer
636 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
6k 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 ...
10
votes
2answers
8k 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, ...
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
1answer
11k 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 ...
2
votes
1answer
593 views

Jenkins Pipeline job - remember previous values

I have a Jenkins Pipeline which uses Terraform and create a compute environment in GCP. There are like 5 questions in the build i.e. 1) GCP Project Name 2) Number of RHEL Servers 3) RHEL Server names ...
13
votes
2answers
15k 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?