Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [jenkins-pipeline]

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

0
votes
1answer
10 views

How can I achieve better load balancing of different systems on a Jenkins?

We have four test machines spread over a Jenkins. We would like to have a better distribution. Example: If machine one is running with a test job, the second job should detect that node one is ...
-1
votes
0answers
10 views

Convert Jenkins job DSL to pipeline groovy

Here is the sample code: out.println "-------------------------" def param = params['Project'].toString() out.println 'foo ' + param + ' project: ' out.println 'Checkout a source code and post it ...
0
votes
0answers
13 views

How to define a salt variable with two or more inputs from Jenkins parameter?

I am defining a variable in Jenkins pipeline script as: USER = "xx-yy-${Target}-zzz" Here ${Target} is from a Jenkins comma separated parameters (server1,server2). properties([ parameters([ ...
0
votes
1answer
18 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. ...
1
vote
1answer
21 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
0answers
17 views

How to tar a specific folder from git repo using Jenkins pipeline?

I have a Jenkins job with Repo URL example.repo under config. The job is to create a tar of specific folder under example.repo and not the entire repo. The issue I see is, it does a tar of entire repo....
2
votes
1answer
33 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 ...
3
votes
0answers
25 views

Can I use the Jenkins Rest API with user input?

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 ...
0
votes
0answers
6 views

Provisioning & Configuring VM on Azure

As part of QA pipeline(in Jenkins), we need to add a provisioning and configuration automation of a VM to run the QA tests. Jenkins pipeline can trigger ansible code for provisioning and ...
0
votes
1answer
26 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
1answer
15 views

How to define global variables in groovy file, which I want to load and consume?

I have a Jenkins parent groovy file which consumes the child groovy file Parent grooy file: ... def child = load 'child-groovy-file'; child.execute(); Child groovy file: a = "first letter"; b = "...
1
vote
1answer
28 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") { def foo = "foo" // ...
1
vote
0answers
11 views

Define views in Jenkins Multibranch pipeline jobs

Is it possible to somehow define views in Jenkins multibranch pipelines? I'd like to have a second view (after the Branches (NUMBER)), that shows only enabled branches. But I also want to keep the ...
0
votes
0answers
17 views

Jenkins - IBM UrbanCode - AWS & Azure cloud

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 ...
0
votes
2answers
27 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
2answers
43 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,...
0
votes
3answers
33 views

Jenkins in private subnet

For development environment, to be used by multiple developers, we have a pipeline to be created with Git-Jenkins-Tomcat(dev) Do I need to place jenkins in private subnet and access thru bastion host?
0
votes
0answers
27 views

Jenkins CLI from Jenkinsfile

I would like to call the Jenkins CLI from a Jenkinsfile. I am thinking that I can use the shell directive and call the cli via the client jar. For example sh 'java -jar /path/to/client.jar...' ...
0
votes
0answers
24 views

Move artifacts files and folders to a one (release) folder

What is the best approach/ plugin to move multiple files and folders to a new release folder? (I'm using the Jenkinsfile pipeline) Case: The next files/ folders need to be available in the release ...
0
votes
1answer
65 views

packge.json not found while executing on Jenkins

My Dockerfile looks something like this. FROM mhart/alpine-node:8.11.3 RUN mkdir -p /app COPY ./ /app WORKDIR /app/build RUN yarn global add serve CMD ["serve", "-l", "3000"] EXPOSE 3000 And ...
1
vote
2answers
815 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 ...
1
vote
0answers
38 views

Pass Variable in pipeline script

I am trying to pass a variable input to "credentialsId: $creds" from SiteID but unable to. I tried multiple expressions in pipeline script with quotes etc and none worked. I am learning and need ...
3
votes
1answer
856 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?
0
votes
0answers
21 views

trigger a build on a specific branch when a branch is deleted?

Using multibranch pipelines with webhooks. When I delete a branch my jenkins projects immediately update and prune the branch. This is great but could I trigger a build of master branch when another ...
0
votes
1answer
58 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([...
0
votes
0answers
20 views

Jenkins VCS Plug in Snapshot

I have an issue where i make a snapshot of a slave VM after is completed the slave is connected but the workspace is not refreshed in the VM. pipeline{ agent none stages { stage('Pre-...
2
votes
1answer
543 views

Jenkins-Ansible: executing ansible playbook using 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. ...
2
votes
1answer
580 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
724 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"){ ...
3
votes
2answers
74 views

Jenkins Retrigger When build fails

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 { ...
1
vote
1answer
54 views

Manage Docker images and their child images in a pipeline

I have various Jenkins agents images and I am trying to add automation to it. I have a base java image called agent-base and those who inherit from that one. Eg: agent-ansible, agent-terraform and so ...
0
votes
1answer
730 views

Parallel stages running on same agent in Jenkins declarative pipeline

I've been using a Jenkins pipeline with a parallel step for testing like this: pipeline { agent { label 'php' } stages { stage('build') { steps { ... ...
1
vote
1answer
50 views

Always execute post statement in a jenkins pipeline when a conditional statement is met

Although it seems counterintuitive, I would like to execute an always statement when a conditional is met. In my pipeline, my post statement should always destroy my AWS CloudFormation Stack if a ...
0
votes
2answers
184 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 ...
0
votes
0answers
54 views

Best alternative to deploy/update docker using Jenkins for CI/CD

I'm running Jenkins as a docker image, and I'm looking for the optimal way to deploy new (or update existing) docker images (example staging and prod environment). I've founded this example : https://...
4
votes
1answer
2k 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 ...
1
vote
1answer
289 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. ...
3
votes
1answer
138 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 ...
1
vote
1answer
483 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
3answers
229 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=${...
3
votes
1answer
595 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 ...
1
vote
1answer
176 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
303 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 ...
5
votes
0answers
127 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 ...
0
votes
1answer
92 views

Jenkins “internal” pipeline script producing errors when running sh steps

I've been experimenting with creating a new pipeline, using the built-in pipeline editor (i.e. not from SCM). The strange bit is that, when I run any sh step, I receive the following error: sh: 1: ...
2
votes
1answer
2k 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
122 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 ...
0
votes
0answers
117 views

How to supress the error got from httpRequest in Jenkins pipeline

I have custom pipeline file in Jenkins and I am experiencing some kind of problem with httpRequest. I am making HTTP request to some external system just to notify about the build. This request is ...
3
votes
1answer
1k 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 ...
3
votes
0answers
92 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 ...