Question regarding using groovy code in Jenkins, specifically in Jenkinsfile and groovy plugins
Questions tagged [jenkins-groovy]
2809 questions
5
votes
1 answer
Jenkins and newman - report not showing
I've defined the following step in a JenkinsFile which generates an html report while running the Jenkins pipeline:
stage('Run Integration Tests') {
steps {
dir("${env.WORKSPACE}/test/integration") {
…

Guy Hagemans
- 496
- 1
- 4
- 15
5
votes
2 answers
How can I call function from another file in Jenkins pipeline?
I want to collect functions common for pipelines in a separate file. I created directories' structure:
vars/
...commonFunctions.groovy
pipeline.jenkinsfile
anotherPipeline.jenkinsfile
commonFunctions.groovy:
def buildDocker(def par, def par2) {
…

lleviy
- 406
- 5
- 16
5
votes
2 answers
How to fix java.lang.RuntimeException: Error creating extended parser class: null error in Jenkins?
I am trying to run a jenkins pipeline job , it was working fine , today it started throwing this error .
java.lang.IllegalStateException
at org.objectweb.asm.tree.analysis.BasicInterpreter.(BasicInterpreter.java:66)
at…

sambit
- 339
- 4
- 12
5
votes
0 answers
Publish Html Report from multiple folders under singe Report Name - Jenkins, HTML Publisher
I have multiple code coverage reports in multiple folders under a singe name index.html , I need to Publish all the report Under a single name Called coverage report. Inside that all the index.html file should come.
The Thing I am looking to achieve…

Sebastian Peter
- 119
- 1
- 12
5
votes
0 answers
Disable jenkins replay
I am using a shared library. Wanted to know of any options by which I can disable the replay option in pipeline jobs. I find that to be a major drawback of using pipeline jobs as its easy to manipulate the groovy scripts in a replay.

devops84uk
- 691
- 2
- 6
- 20
5
votes
1 answer
Update Button with Active Choice Parameter in Jenkins
I'm trying to use the Active Choice Reactive Reference Parameter plugin to have an "update button" in my parameterized Jenkins Job. It will call an API and get the values but for now I have a simple js that update a cell in the html table with a new…

Geeshan
- 506
- 5
- 13
5
votes
2 answers
Unable to skip Jenkins Build by SCM Skip Plugin
I am working on a pipeline script in Jenkins to build the project based on a commit message. From Jenkins' forum, I noticed that we can use SCM skip plugin. I installed the plugin and added the below stage as the forum suggests:
scmSkip(deleteBuild:…

Karthik P
- 107
- 2
- 12
5
votes
1 answer
Jenkins Job DSL trigger is deprecated
I am using the Job DSL Jenkins plugin, and I have got a problem regarding the trigger. It is deprecated and when I update the code, then the deprecation warning is still shown.
Here the code before:
protected def job
void nightly(String schedule='H…

DRMTZ
- 63
- 1
- 3
5
votes
1 answer
How to get user inputs from Jenkins Active Choice parameter using Formatted HTML
I defined parameter of type "Active Choices Reactive Reference Parameter" on Freestyle Job
it returns HTML text input - .
but after populating this data and press "Build" i can't get the user input of this text field, tried with groovy or…

Adir Dayan
- 1,308
- 13
- 21
5
votes
4 answers
Jenkins pipeline from YAML file
Jenkins declarative pipeline is too powerful for us, often users can abuse it. We are thinking to use an opinionated YAML to describe CI/CD pipeline. And it seems there are two choices.
Write a plugin and consume YAML and dynamically create stage…

M L L
- 51
- 1
- 3
5
votes
1 answer
How to get the name of locked resource in Jenkins Lockable Resource plugin
I am using Jenkins Lockable Resources plugin to decide which server to be used for various build operations in my declarative pipeline. I have set up my Lockable Resources as shown in the table below:
Resource Name Labels
Win_Res_1 …

Yash
- 2,944
- 7
- 25
- 43
5
votes
1 answer
Add variable to dockerfile{} section in Jenkinsfile to enable docker_buildkit
This is snipshet of my code:
stage('tf run') {
agent {
dockerfile {
additionalBuildArgs "${ADDITIONAL_BUILD_ARGS}"
registryCredentialsId "${REGISTRY_CREDENTIALS}"
registryUrl "${REGISTRY_URL}"
reuseNode true
}
…

debek
- 331
- 7
- 15
5
votes
0 answers
How can I set a stage result message in Jenkins?
I noticed that, when you use error('foobar') in a stage, then "foobar" will be shown if you hover over the stage result, as shown here:
Is it possible to display a message similar to this if the stage was successful? It doesn't need to have some…

PixelMaster
- 895
- 10
- 28
5
votes
0 answers
Error in Groovy script: The current scope already contains a variable
I'm trying to write a groovy method for Jenkins pipeline. The method gets two variables, put them inside a string, and execute the string as a shell command.
Here is the method:
def method(A, B) {
test = "cp app/scripts/" + A + "config." + B…

Omri
- 1,436
- 7
- 31
- 61
5
votes
2 answers
Calling script from resource folder in Jenkins shared folder
Have PowerShell script in resource folder and want to use this script in shared library .groovy script which is under vars folder. Is it there a way to do so??

chris
- 324
- 3
- 17