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
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 ...
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 ...
3
votes
4answers
6k 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
2answers
5k views

How to trim spaces for parameter value in jenkins pipeline?

I am using jenkins pipeline job with parameters. when i had any trailing spaces in parameter value the job gets failed. is there any way to trim the spaces in pipeline job to avoid build failure?
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(...
3
votes
1answer
50 views

It is not allowed to use stages more than once [Jenkins_Declarative_Pipeline]

I am completely new to the jenkins pipeline. I'm trying to create a project with multiple stages but in my Import stage , I want to execute parallel. For each stage in parallel , I have again multiple ...
3
votes
1answer
34 views

Using DevOps pipelines to create distribution bundles of applications

We want to create bundles of our applications in order to distribute to clients etc. An application can have more than one component. Ex: an application can have a spring server and a scheduler so in ...
3
votes
1answer
2k views

How to trigger jenkins pipeline only on merge to develop branch from github webhook trigger?

I am having a problem to trigger Jenkins pipeline job based on merge any branches to develop branch only. I also did not find any webhook for merge as like bitbucket. I also tried using pull request ...
3
votes
3answers
6k views

Jenkins pipeline: do “Declarative: Checkout SCM” step only

I'm newbie in Jenkins. I've created pipeine with parameters in Jenkinsfile in git. It works fine. Problem is: when I push new parameters into Jenkinsfile, then press button "Build with Parameters", ...
3
votes
2answers
1k 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 ...
3
votes
0answers
188 views

Is it possible to queue multiple replays of a Jenkins pipeline programmatically? [closed]

We have a parameterized declarative Jenkins pipeline which does tests on a java project with maven. The pipeline goes through a lot of stages to ensure that the code works as expected. However, every ...
3
votes
0answers
2k views

Can I use the Jenkins REST API with user input? [closed]

I want my Jenkins Pipeline to have a user input step where it posts to a slack channel and waits for user input then uses the input to user enters (button in the slack message). So at the input step ...
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=${...
2
votes
2answers
9k 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 ...
2
votes
2answers
4k 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 ...
2
votes
1answer
4k 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') { ...
2
votes
3answers
3k 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 ...
2
votes
1answer
48 views

Pass information between Jenkins Job builds

Please excuse my non-fluent terminology.. There is a Jenkins server, master and a few slaves, there is a pipeline job.. let's call it playground I run the job once, I want to save some data somewhere. ...
2
votes
2answers
6k views

Transfer files and execute commands from jenkins scripted pipeline to AWS instance

I want to transfer files and execute a few commands on remote AWS instance from Jenkins. I have the following methods in mind to do the same. Note that my Jenkins server is running in the local server,...
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?
2
votes
1answer
6k 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 ...
2
votes
1answer
56 views

Docker calls to detect app crashing inside it

Is there a way to know if an app has crashed inside docker using maybe bash script or API call from host container, am implementing CI/CD using Jenkins and will be deploying the built app via ssh to ...
2
votes
2answers
1k 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 ...
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
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 ...
2
votes
1answer
590 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 ...
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
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 ...
2
votes
1answer
553 views

branch specific jenkins pipeline trigger

I am trying to trigger a jenkins pipeline job only when a pull request has been approved & merged to a specific github branch in our CI/CD implementation. currently whenever i merge a PR to ...
2
votes
1answer
184 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 ...
2
votes
1answer
49 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 ...
2
votes
1answer
95 views

How can I retrieve the execution status of parallel triggered child jobs to a pipeline script

I have a pipeline script that executes child jobs in parallel. Say I have 5 data (a,b,c,d,e) that has to be executed on 3 jobs (J1, J2, J3) My pipeline script is in the below format for (int i = 0; ...
2
votes
1answer
2k 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 ...
2
votes
1answer
4k 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 |->...
2
votes
1answer
481 views

How do i notify GitHub pull request for each stage of a parallel Jenkins pipeline?

We have a parallel Jenkins pipeline script which deploy and run three kind of tests in parallel. We have to notify the status of each stage to GitHub pull request. Can anyone help me to get this? def ...
2
votes
2answers
1k views

Jenkins triggered by multiple git repos

I've been looking around to see how to have ~10 different repos all on a git push trigger a single pipeline that does pretty much the same exact thing - build a docker image -except that the different ...
2
votes
1answer
2k 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 ...
2
votes
2answers
5k 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'){ ...
2
votes
1answer
8k 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 ...
2
votes
0answers
416 views

Passing parameters of extendedChoice type to Jenkins Pipeline via jenkins-cli.jar

I have the following declarative pipeline. It defines checkbox multi-choice parameter: pipeline { agent any options { ansiColor('xterm') } parameters { ...
2
votes
0answers
705 views

Rancher Pipeline: How to pass environment variables from one stage to another [closed]

Currently I am trying to move our existing build infrastructure to Rancher with its CICD pipelines. My main question is: Is it possible to pass environment variables from one stage to another? Our ...
2
votes
0answers
140 views

Jenkins - IBM UrbanCode - AWS & Azure cloud [closed]

For continuous delivery, we do manual deployment after generating binary artifacts from Jenkins pipeline(in an automated process). Further, for continuous deployment, we would like to use IBM ...
2
votes
0answers
883 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
2answers
8k views

How to execute an ansible playbook using a jenkins pipeline script?

We developed declarative pipeline code to execute an Ansible playbook. We tested the playbook from CLI and it is working properly. My playbook actually performs some shell commands on remote server. ...
1
vote
1answer
35 views

how to update .env file in production while Jenkins deployment

how to update the .env file in production while Jenkins deployment? we have not committed the .env file in git for security reasons.
1
vote
1answer
104 views

Is it possible to combine failure stage from groovy with try catch from pipeline?

I have a pipeline with some stages and logic. The only possible debugger is adding try-catch to each stage: stage ("distribution"){ steps{ script{ try{ ...
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 ...
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
2answers
5k views

How to trigger Jenkins Pipeline by push in specific branch in Bitbucket?

I've created Jenkins Pipeline Job, activated "Build when a change is pushed to BitBucket" trigger. I've also specified branches to build. But pipeline is triggered by all branch changes. Also I've ...