Questions tagged [jenkins-pipeline]
For questions specifically about Jenkins 2.0's pipeline architecture. This includes both declarative and scripted pipelines.
260
questions
0
votes
0
answers
15
views
Queue jenkins job task in azure pipeline won't complete
I have set up an azure devops pipeline with a single task - to queue a jenkins build job. The jenkins job is a parameterised pipeline build. The job queues and runs as expected in Jenkins. I would ...
1
vote
2
answers
103
views
How To Convert Jenkins String Parameter To Terraform Map Variable? (Invalid number literal)
Edit (8/16/2023): I figured it out!
I'm trying to pass string parameter(s) to a Terraform map variable, but receiving error "Invalid number literal".
Jenkinsfile:
pipeline {
agent any
...
0
votes
0
answers
25
views
How to use dynamic jenkin parallelism more efficiently?
I have the following code, which is dynamically running the pipeline in parallel.
The issue is that the second set (group according to batchSize) is waiting until the first group completes ...
1
vote
1
answer
65
views
How can I use a pipeline Jenkins shared library to implement encapsulation, inheritance, and polymorphism?
I'm trying to implement the Builder design pattern in a Jenkins pipeline shared library. Say I have the following file structure and pseudo-code (to only illustrate the concept I'm after)
src/com/...
1
vote
1
answer
253
views
Jenkins - how to run pipeline only if no other job is running on agent/master
I am trying to implement a maintenance job for cleaning up caches (e.g. Maven, NPM).
In order not to disturb running jobs by deleting the caches the maintenance job should only run, if no other job is ...
2
votes
2
answers
1k
views
Jenkins try-catch the actual error instead of hudson.AbortException
how do I get the actual exception of a failed pipeline step/plugin?
I have the following pipeline code
try {
checkout(
scm: [ ... ]
)
} catch (error) {
echo error.getClass()
...
1
vote
1
answer
116
views
Plugin for Jenkins truncates Terraform Plan output
The Blue Ocean plugin for Jenkins truncates the output of a Terraform plan at around 1700 lines, and shows a button "Show Complete Log" for the full thing.
When I open the full log, ...
2
votes
1
answer
205
views
Passing Gradle credentials into Jenkins `dockerfile`agent?
I am looking at getting a newly provisioned Jenkins to run an existing dockerfile which does a gradle build and produces a runtime image which is then to be pushed to our internal docker repository.
I ...
1
vote
1
answer
3k
views
How to escape dollarsign in groovy shell command?
I'm making a declarative Jenkins pipeline which has a for loop to iterate over the output of a bash command. In that command it is necessary to use bash arguments e.g. "$1" for first ...
0
votes
0
answers
146
views
Automated security scanning in Jenkins during pull request using NMAP
I am trying to create an automated Jenkins Pipeline in which when a user tries to do a pull request (merge unto main branch of a GitHub repository) it will do automatic scanning of open ports using ...
1
vote
1
answer
2k
views
How to override global "environment {}" Jenkins Variables in a stage?
I'm trying to set up an automated Jenkins pipeline for the Development & Staging branches within our Git repository. I have most of the pipeline working. But I do not know how to override globally ...
0
votes
1
answer
421
views
Stage Parallelization in Jenkins declarative pipelines
I am trying to get a Jenkins (2.204.2) declarative pipeline to run parallel stages generated into a map on different machines. I am aware it can be done by mixing in the script block and I have done ...
0
votes
0
answers
171
views
How to add kubelogin in jenkins?
I am getting the following errors while trying to deploy a project on kyma using jenkins pipeline-
exec: executable kubectl-oidc_login not found
It looks like you are trying to use a client-go ...
0
votes
1
answer
3k
views
Running this groovy jenkins script output this error "WorkflowScript: 17: expecting '}', found ':' @ line 17, column 11"
#!groovy
env.BEARER_TOKEN = "uuuuuuuuuu"
node {
publishModule()
}
def publishModule() {
stage('Deploy Modules') {
}
}
def buildPayload() {
def payload =
{
"data&...
1
vote
0
answers
654
views
Best practice for building releases with Jenkins multibranch pipeline
We have started moving from Subversion to git (using Bitbucket, to be exact), and I'm unsure how to manage release builds with the multibranch concept.
This is how we do it in Subversion:
We have one ...
0
votes
1
answer
659
views
In jenkins how to restrict users to select first default element with other options in extended choice parameter
I have a jenkins job with multi select extended choice parameter. There are list of elements in a parameter. So, my requirement is I want to allow users to select multiple parameters excluding first ...
2
votes
0
answers
232
views
Complete automatic release process (with versioning) on a multibranch pipeline?
We have projects that once in a while need to be released with all the changes already present in the develop branch. Every time we make a new release, we update the code with the new release version ...
0
votes
1
answer
266
views
Force jenkins job to fail if stage did not run long enough
I am using Jenkins to build an rpm for some custom software.
During the build there must be a race condition that only seems to appear when building the RPM, which results in the job finishing ...
0
votes
1
answer
813
views
How to understand and resolve Jenkin job failure - Angular 13 app?
I'm new to Jenkins environment.
I was asked to upgrade Angular 7.x app which was built 3 to 5 yrs back into Angular 13. Upgrading the Angular app is done. now I want to deploy my UI changes through ...
1
vote
2
answers
351
views
Reuse block string without processing it on the fly
I have a block of code that work fine at the moment. But reuse that code is a little ugly.
pipeline {
agent any
stages {
stage('Stage 1') {
steps {
script {
...
0
votes
1
answer
309
views
Transferred 0 file(s) while transferring war file from Jenkins server to remote server
There's a jenkins server where my jenkinswar.war file is present in /var/lib/jenkins/workspace/project2/target/jenkinswar.war
I want this file to be transferred to other remote server at /opt/docker ...
1
vote
1
answer
6k
views
Jenkins checkout GitSCM and git step how does it work internally and why
When I execute my pipeline and I go and see on the actual Jenkins slave, the checked out commit doesn't have latest changes. But the logs and actual files in the workspace on the Jenkins slave running ...
1
vote
0
answers
84
views
Access commit webhook message in Jenkins pipeline
I've got a Jenkins server integrated with a GitHub Organization through a GitHub App and the Jenkins GitHub Branch Source plugin, and it is working fine and triggering builds on commits as intended.
...
1
vote
2
answers
1k
views
Rebooting node at end of Jenkins pipeline
I have a pipeline that runs on a dedicated bare metal node for automated performance benchmarking. Using bare metal is necessary due to the nature of the project.
Near the end of the pipeline, the ...
0
votes
1
answer
344
views
Understanding Jenkins plugins and agent
I was trying to understand jenkins agents. This page asks to first create jenkins docker agent. But it doesnt say where to execute these steps?
Q1. Should we be executing these steps on node or a ...
1
vote
1
answer
6k
views
Read and parse json file from workspace on slave node
I have a Jenkins job which runs on a slave node on another machine, both master and slave run on windows. The slave node is being run as a windows service. I am unable to read a json file from ...
0
votes
1
answer
2k
views
Create a folder in slave node using Jenkins pipeline groovy script
I have a Jenkins job which runs on a slave node on another machine, both master and slave run on windows. The slave node is being run as a windows service. The main repository has git submodule ...
2
votes
0
answers
100
views
Jenkins declarative pipeline with mvn, releases and versioned artifactory
We have a requirement to support human defined versions (not auto generated) for patch releases. I'm trying to figure out a way to do this in Jenkins.
We have:
BitBucket, Jenkins, Nexus/JFrog (either)...
0
votes
1
answer
1k
views
How to use the Shared Workspace plugin in a Jenkins pipeline?
I want to use the Shared Workspace plugin, so I set up the following key/value pair in my Manage Jenkins -> Configure System -> Workspace Sharing
Name: sandbox-workspace
Repository URL: git@...
1
vote
0
answers
183
views
Add Cache-control: no-cache,no-store metadata to object uploaded via S3 Publisher plugin in Jenkins
So i have a jenkins job that builds a project and then uploads specific files to an S3 bucket.
I've set up the S3 Publisher plugin shown in the attached image, but the metadata is still not being ...
2
votes
2
answers
3k
views
Shared Jenkinsfile for multiple pipelines (separate source repositories)
I'd like to write one Jenkinsfile to be shared between a number (~50) of pipelines/jobs, where each job handles the creation of a library from a specific source (git) repository.
Currently I have one ...
0
votes
0
answers
331
views
Mention users on Slack for failing builds
Scenario:
I have jobs with Jenkinsfiles where I can get the env.BUILD_USER_ID exposed by a Jenkins plugin. So, what I`m planning to do is associating this variable content to the Slack user ID value, ...
0
votes
1
answer
921
views
Can one run a docker container with systemd from a jenkins pipeline?
I have been unsuccessful running a docker container with systemd from a jenkins pipeline without getting the following error message:
ERROR: The container started but didn't run the expected command. ...
0
votes
2
answers
1k
views
What is the best practice for a multibranch pipeline configuration?
I'm messing around with a multibranch pipeline in jenkins. Currently we have zero pipelines in production and everything is using freestyle jobs which is very sloppy. I have my own multibranch ...
0
votes
1
answer
370
views
Execute python file existing inside image with Jenkins
I have an Image A, which has a python file "main.py". I want to know how I can use Jenkins to run that file from a different pipeline. I want to use Jenkins to go inside that image and then ...
0
votes
1
answer
693
views
Checkout shared library with tag with legacySCm
So trying to checkout shared library by tag. This works perfectly with moderSCM, but for reasons we need to use other way (legacySCM);
def lib = library identifier: 'jenkins-shared-library@41',
...
0
votes
2
answers
128
views
Recommended starting guide on CICD
I'm new to the community, and I looked around a bit but didn't find a good point to start from. I have a specific problem I want to solve, but while trying to think of a solution I realized I need a ...
1
vote
1
answer
1k
views
Run multiple (dynamic list) other jobs from a single job
I have 30+ jobs in jenkins that deploy code. For any release, it could be 1 to 30 of those jobs that need to be run. Each job is standalone and deploys its piece independently. For simplicity let's ...
1
vote
1
answer
1k
views
net.sf.json.JSONException: Invalid JSON String error on jenkins
Warning: API call to create metrics set failed:
[Pipeline] echo
net.sf.json.JSONException: Invalid JSON String
at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:143)
at net.sf.json....
1
vote
1
answer
539
views
Why does Jenkins' Stage View not show my jobs as ending?
I am using Jenkins' remote API (XML & JSON) to submit Jobs, run them & retrieve the logs. When observing the jobs in Stage View, I noticed that (following a change in my "submission ...
2
votes
1
answer
2k
views
Re-running a pipeline job if failed
I've heard about the Naginator plugin, but unfortunately it's only for freestyle job type.
Is there any solution for pipeline jobs to be triggered if they failed? I thought about creating a command in ...
1
vote
0
answers
160
views
Jenkin "unable to find valid certification path to requested target" getting error while installing plugin
We are trying to set up jenkins. When we trying to install plugin getting the below error. We also tried to import the trusted certificate into the JVM directly still getting same error.
sun.security....
1
vote
2
answers
247
views
Package installed using Dockerfile not available on Jenkins pipeline stage
I'm having sort of a weird problem with my Jenkins pipeline. I've defined a Dockerfile which installs some tools I need for my CI/CD pipeline, such as node, npm, sfdx, and sfpowerkit (a plugin for ...
0
votes
1
answer
508
views
Jenkins Pipeline job does not use Squid Proxy
I have configured a Squid Proxy and it seems to be working when I add below Env variables to the /home/user/.bashrc file to a client machine.
Note: SSL Bump is configured, Self Signed Cert is added to ...
2
votes
2
answers
4k
views
Send command to docker image while start in Jenkins file
In scripted Jenkinsfile if I need to send a command to Docker image, I can do like this:
docker.image('mysql --default-authentication-plugin=mysql_native_password')
How can I do the same in ...
1
vote
1
answer
715
views
Jenkins Pipeline - conditional execution with branch and 1 other parameter (manual)
We are deploying our application using Jenkins pipeline like this -
pipeline {
agent any
stages {
stage('Build For Production') {
when { branch 'development' }
steps {
...
1
vote
2
answers
402
views
Jenkins pipeline retry option triggers two builds at a time, one in execution state other in pending state for a single click
For example
I have clicked on retry option at build number 2 in Jenkins pipeline view, where as build number 3 gets start and build number 4 also gets start and awaits at pending state.
Why the build ...
1
vote
0
answers
91
views
Application deployed in tomcat cannot be started through Jenkins pipeline [closed]
I've deployed an application deployed in tomcat and want to restart and hence stop it first and then start it with following code -
def startServer() {
withEnv(['JENKINS_NODE_COOKIE=dontkill']) {
...
-1
votes
1
answer
1k
views
How to get ConsoleFull Output,changeLog of upstream job along with downstream jobs console full output and changeLog in jenkins pipeline jobs!
Lets say we have Jobs A , B , C ,D and E.
Job A triggers Job B ;
Job B triggers Job C;
Job C triggers Job D;,
Job D triggers Job E;
When one of the child job fails for example: Job c fails then email ...
1
vote
2
answers
52
views
Our code is behind a firewall and we don't want to put source code in cloud. Are there any good CI/CD using local agents for Azure/Github actions
Our source code is in our servers and we don't have approval to put it in cloud.
We don't have a seamless CI/CD. Can we use Azure pipeline agents or any local agents to build our code and only export ...