Question regarding using groovy code in Jenkins, specifically in Jenkinsfile and groovy plugins
Questions tagged [jenkins-groovy]
2809 questions
0
votes
0 answers
Error: Error cloning remote repo 'origin`
I'm facing the same issue as mentioned here
ERROR: Error cloning remote repo 'origin'
I'm getting this issue when it is triggered as a downstream job (triggered from another job / Upstream). I'm still be able to make it work by rebuilding the build…

VijayasaiVS
- 34
- 2
0
votes
1 answer
Unable to access variable in Jenkins- groovy
I have the below code in my Jenkins pipeline:
stage('CR Check') {
steps{
script
{
sh """
echo "Tagert env is ${targetenv}"
if [[…

djgcp
- 163
- 1
- 14
0
votes
1 answer
Powershell start-process from Jenkins pipeline with -RedirectStandardOutput does not output
When running powershell start-process from Jenkins pipeline with -RedirectStandardOutput "$PSScriptRoot\Script.output.txt"
locally it writes the output to the file.
When it runs in my jenkins pipeline i does not out anything to…

havmaage
- 573
- 7
- 25
0
votes
1 answer
How to set value to vars.tfvars or variables.tf in terraform from Jenkins string parameter
Is there way to set a value for vars.tfvars by passing a string parameter from Jenkins?
Jenkins sting parameter. This is groovy scripeted pipeline
cat vars.tfvars
cat variables.tf

Anushka Fernando
- 61
- 7
0
votes
0 answers
jenkins upload directory and subdirectories to s3 using withaws
I need to upload files located on jenkins build workspace to s3
The folder named formated_files and it contains two sub-folders, dir1 and dir2
I am using withAws as followed:
withAWS(credentials: 'my-credentials', region: 'us-east-1') {
…

Ziv M
- 409
- 6
- 18
0
votes
0 answers
How do I remove parameter instances from a List in a groovy Jenkinsfile?
I have a jenkinsfile that's starting numerous other jobs in Jenkins. I have a list of common parameters that I'm passing down to each job.
def buildParams = [
string(name: 'JIRA_ID', value: params.JIRA_ID),
string(name:…

Chip
- 1,439
- 3
- 15
- 29
0
votes
0 answers
Why does this Jenkins job not consistently retry when my spot instance gets interrupted?
I've been trying to get our CI job in Jenkins to run on spot instances in EC2 (using the Amazon EC2 plugin), and I'm having trouble figuring out how to retry consistently when they get interrupted. The test run is parallelized across several Jenkins…

Cody
- 2,467
- 2
- 21
- 30
0
votes
1 answer
Stop reoccurring Jenkins Job automatically after some time
I'd like to start a pipeline job manually. This job should then run daily and after seven days stop automatically. Is there any way to do this?

Julian Re
- 1,023
- 1
- 8
- 10
0
votes
0 answers
jenkinsfile between multiple containers in a pod
Team :
We have Jenkins X running on top of AWS EKS (K8s), and we have jenkins agents(slaves) running as k8s pod. This pod has two containers - jnlp and docker. We use "jnlp" container to build/compile and we use container "docker" to run "docker"…

Hare Krshn
- 41
- 4
0
votes
1 answer
Set default value of job param dynamically in Jenkins pipeline
Is it possible to set the default value of a choice parameter dynamically to TRUE or FALSE through pipeline script with an input(TRUE/FALSE of that parameter itself)
So that in the next execution no need to set the default value again it should take…

dev
- 73
- 2
- 6
0
votes
0 answers
Updated Jenkins and ReadToString() no longer works
we recently updated Jenkins and when running one of our jobs to upload a wildcard cert to aks it no longer excepts ReadToString(). It offers a possible solution but simply changing it doesn't resolve the issue.
Version: Jenkins 2.361.1
Pipeline…
0
votes
1 answer
How to use "sed" commands in Jenkins pipeline
I have to remove space between two words in pipeline log. here is pipeline code
echo "MyUserName: ${cause.userName}"
after this, output in log file is
MyUserName: [James Perera]
expected output in log file
MyUserName: [JamesPerera]
This is what I…

Zero5
- 151
- 7
0
votes
0 answers
How to execute concurrent build from Pipeline as by default it is disabled
So Many are saying it is enabled by default but this is not in my case. I have multi branch Pipeline where root directory is defined in a folder. Whenever I start the build it creates /workspace/ folder and inside it checkout the code.
I tried to…

Raghuvir Singh
- 85
- 1
- 12
0
votes
0 answers
Add post-build action in multiple Jenkins jobs via groovy script
Can someone help me create groovy script that add post-build action to multiple jobs at the same time?
Post-Build I am trying to add is the "re-try build after" set to 3 times if job is unstable or fails.
looks like below from the config.xml
I am…

Mochi79
- 55
- 1
- 6
0
votes
1 answer
How to use specific maven and jdk on Jenkins
I have corporate Jenkins where I don't have access to Manage Jenkins option. I want to make a build of my java app using maven.
When I try to run mvn clean install:
dir("test/test2/project") {
sh "mvn clean install -Dmaven.test.skip=true"
}
I get…

Alex
- 97
- 8