Skip to main content

Questions tagged [jenkinsfile]

For questions about Jenkinsfiles which are version-controlled text files containing definitions of Jenkins Pipelines

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

How to collect cumulative report for 32 repos?

We use separate Jenkins jobs to collect unit tests and coverage for each repository. There are 32 such repos. How do we collect cumulative report? Currently we are going into each job and collecting ...
TheDevOpsMonk's user avatar
1 vote
2 answers
429 views

How To Convert Jenkins String Parameter To Terraform Map Variable? (Invalid number literal)

Edit (8/16/2023): I figured it out! I'm trying to pass string parameter(s) to a Terraform map variable, but receiving error "Invalid number literal". Jenkinsfile: pipeline { agent any ...
Mark Matlock's user avatar
1 vote
1 answer
3k views

How to override global "environment {}" Jenkins Variables in a stage?

I'm trying to set up an automated Jenkins pipeline for the Development & Staging branches within our Git repository. I have most of the pipeline working. But I do not know how to override globally ...
ThatTechGuy's user avatar
1 vote
3 answers
429 views

Jenkins: Stagger triggering of next pipeline steps

I have a daily Jenkins trigger job that sets off a bunch of CI jobs based on a cron timer. All the daily jobs are set off by this trigger job, the daily job itself doesn't do anything. However, this ...
Sean's user avatar
  • 11
2 votes
2 answers
4k views

Shared Jenkinsfile for multiple pipelines (separate source repositories)

I'd like to write one Jenkinsfile to be shared between a number (~50) of pipelines/jobs, where each job handles the creation of a library from a specific source (git) repository. Currently I have one ...
chrisb2244's user avatar
1 vote
2 answers
331 views

Package installed using Dockerfile not available on Jenkins pipeline stage

