2,964 questions
0
votes
0
answers
77
views
How to create an atomic unabortable step in jenkins
I have a Jenkins pipeline with a critical stage that runs my custom .NET CLI performing important tasks. I want this stage to be fully atomic, meaning that if someone tries to abort the build while ...
0
votes
0
answers
21
views
Jenkins Groovy list user login with Groovy script
I am Rajeswari
In the groovy script i have to filter who login in Jenkins but
I am able to filter the user list all in the manage/security Realm the user list So
How to use it
they is no direct method ...
0
votes
1
answer
59
views
How to reuse method in loaded script from main script in Jenkins without using libraries
I have a main Groovy file with defined methods, and I've loaded a second Groovy script.
main-script.groovy
node('Node1'){
Method1()
Method2()
def loadedSecondScript = load('./second-...
0
votes
1
answer
43
views
How to reuse a loaded script in another loaded script in Jenkins without using libraries
I have a main job script,
pipline.groovy
node('Node1'){
def script1 = load('script1.groovy')
script1()
//..some code
def script2 = load('script2.groovy')
}
I load two scripts in it,
script1....
0
votes
0
answers
54
views
which import for StringCredentialsImpl
This is follow up on open request - jenkins groovy update kind="secrets text" credentials store in jenkins
Trying alternative approach, and i am getting an error - unable to resolve class ...
0
votes
0
answers
92
views
jenkins groovy update kind="secrets text" credentials store in jenkins
Trying to find out what is wrong. thinking I am missing something. context - want to update the secret in the secrets-text credential store by providing only "Credential ID".
I confirm that ...
0
votes
1
answer
468
views
How to use globules correctly in a `Jenkinsfile`?
My original Jenkinsfile was something along the lines of:
DATA = [ ... ]
def Helper(def ver) {
def cfg = DATA[ver]
...
}
...
But this gets warnings in the logs to the effect of:
Did you ...
0
votes
0
answers
76
views
how to retrieve secrets from jenkins to migrate them to vault hashicorp
I want to know how to use jenkins plugins to list all of ly jenkins credentails with SystemCredentialsProvider
I used :
def credsStore = jenkinsInstance.getExtensionList('com.cloudbees.plugins....
0
votes
0
answers
59
views
Jenkins issue: fatal: not a git repository (or any of the parent directories): .git
We are running Jenkins on a GKE cluster and have observed a strange issue with our multibranch declarative Jenkins pipeline at the beginning of the pipeline execution.
13:27:09 + git config --global -...
0
votes
0
answers
44
views
Jenkins pipeline: Hardcoding a credential in casc.yml
We are using Jenkins pipelines for the CI/CD in our .NET 9 APIs, but I'm new to this, and I'm stuck regarding how to hardcode a specific credential in the casc.yml file.
casc.yml (the place where my ...
0
votes
0
answers
53
views
Jenkins Groovy, how to put variable in oc exec
I would like to get pod name in groovy, and then to use this name to launch script in this namely pod
For example i get pod's name :
def testVar = "Test"
...
0
votes
0
answers
113
views
Completely disable replay option
I would like to disable replay for all jobs, the matrix replay is unchecked. Yet everyone can still replay.
I've removed import hudson.model.* from all of the pipelines, and it's still there and ...
1
vote
1
answer
114
views
Jenkins pipeline operation not permitted
I'm working on a Jenkins pipeline and can't understand why one of my steps can't be executed on the target machines.
Basically, I want to deploy my new code from github repository with Jenkins agent ...
1
vote
1
answer
169
views
Cannot choose between the following variants of com.google.guava:guava:33.2.1-jre:
I've below build.gradle -
buildscript {
repositories {
maven {
name 'jenkins'
url 'https://repo.jenkins-ci.org/releases/'
}
}
}
plugins {
id '...
0
votes
1
answer
64
views
Switch statement unexpected behavior in groovy (case without break)
I have programmed in C and Java and a switch statement like this:
switch (option) {
case 1:
do A;
case 2:
do B;
break;
default:
do C;
break;
}
In those ...
0
votes
0
answers
90
views
Is there a way to use a shared library in Jenkins without hardcoding the branch name?
I have a jenkinsfile in git branch "my-branch" that imports a class.
@Library('my-branch') _
import foo.bar.info.stuff
However sometimes I create copies of the branch for testing e.g my-...
0
votes
0
answers
40
views
Active Choice Reactive Parameter Issue
I am using one active choice reactive paarmeter (menifest_to_be) while running the script first time it works properly. But as I go again to build it, it runs the fallback script because it is not ...
0
votes
0
answers
37
views
Reusable Steps for Declarative Pipeline Jenkins/Groovy [duplicate]
I come from an OOP background and I want to define reusable steps inside of groovy classes. Inside my declarative jenkins pipeline I then just want to define objects of those classes and execute the ...
0
votes
0
answers
35
views
Jenkins - Active Choice RR Parameter with HTML Button
I want to add a button to the build page that when clicked will make part of the table appear (is js even possible when using the active choice plugin?).
I'm trying to add a button to the HTML code of ...
0
votes
0
answers
100
views
withCredentials Credential Variable Injection and Interpolation in Jenkins on Windows
I'm new to Jenkins (version 2.492.2 on Windows) and cannot seem to get access to the password from withCredentials via the shell/environment variable.
I’ve tried a few variations in the snippet below. ...
0
votes
0
answers
57
views
Jenkins second CascadeChoiceParameter does not refresh properly
I have this jenkinsfile:
properties([
parameters([
[
$class: 'CascadeChoiceParameter',
name: 'ENVIRONNEMENT',
choiceType: 'PT_SINGLE_SELECT',
filterLength: 1,
...
1
vote
1
answer
124
views
In Jenkinsfile, how do I set environment variables from parsed YAML file?
My Jenkinsfile looks like this:
pipeline {
agent any
parameters {
choice( name: 'project_short_code', description: 'The short code for this project', choices: ['foo','bar'])
}
...
0
votes
0
answers
64
views
I'm attempting to establish an HTTPS connection from my Jenkins server to the Vault server using certificates (ca certs.pem ) using groovy
I'm using groovy and below is my code, which is not working as expected, its saying, unable to find valid certification path to requested target, although while doing ls I find the file there, can ...
0
votes
0
answers
58
views
How do I pass global variable in Groovy scripted Jenkins functions with DynamicReferenceParameter class
I have the following Groovy scripted Jenkins pipeline file where the variable partitions is currently inside the function getPartitionParameter(). Since this variable contains a lot of items in real ...
-1
votes
1
answer
92
views
jenkins active-choices-parameter not working
In Jenkins Version 2.440.1 Active Choices Plug-in
版本2.8.3 is OK。
enter image description here
But I upgraded to Jenkins Version 2.479.3 Active Choices Plug-in
版本2.8.6 He's not working anymore.
enter ...
0
votes
0
answers
20
views
Track Status of Multiple Async Jenkins Jobs in Flask via HTTP/ Rest Call?
I have a Python Flask application that triggers X (e.g., X=100) asynchronous calls to start Jenkins jobs simultaneously using an API. Once all the jobs have been completed, I need to trigger another ...
0
votes
1
answer
48
views
Create CSV from JSON output with 1 to many map in Groovy
I have a request in which I want to run a loop on 1st Json capturing one item and one url from it. The url will then retrieve another json which will have versions and phase in it corresponding to the ...
0
votes
1
answer
44
views
Fail to create a file with Groovy in Jenkins K8s agent
I have created a k8s Jenkins agent. In a test job, there is a stage to create a file as below
stage('Test New file') {
steps {
script {
def fileName = &...
0
votes
1
answer
34
views
Run Job Against Different Environment On Jenkins Manually
On Jenkins I want to run my test suite against different environment manually like (stage, QA, prod). How to achieve the same? Also I Want to map environment with special group of test cases. Like To ...
0
votes
1
answer
71
views
"$" is being removed when used bash inside groovy
I am using bash script inside Groovy in the Jenkins pipeline. Jenkins job is parameterized and using a password parameter option named "PASSWORD". The issue is when password contains "$&...
0
votes
0
answers
51
views
Jenkins second parameter is not refreshed on the first load
I have a jenkinsfile with 3 parameters to deploy an artifact to an environment.
properties([parameters([
choice(name: 'ENVIRONNEMENT', choices: ['dev', 'test', 'pprod', 'prod']'),
[
$class: '...
0
votes
1
answer
215
views
Active Choice Parameter changes to String Parameter when job fails
I created a parameterized Jenkins Job which has two active choiced parameters, the second one is reactive (depends on the first one). Each parameter uses a groovy script to generate their values of ...
1
vote
0
answers
269
views
Jenkins pipeline fails on git ls-remote command with error can't run program "nohup" in Failed to exec spawn helper: pid: 1224365
Jenkins pipeline failed on command:`curl -H 'X-JFrog-Art-Api: ****' -H 'Content-Type: text/plain' --data-raw 'items.find(
[2024-12-08T18:21:14.465Z] {
[2024-12-08T18:21:14.465Z] "...
0
votes
2
answers
371
views
How to add a file I create in groovy in Jenkinsfile to the artifacts?
I have a groovy function that creates a json file and I'd like to include that file in the artifacts of the build.
String pipelineCustomWorkspace = "/jenkins/pipeline-${BRANCH_NAME}/${...
0
votes
1
answer
119
views
My jenkins pipeline was working fine and now all of a sudden it stops right away after I click build and trigger it. Putting all the logs here below
Nov 18, 2024 4:54:18 PM INFO hudson.WebAppMain contextInitialized
Jenkins home directory: /var/lib/jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Nov 18, 2024 4:54:18 PM INFO ...
1
vote
0
answers
63
views
{"errors":["no data provided"]} while passing json payload in curl to update secret id in vault using Cloudbees/Jenkins Pipeline
I am trying to update the secret id in vault using curl in jenkins pipeline. I am getting error "{"errors":["no data provided"]}" during the curl call :
Here is the curl ...
-1
votes
1
answer
42
views
Jenkins Error: WorkflowScript: 65: unexpected token: } @ line 65, column 1. Code Line does not exist
Hello deer human beings
I have a Pipeline running on docker, with it i want to build 2 images.
but everytime i run it i get this error:
Started by user Elias Spycher
Checking out git https://github....
0
votes
0
answers
51
views
How can I have different value and text in CascadeChoiceParameter in Jenkins pipeline
Currently I am rendering the CascadeChoiceParameter with a groovy script that returns a list:
['1', '2', '3']
So in the drop-down I see the values as the lables/text of the choices:
1
2
3
Is there a ...
1
vote
1
answer
475
views
Howto handle UnknownHostException error in Jenkins
I have a Jenkinsfile looks like this:
import jenkins.org.apache.commons.validator.routines.DomainValidator
pipeline {
agent any
stages {
stage ('Validate actions') {
...
1
vote
1
answer
75
views
Is there a way to modularize Jenkinsfile while keeping the stage functionality?
I have a enormous Jenkinsfile that I need to modularize to improve maintainability, so what I want to do is seperate build, test and deploy into individual files but each has multiple stages and I don'...
0
votes
1
answer
77
views
How to check if a particular string/property exist in JSON file using Groovy
I have below jSON file in which I need to check for 'shortTerm' and 'longTerm' existence.
If they exist take the value from the versionName and assign to shortTerm variable else assign 'N/A' if doesn'...
1
vote
1
answer
191
views
New Jenkins Agent Containers Will Not Run Properly
We have been in the process of setting up a new Jenkins instance and as we have onboarded various projects we have created Docker images to be used in K8s pods to execute various pipelines. Suddenly, ...
0
votes
2
answers
143
views
how to read json data in groovy
Team,
I am making a call to gerrit server and return is I believe json. From this I am trying to read fields but getting error in the first step itself. any hint? My call to gerrit and storing its ...
0
votes
0
answers
130
views
java.lang.IllegalStateException: failed to create a child event loop [Jenkins Pipeline]
Terms:
UT = unit tests
IT = integration tests
Issue:
The following error comes up when I try to build the code on Jenkins. The code contains UT and IT based on Java 17, Maven 3.6.0 and Testcontainers. ...
0
votes
1
answer
67
views
Call withCredentials and passing different credential ids
The goal of the job is to call a function that runs commands on certain machines. Since the machines will be in difference clouds, subscriptions, etc we have different credentials to be able to access....
0
votes
1
answer
50
views
How to define a variable first right after SSH into a remote server?
I want to redeploy a docker container via Jenkinsfile on a remote EC2, but I struggle to find a solution that works with ssh. I want to have to lookup if the container already exist and remove it ...
0
votes
1
answer
92
views
How to Define Parameters in a Central Shared Library in Jenkins
I'm using Jenkins 2.440.2. I want to be able to define all the parameters in a central place like Shared Library and reuse those parameters configuration in different Jenkinsfile.
// vars/commonParams....
0
votes
1
answer
72
views
Jenkins Pipeline: Shared Libraries failure to access instance classes
I am implementing significantly more complex rules for working with nodes which the built in node handling... well, can't handle. I need to use this in a function which dynamically generates stages ...
1
vote
1
answer
171
views
How can I use AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to perform actions in AWS through a Jenkins pipeline?
I'm trying to create a Jenkins pipeline (.jenkinsfile) to perform some actions in AWS, but cannot give everyone in my company access to the pipeline. My thought was to have the user paste in their ...
1
vote
0
answers
97
views
Capture and convert the output of command into csv file in groovy
I have below code in groovy which is providing 2 different output. I want to take the first row values one by one from command1 output and substitute in command2 as variable in loop.
import java.text....