Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [groovy]

For questions about Groovy, which is an object-oriented programming language for Java.

1
vote
1answer
47 views

Groovy script to show only selected item

I used jenkins Active choices plugin and Mavenmetadata plugin to build above UI. When I click a radio button particular version only should be display. How can I write a groovy script to fulfill above ...
1
vote
0answers
27 views

Pass Variable in pipeline script

I am trying to pass a variable input to "credentialsId: $creds" from SiteID but unable to. I tried multiple expressions in pipeline script with quotes etc and none worked. I am learning and need ...
3
votes
1answer
368 views

Jenkins Groovy to parse console output and mark build failure

What would be a Groovy or pipeline step to parse Jenkins console output, identify a string and mark the build as failure if the string is matched?
2
votes
3answers
173 views

Jenkins UUIDs … oh the humanity

I have an environment block environment { SUITE_RUN_ID = UUID.randomUUID().toString() SMOKE_CMD = "runtests.sh SUITE_RUN_ID=${SUITE_RUN_ID}" FAILED_TESTS = "output_rerun_info.rb SUITE_RUN_ID=${...
3
votes
1answer
1k views

Get changes of the parameterized pipeline on the fly in Jenkins

Is it possible to get changes of the parameterized pipeline on the fly after making changes there? For example I have a pipeline code: properties([ parameters([ string(name:...
1
vote
1answer
222 views

Compatibility of http-builder-ng Groovy module with Jenkins 2

Did somebody had a chance to use http-builder-ng Groovy module in Jenkins pipeline? When I use this module with any kind of request/URL it always returns me null object when the same source code ...
2
votes
1answer
493 views

How to set a Git repository when creating a job in Jenkins from a Groovy script?

I'm trying to setup a Jenkins server with Groovy script: def repository = 'git@somerepo' import hudson.tasks.Shell; job = Jenkins.instance.createProject(FreeStyleProject, 'TestJob') job....
2
votes
2answers
1k views

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++) { ...
5
votes
2answers
2k views

Jenkins libraries configuration in Jenkinsfile

Right now we have many projects with similar Jenkinsfile's. Instead of copypasting we're developing a shared library with some utilities. This library is loaded dynamically in each Jenkinsfile, and ...
5
votes
3answers
1k views

Jenkins Pipeline downstream job; exit unless it hasn't run in the last x hours

Is there a way in Groovy directly or by integrating Jenkins plugins to have a downstream job complete only if it hasn't been run in the last X hours already? Let's say I have unit tests, when green, ...
35
votes
3answers
48k views

Cleanest way to prematurely exit a Jenkins Pipeline job as a success?

I have a job that will create files, unless one of the values being fed to it matches an older value. What's the cleanest way in Jenkins to abort or exit the job, without it being FAILED? It exiting ...