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 [jenkinsfile]

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

0
votes
0answers
20 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 ...
1
vote
1answer
54 views

Jenkins Pipeline steps that run before Jenkinsfile

I'm just starting to get my toes wet with Jenkins and CI/CD. I've built a set of static analysis tools and corresponding configurations I want to run before a branch's Jenkinsfile is even considered. ...
0
votes
1answer
40 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
383 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 ...
0
votes
1answer
39 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([...
4
votes
1answer
132 views

How to make Jenkinsfile credential visible to many stages

In Jenkinsfile, I want to make an ssh key visible to all stages in the pipeline. From the official document, I learned that: environment directive is used to defy environment variables for used ...
0
votes
0answers
51 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://...
0
votes
0answers
18 views

Jenkins Plugin Github Branch Sources, how to use with pipeline

I'm new with jenkins, My scenario is the next task: 1 make a pull master from Github Repository, every 1 hour. 2 run a custom code for test code (executed by Jenkinsfile), if fail, not execute step ...
1
vote
1answer
357 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
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
105 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 ...
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 ...
7
votes
2answers
851 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, ...
7
votes
2answers
6k views

Multibranch Jenkins Build - How to disable some branches only

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

How can I best test Jenkinsfile with plugins? [duplicate]

I'd like to replicate building a pipeline in my personal lab with similar conditions to what my Dev/QA goals are. I already have an AWS-hosted jenkins server, but my understanding of how Nexus & ...
2
votes
1answer
2k views

One Checkout When Running Parallel Stages In Jenkins

Introduction We have a multibranch pipeline project. The build configuration is defined by a jenkinsfile. The system consists of one master and a couple of agents. The stages are run in parallel, ...
1
vote
1answer
724 views

Validating custom Jenkinsfile

Currently we're using Jenkins shared libraries which we're planning to use with custom Jenkinsfiles. Idea here is that developers should be able to manage those custom Jenkinsfiles without any ...
2
votes
2answers
2k views

How can a Windows server be a slave to Jenkins running on Linux when there in an error installing the slave-agent.jnlp file?

I want to have a Windows Server 2016 slave node with a master Jenkins (version 2.89.2) running on Red Hat Enterprise Linux 7.x. I am trying to install the slave-agent.jnlp file from the Jenkins web ...
9
votes
3answers
7k views

How to properly achieve dynamic parallel action with a declarative pipeline?

Currently, I'm going to need an implementation that must find all files within a directory and start a parallel task for every file found. Is it possible to achieve this using declarative pipelines? ...
2
votes
2answers
1k 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++) { ...
9
votes
1answer
2k 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 ...
2
votes
1answer
359 views

Jenkins bitbucket-build-status-notifier-plugin posts status to repo of shared pipeline library!

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

Duplicate Class Definition when calling library code

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

Jenkins libraries configuration in Jenkinsfile

Right now we have many projects with similar Jenkinsfile's. Instead of copypasting we're developing a shared library with some utilities. This library is loaded dynamically in each Jenkinsfile, and ...
1
vote
1answer
3k views

Accessing the committer's name as a Jenkinsfile environment variable

Using the env.BRANCH_NAME variable accessible in the Jenkinsfile outside of the pipeline{} block, I have set up a variable used to conditionally set the node used to build the git branch. I would like ...
3
votes
1answer
4k views

Declarative Jenkins Pipeline to Poll different branches?

We have a gitlab enterpise that host multiple project in one repo. Something like: Repo/ projectA/ projectB/ projectC/ We have three pipelines that will run base on changes(whitelist region) ...
10
votes
1answer
10k 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(...
12
votes
4answers
5k 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 ...
12
votes
2answers
9k views

How to build a complex parallel Jenkins pipeline?

I've been interested in converting our bespoke Jenkins integrations into a pipeline. However, I can't seem to figure out how to do it. Can anyone help me with the Jenkins script that could do the ...
4
votes
2answers
861 views

Does TFS Build have something like a Jenkinsfile?

I've seen some custom settings files used in combination with TFS build, but nothing native. Does Team Foundation Server or Visual Studio Team Services have a Jenkinsfile-like, declarative method for ...