For questions about Jenkinsfiles which are version-controlled text files containing definitions of Jenkins Pipelines
Questions tagged [jenkinsfile]
83 questions
36
votes
5 answers
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?
pipeline {
agent any
stages {
…
thclpr
- 871
- 1
- 7
- 9
29
votes
3 answers
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 following?
1---2---3-----------9---10
| …
Bert Goethals
- 501
- 1
- 4
- 9
24
votes
3 answers
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(['BUILD_ID=dontkill']) {
sh…
Dharanidhar
- 701
- 2
- 5
- 10
17
votes
2 answers
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 issues have arisen.
Build/test times have increased…
YellowPillow
- 273
- 1
- 2
- 5
16
votes
3 answers
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 powerful as one's coding skills are (seeing that…
Worp
- 689
- 4
- 11
- 19
14
votes
3 answers
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 research, I found that Artifactory plugin is…
Dharanidhar
- 701
- 2
- 5
- 10
10
votes
3 answers
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, If I run the Jenkinsfile, It shoud execute the…
Buvanesh Kumar
- 467
- 3
- 5
- 13
10
votes
1 answer
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 removed, how can I have jenkins run a command when…
red888
- 243
- 3
- 10
8
votes
2 answers
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 within Jenkinsfile
The scope of the variables defined…
Tran Triet
- 879
- 3
- 11
- 21
8
votes
1 answer
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 required for certain pipeline procedures like…
Inbar Rose
- 411
- 1
- 6
- 14
8
votes
1 answer
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 looking for the correct syntax to perform the following…
Bruce Becker
- 3,783
- 4
- 20
- 41
6
votes
3 answers
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{
retrigger //try for 3 times atleast
…
Ron Bob
- 61
- 1
- 1
- 2
5
votes
4 answers
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 Multibranch Pipeline to organize the project, because…
maze
- 162
- 1
- 8
5
votes
2 answers
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 defining a build process?
Dave Swersky
- 4,068
- 2
- 21
- 33
5
votes
2 answers
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++) {
branches[allNodes[i].name.toString()] = {
…
Anirudh Singh
- 91
- 1
- 6