Top "Jenkins-groovy" questions

Question regarding using groovy code in Jenkins, specifically in Jenkinsfile and groovy plugins

How to create methods in Jenkins Declarative pipeline?

In Jenkins scripted pipeline we are able to create methods and can call them. Is it possible also in the …

jenkins groovy jenkins-pipeline jenkins-groovy jenkins-declarative-pipeline
How to exit from the Jenkins pipeline if a stage sets build fail/unstable status?

I have a declarative Jenkins pipeline with stage1, stage2, stage3 and so on. I want to stop stage2 from running …

jenkins groovy jenkins-pipeline jenkins-groovy
Create a file with some content using Groovy in Jenkins pipeline

I am trying to create a file called groovy1.txt with the content "Working with files the Groovy way is …

jenkins groovy jenkins-pipeline jenkins-job-dsl jenkins-groovy
Jenkins pipeline script to copy or move file to another destination

I am preparing a Jenkins pipeline script in Groovy language. I would like to move all files and folders to …

java-stream jenkins-pipeline jenkins-groovy
No such property: api for class: groovy.lang.Binding error

Im trying to build a pipeline on Jenkins that runs a command on node and informs me of the following …

groovy jenkins-pipeline jenkins-groovy
Read json from jenkins

Im trying to read a json file from within a jenkinsfile with grovvy script. Im using the pipeline-utility-steps-plugin, which allows …

jenkins jenkins-groovy
How do you handle global variables in a declarative pipeline?

Previously asked a question about how to overwrite variables defined in an environment directive and it seems that's not possible. …

jenkins groovy jenkins-pipeline jenkins-plugins jenkins-groovy
How to get a list of all Jenkins nodes assigned with label including master node?

I'm creating a Jenkins pipeline job and I need to run a job on all nodes labelled with a certain …

jenkins jenkins-pipeline jenkins-groovy
Load properties from properties file and make them available throughout the job/pipeline - Jenkins declarative syntax

My requirement is simple, i just want to externalize some 'values' to make my Jenkinsfile more re usable and for …

jenkins groovy jenkins-pipeline jenkins-groovy
Capture exit code from bash scripts in jenkins groovy scripts

Executing a bash script copy_file.sh from Jenkins Groovy script and trying to shoot mail depending upon the exit …

bash jenkins jenkins-pipeline exit jenkins-groovy