Category "groovy"

Groovy script to get translations using Google Translate API gives java.lang.NoSuchMethodError

I am trying to write a Groovy script to get translations from Google Translate API (using an API key, stored in as the GOOGLE_API_KEY environment variable1) but

Script section is not working in pipeline script in shared library

My Jenkins file: @Library("shared@dev")_ Start() My Start.groovy pipeline script: def call() { pipeline { agent any stages {

Groovy LinkedHashMap returned from a Jenkins shared library is converted to String

I have a function in a Jenkins shared library which builds and returns a map object (class java.util.LinkedHashMap): #!/usr/bin/env groovy def call(Map config)

In groovy, how can i iterate over a csv file and call a function for every "group" that as a different value on some of the columns?

In Groovy and running on a jenkins pipeline, I am using the readFile function from jenkins to read the csv file. Example csv: name val1 val2 John 2 122 John 2

How to generate numbers in order from 1 to 10000 in groovy?

I need to parameterize the script so that the numbers are used in order

Escape & character in groovy script while using curl

I'm using bash execution of curl in groovy script: descr = """ curl --silent -k -u test:test "https://bitbucket/rest/api/1.0/projects/test/repos/test/pul

Jenkins active choice options populated with gke cluster namespaces

I am trying to create a Jenkins pipeline with active choice parameter options populated with GKE Cluster namespaces. I can Run a single shell command and get ou

Fill Map<String, Object> with two strings

I want to fill my Map with two strings. For my Map I have to use <String, Object>. Using <String, String> would instantly solve my problem, but that

Running Groovy in Email Extension Plugin Jenkins

I need to create a url and send a mail from the Jenkins Email Plugin. I simply need the filenames to creat the url. The files are in the workspace itself. After

Call helpers in a Jenkins Shared Library

I have a Jenkins Shared Library organized like that : +- src | +- main | +- jenkins_shared_library | +- helpers |

How to reset a method mock in Spock?

I had a mocked bean in a configuration: @Profile('test') @Configuration class TestSecurityConfig { private final mockFactory = new DetachedMockFactory() @Pr

Build stages in Jenkins only when specific files are changed but use a function

I want to update my Jenkins pipeline in way that certain stages are only build when some specific files are changed (git is already integrated in the pipeline).

Unable to download Azure DevOps test result attachments using REST API in Groovy Unable to determine the current character

I need to download test result file attachments to a folder on my hard drive. When I run the call using talend it returns the file (png) image file in the body

what does No such DSL method 'readCSV' means in a jenkins pipeline?

I need to read a simple csv file and going through the documentation I found this readCSV method which comes with Jenkins, I have set a sample file named test.c

Jenkins groovy regex pattern search and match in commit message not working as expected

I'm working with this pipeline where running tests from a commit message should be an option. I'm a novice in groovy and regex, but I have managed to get matche

Groovy map, get, variable, Jenkins

I have a problem with mapping in Groovy. I would like to get a value based on a variable. def function(){ map = [ 'test1': '1234', 'test2'

Groovy-Eclipse Compilation Failed : Source level should be in '1.1'...'1.8','9'...'15' (or '5.0'..'15.0'): 17

I wanted to compile groovy along with java sources so I added groovy-eclipse-compiler to pom.xml but I got an error: Groovy-Eclipse: source level should be in

Problem when string date to Date format in groovy:

I'm trying to compare a String with a date in it with the current date, but when I try to parse the string to date format it always give me an error. the part

How can I fix "unsupported class file major version 60" in IntelliJ IDEA?

I have a Gradle project in Ubuntu. It's written in Java 14. I have the Java 14 JDK installed. When I build it from the command line, everything works, but no

setting micronaut configuration location

I have an existing groovy micronaut app I'm trying to change where it loads its config from. I don't understand what code to write so I can set the location of