I'm having sort of a weird problem with my Jenkins pipeline. I've defined a Dockerfile which installs some tools I need for my CI/CD pipeline, such as node, npm, sfdx, and sfpowerkit (a plugin for ...
Pietro Zuntini's user avatar
2 votes
2 answers
5k views

Send command to docker image while start in Jenkins file

In scripted Jenkinsfile if I need to send a command to Docker image, I can do like this: docker.image('mysql --default-authentication-plugin=mysql_native_password') How can I do the same in ...
MRashad's user avatar
  • 21
1 vote
1 answer
5k views

Using a conditional environment{ } directive in Jenkinsfiles

My Jenkinsfiles use the environment{} directive. I've been trying to set a condition where I invoke different variables depending on the GIT branch being builded. I've tried something like e. g. : ...
the_piper's user avatar
-1 votes
1 answer
2k views

How to get ConsoleFull Output,changeLog of upstream job along with downstream jobs console full output and changeLog in jenkins pipeline jobs!

Lets say we have Jobs A , B , C ,D and E. Job A triggers Job B ; Job B triggers Job C; Job C triggers Job D;, Job D triggers Job E; When one of the child job fails for example: Job c fails then email ...
suman's user avatar
  • 1
0 votes
1 answer
712 views

Jenkinsfile credential as paramter unable to use it

I am trying to use the credentials parameter for a git clone. But i am getting the error that the variables are not found Param definition credentials (credentialType: 'Username with password', ...
Vini's user avatar
  • 121
1 vote
1 answer
529 views

Jenkinsfile update using version control

I've a Jenkinsfile in the master branch of the repository with following code pipeline { agent any stages { stage('A') { steps { sh 'echo "Step A"'...
Oli's user avatar
  • 283
1 vote
1 answer
2k views

Jenkins downstream pipeline jobs not always triggered as expected

I have three separate Multibranch pipeline jobs set up on Jenkins, which I want to be called sequentially as downstream-jobs. Please note that, all these 3 jobs have separate git repositories! Each ...
pats's user avatar
  • 13
1 vote
1 answer
5k views

How can I add a when clause for a specific upstream trigger in a Jenkins declarative pipeline?

I have a job defined as a declarative pipeline that gets triggered by a number of different upstream jobs. Depending on which upstream job triggered my job, I don't necessarily need to run all of the ...
c32hedge's user avatar
  • 145
2 votes
1 answer
434 views

Jenkins: Access job/plugin configuration values inside pipeline

I am trying the access the values set on a job's configuration page from within my pipeline. These values are not made available as params, nor are they injected as envvars. Setup Jenkins, v2.263.1 ...
Denham Coote's user avatar
1 vote
1 answer
8k views

Skip stages in Jenkins pipeline

I am using a scripted pipeline where I am required to skip some stages conditionally.Is there a way to show skipped stages on Jenkins UI other than importing org.jenkinsci.plugins.pipeline....
Aditi Sharma's user avatar
0 votes
1 answer
3k views

Jenkins declarative pipeline Warning: JENKINS-41339 probably bogus PATH

I am struggling with this issue inside my declarative pipeline. I am trying to use python's docker image as my agent and run some scripts and I am receiving warning: Warning: JENKINS-41339 probably ...
dubaksk's user avatar
2 votes
1 answer
2k views

How to add label to Pull Request via Github API?

According to GitHub API user can add label to an issue using this POST request. I tried using this request but with PR number instead to automatically set label on PR. Here is the function I wrote: ...
w8eight's user avatar
  • 141
0 votes
1 answer
2k views

How can I check if there is a new build the same jenkins pipeline

I have a github multibranch pipeline, in declarative format. It is configured to trigger on pushes to pull request branches (ie, branches which are included in pull requests to a target branch, say ...
Bruce Becker's user avatar
  • 3,603
1 vote
1 answer
722 views

Docker in docker volume mount doesn't work

I have the below command in my Jenkinsfile: docker run --rm -v "${WORKSPACE}":/var/cache/de --entrypoint=/usr/local/bin/pytest ${IMAGE_NAME}:${IMAGE_VERSION} -m "not require_dss" -...
arielma's user avatar
  • 339
0 votes
1 answer
3k views

What is the best approach to deploying to multiple servers using Jenkins?

Trying to figure out the best approach for deploying to multiple servers using Jenkins Blue Ocean pipeline. We will have six servers in development, six in QA, six in Staging, and six in production. ...
Shawn Bates's user avatar
8 votes
1 answer
3k views

How to have jenkins add a review to a pull request

I have a Jenkins instance, with credentials for a "robot" github account, which we use to interact with the GitHub API as a team. Typically, jobs are defined as declarative pipelines. I am ...
Bruce Becker's user avatar
  • 3,603
3 votes
1 answer
1k views

simulate post step for dynamically generated Jenkins pipeline stages

The following simplified Jenkinsfile dynamically generates sequentially executed stages; however, I cannot create a post step for these dynamically stages, like so: pipeline { agent none ...
Trevor's user avatar
  • 133
3 votes
1 answer
4k views

Pass environment variables from pipeline job A to pipeline job B

I passed params to pipeline B and set the environment variables from parameters. However, "${params.URL}" is evaluated as null. Pipeline A is declared in Jenkinsfile: pipeline { agent any ...
rokpoto.com's user avatar
2 votes
1 answer
9k views

Jenkinsfile script to waitUntil a folder is created

With this Jenkinsfile code, I am trying to test A/B folder creation, and also testing if waitUntil works till the folder is created, I expect it to wait for 0 secs as the folder is created before ...
rodee's user avatar
  • 177
2 votes
2 answers
3k views

Running parallel builds from jenkins pipeline job triggers and waits for same job on other project

I have this test pipeline code, it runs 2 build on different nodes on build_servers as expected. pipeline { agent { label 'myserver' } stages { stage('1') { steps { ...
rodee's user avatar
  • 177
2 votes
1 answer
4k views

How to mark build success when one of the stages is aborted?

I've a pipeline with stages where one of the stage, intermittently takes longer than expectation and hence using timeout to abort it. But if the stage is aborted, build also marked as aborted. ...
Alpha's user avatar
  • 163
2 votes
1 answer
2k views

Using Jenkins declarative when conditions in scripted pipelines

Jenkins declarative pipelines offer very convenient when directive with conditions like changeset. Is is possible the this changeset and other when conditions in a scripted pipeline?
Dima's user avatar
  • 143
1 vote
2 answers
2k views

Jenkins - load scripted parameters from a SCM repo

I am using all kind of parameters like "Active Choice Parameter", "Active Choice Reactive Parameter", "Active Choice Reactive Reference Parameter" that have a lot of Groovy code within them. My ...
anVzdGFub3RoZXJodW1hbg's user avatar
0 votes
1 answer
1k views

Jenkinsfile handling an expected job failure

I've got two types of failures to account for within a Jenkins job. The job genuinely failed The job failed because of a certain bit of info hasn't been published. Nothing is actually wrong here. ...
Alistair Hardy's user avatar
3 votes
1 answer
13k views

how to checkout only specific folder from git repo((monorepo)) and build

Hey folks I need some help on the jenkinsfile. Below is my usecase This is the strcuture of my GIT repo: root |->app1 | |->jenkinsfile | |->dockerfile1 |->app2 |->...
gamechanger17's user avatar
0 votes
1 answer
3k views

Getting permission denied with docker pipeline on jenkins

I have jenkins deployed via helm charts on kubernetes cluster Now i want to be able to run helm to deploy helm charts applications on my kubernetes cluster and have the following in my jenkinsfile ...
uberrebu's user avatar
  • 131
3 votes
1 answer
1k views

Prevent ${PIPELINESTATUS[0]} from being evaluated in Jenkinsfile

Below is a script I am running in the deploy of a docker container. The docker ps -a | grep $APP_CONTAINER_NAME command is returning non-zero when the container was not correctly built/tested, hence ...
jdcskillet's user avatar
4 votes
2 answers
13k views

How to define dynamic parallel stages in a Jenkinsfile?

In declarative pipelines, Jenkins allows the definition of parallel stages. It further allows scripted pipeline general purpose scripts to create and manipulate the artifacts of the declarative ...
Jörn Guy Süß's user avatar
2 votes
1 answer
5k views

Jenkins does not seem to be running inside a container

I am getting an error while running the Jenkins file tp build and push the docker image into docker hub . you can reveiw my code github : https://github.com/iakshaykr/webapp.git (using jenkins_pipe ...
Akshay Kumar's user avatar
0 votes
1 answer
647 views

Jenkinsfile: Pull image from registry endpoint A, push built image to registry endpoint B

I have two endpoints for my registry (Nexus OSS): Endpoint 10500 to pull images from. And Endpoint 10501 to push images to. (I can go into detail what the idea is and why we think Nexus requires ...
Worp's user avatar
  • 679
3 votes
1 answer
15k views

How to mark a step as failed or unstable on timeout, instead of aborting build?

I have a stage in my Jenkins declarative pipeline that looks like: stage('Step Tests') { steps { dir('test') { catchError(catchInterruptions: true, buildResult: 'FAILURE') { ...
c32hedge's user avatar
  • 145
4 votes
2 answers
33k views

JenkinsFile to get git branch name

I want to get git current checkout BRANCH NAME in my Jenkins file here is the code snippet... Here I am trying to push a file to my current branch I have tried many things could not find it... ...
Madan's user avatar
  • 101
3 votes
4 answers
8k views

Is there a way to use a Jenkinsfile from a git-submodule in a multibranch pipeline?

Background: The nature of our project's source involves multiple long-living branches, each one has its own Jenkins job (manually created). Multibranch limitation: Unfortunately we do not use a ...
maze's user avatar
  • 143
0 votes
2 answers
2k views

Jenkins multi branch pipeline configuration for bitbucket [closed]

How to configure multi branch pipeline job for bitbucket ....i have to clone from different branches and build the jobs.... I found multi branch is the option... How to configure for bit bucket
Madan's user avatar
  • 101
1 vote
1 answer
1k views

Is there a way to set build parameters outside of the pipeline directive?

My build parameters are defined in my jenkinsfiles All builds run on container slaves on google kubernetes engine cluster This means users need to wait for a container to start before anything ...
red888's user avatar
  • 251
0 votes
1 answer
2k 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 ...
puayhiang's user avatar
1 vote
1 answer
2k views

Docker fails to mount volume inside Jenkins scripted pipeline

I'm working on a CI Jenkins build with scripted pipeline. From Jenkins on one machine, I'm connecting with already configured Jenkins slave on another machine (M2). I'm able to successfully execute ...
Patryk's user avatar
  • 31
2 votes
2 answers
3k views

GitHub Payload in Jenkins

I'm using the GitHub plugin with Jenkins, and I'm trying to figure out how I can access the webhook payload. I'm aware that the Generic Webhook Trigger has this ability, as well as the GitHub Pull ...
primetheus's user avatar
1 vote
1 answer
5k 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 ...
june's user avatar
  • 11
3 votes
2 answers
2k views

Jenkins Shared lib not working properly

Recently I tried to add Shared Libraries to my Jenkins instance to make it easier to maintain all code that runs in each project. I have a repo myorg/jenkins Inside of it I have Jenkinsfile and ...
vaporwave_sailor's user avatar
3 votes
2 answers
12k views

Cleanest way to prematurely exit a jenkins pipeline from inside a withEnv

In a Jenkins scripted pipeline with the below structure, the return command will exit only the withEnv. node{ withEnv([...]){ stage('1'){ ... } stage('2'){ ...
sgargel's user avatar
  • 244
16 votes
3 answers
18k 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 ...
Worp's user avatar
  • 679
1 vote
1 answer
453 views

How to assign saltstack pillar values from Jenkins comma separated input parameters?

I have a Jenkins job with string parameter as target "server1,server2". Jenkins pipeline script is expected to execute the job on server1 and server2 respectively. There is a common salt sls file that ...
Narasimha's user avatar
3 votes
1 answer
12k 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 ...
Worp's user avatar
  • 679
1 vote
1 answer
9k 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: ...
rp346's user avatar
  • 135