482 questions
0
votes
1
answer
58
views
how to add labels to the docker image build by jenkins docker API
I'm building docker image using jenkins docker API. Below is the full code for building docker image in stage.
node {
stage("build") {
checkout scm
def customImage = docker.build(&...
1
vote
1
answer
30
views
Jenkins pipeline restart from a stage API
Is there any Rest APIs provided by jenkins to restart from a stage in a pipeline?
I am trying to restart a pipeline from a stage. In UI it is possible using 'restart from stage', but there are no API ...
2
votes
1
answer
1k
views
Jenkins - Docker cloud agent VS Docker in Pipeline
I'm trying to understand why so many people have taken the route of setting up "Docker cloud agent" (tutorial1, tutorial2) inside Manage Jenkins -> Clouds, instead of just going with &...
-1
votes
2
answers
479
views
Jenkins when branch merged or deleted
we are using jenkins declarative pipeline with multi branches the repo hosted on bitbucket with webhooks configured on merged , push and approved ,
as we have many features branches so the builds ...
0
votes
1
answer
100
views
Executing a Declarative Pipeline Stage on Multiple/all Agents
I have a project which features tests which only run on Linux and other tests which only run on Windows.
I have a Linux agent and a Windows agent. I need to check out the project (and its multiple ...
1
vote
1
answer
466
views
How to add a timeout to selecting the agent in a Jenkins declarative pipeline
In Jenkins I am using declarative pipelines to select an agent based on a user input parameter. The issue is, when the agent is offline, the pipeline stays forever in the build queue. I would like to ...
0
votes
2
answers
2k
views
How to share variables between stages in declarative pipeline
I have following pipeline (content simplified, but the structure is exact):
pipeline {
agent any
environment {
my_var = ""
}
stages {
...
0
votes
2
answers
816
views
Jenkins declarative pipeline. Stage post action goes to failure block if previous stage failed and current stage is successful
I have pipeline runs 3 stages. success, fail, success. Yes I want the pipeline continue to run even one stage fails.
This screenshot looks right.
My problem is, the last stage green2 is successful but ...
1
vote
1
answer
69
views
Are declarative pipeline environment variables are shared across different stages?
Is it expected that environmental variables can be accessed from different stages of a declarative pipeline?
Here is my code:
pipeline {
agent any
stages {
stage('start') {
...
0
votes
1
answer
315
views
Node assignment has to be done based on priority value but not on Job
I have multiple pipeline jobs triggered parallely at scheduled time.
Each job consists of multiple stages to be created dynamically based on the list of elements.
And each stage will get assigned one ...
0
votes
1
answer
127
views
Jar stops after Jenkins stage has finished
I have a Jenkins 2.401.1 server running.
Inside it I am trying to create a declarative pipeline that should start a jar file.
The pipeline builds the code in one Jenkins agent and by using 'stash', ...
0
votes
1
answer
271
views
How to handle wildcards in `fileExists()` function without Plugins in Jenkins
I am using Jenkins declarative pipeline syntax and I need to check if a file exists. Otherwise it should abort the current stage. The problem I encounter is that the file contains a timestamp which is ...
0
votes
0
answers
21
views
Shared Jenkins Library returns the result of sh command instead of actual result
What I have:
Jenkins declarative multi-branch pipeline, which uses the my custom library.
Simple library function which performs some actions with commits messages.
Code and problem description:
...
0
votes
1
answer
89
views
How to run a Jenkins Pipeline when two triggers are successful
Here is my Jenkins Pipeline
pipeline {
agent any
triggers {
upstream 'Trigger1, Trigger2'
}
stages {
stage('Hello') {
steps {
echo '...
1
vote
1
answer
2k
views
How to validate code coverage percentage from Pytest
I came up with the below piece of code(jenkins pipeline) to run UTs and generate the coverage report for my Python application.
Now, I'm looking to fail the build if code coverage is lesser than 80% ...
1
vote
1
answer
3k
views
Jenkins Declarative Pipeline is exiting with ERROR: script returned exit code 123
Intent: I am writing a Jenkins Declarative pipeline to integrate JMeter test suite with JenkinsCore. At a point, jmeter.sh script is called and I generate jmeter.jtl file in xml format.
From the ...
1
vote
0
answers
737
views
unable to resolve class hudson.model.StringParameterValue
I am developing a groovy script in my pipeline A to get the latest revision of a svn repository ,save it into revision variable and append it to the version number tag in a POM file in Pipeline B. The ...
0
votes
1
answer
961
views
How to block upstream/downstream build in Jenkins declarative pipeline?
I have 3 downstream build jobs which are triggered when 1 upstream job 'Project U' has been built successfully. Example:
triggers {
pollSCM('H/5 * * * *')
upstream(upstreamProjects:...
0
votes
1
answer
682
views
Why is Groovy or Jenkins splitting a command into multiple lines
Our shared library uses these two (slightly abstraced) calls. The first one works perfectly fine. The second one splits the ${UNITY_PATH} command into multiple lines split where spaces are.
A ...
0
votes
2
answers
2k
views
How merge yaml in podTemplate?
I have the following code in groovy:
void call(Closure closure) {
pod_template_maven_image = ...
pod_template_maven_m2 = ...
pod_template_nodejs_image = ...
pod_template_sonar_image = ....
0
votes
1
answer
727
views
Why I can't set Jenkins environment variable with Microsoft Azure Service Principal secret?
I try to factorize the use of my Azure credentials inside my Jenkins pipeline. Instead of using withCredentials inside each stage of my pipeline I would like to initialize it into one environment ...
0
votes
1
answer
838
views
Jenkins execute command only if previous one failed
I have the following problem. I have a command that unfortunately only works from time to time in powershell. Sometimes an error comes sometimes it runs through.
Now I am looking for an option in the ...
1
vote
1
answer
757
views
Converting a gstringimpl to java.lang.string in a Jenkinsile
I have a pipeline which takes a persistent string parameter input. The pipeline then checks whether the parameter value is present in a list.
The problem is that the persisted string is of type ...
0
votes
1
answer
577
views
Jenkins Dynamic stage creation in declarative pipeline
I need to have a dynamic stages creation. Depending on the list size, it will have X amount of stages. Each of them will have stages before for allocation and preparation. As they have to run parallel,...
1
vote
1
answer
2k
views
Declarative Jenkins pipeline - How to set agent any only when condition is met?
Is it possible to specify agent 'any' only when a condition is met?
Context: I have a parallel pipeline with some common steps. The pipeline runs tests on Linux and Windows on two different agents. ...