groovy

How catch curl response into variable in Jenkinsfile

↘锁芯ラ 提交于 2020-01-23 05:55:34
问题 I want to curl an URL and capture the response into a variable. when I curl a command and echo its output I get the correct response as below sh 'output=`curl https://some-host/some-service/getApi?apikey=someKey`;echo $output;' I want to catch the same response into a variable and use that response for further operation Below is my Jenkinsfile pipeline { agent { label "build_2" } stages { stage('Build') { steps { checkout scm sh 'npm install' } } stage('Build-Image') { steps { echo '.........

Grails actions getting called twice. Help!

爷,独闯天下 提交于 2020-01-23 03:20:08
问题 I'm writing a grails app and running into a strange problem. When clicking the submit button on a page, the associated action gets called twice in rapid succession. This causes everything to break horribly. Has anyone else seen this issue before? Below is my code: From the GSP page: <g:form method="post" action="show"> <h2>All items since...</h2> <g:datePicker name="startDate" precision="day" value="${new Date()}" /><br/> <h2>Format</h2> <g:radio name="feedType" value="RSS1" checked="true"/>

Jenkins Workflow Plugin Using a Groovy Library

╄→гoц情女王★ 提交于 2020-01-23 03:04:32
问题 As I'm writing more and more Groovy to use with the Jenkins Workflow plugin I've started getting to the point where I've got re-usable code that could be used in multiple scripts. What would be the best way of sharing this code? Is it possible to produce my own .jar with the shared code in and utilize this from within the Workflow script? Or is there a simpler way? 回答1: You can use Global Lib as pointed in other comments and/or use the load step to load you own scripts from somewhere (i.e.

Spring Tool Suite (STS) 3.5.0 - org.codehaus.groovy.eclipse is unknown in the solver

孤人 提交于 2020-01-22 19:52:10
问题 There is a problem with STS 3.5.0 https://issuetracker.springsource.com/browse/STS-3792 org.codehaus.groovy.eclipse 2.9.0.xx-201403261719-e43j8 is unknown in the solver! These are the steps I took to fix it and it allowed me to use eclipse marketplace 回答1: Help -> Check for updates Problem Occured "JDT Core patch with Java 8 Support for Groovy-Eclipse plugin" is not applicable to the current configuration and will not be installed. An internal error occurred during: "Searching alternate

Mocking FacesContext

走远了吗. 提交于 2020-01-22 17:13:26
问题 I am trying to add some unit tests to a JSF application. This application didnt rely heavily on any best practices, so many service methods use the FacesContext to pull data from managed session beans like so: (this is inside a util class) public static Object getPageBean(String beanReference) { FacesContext fc = FacesContext.getCurrentInstance(); VariableResolver vr = fc.getApplication().getVariableResolver(); return vr.resolveVariable(fc, beanReference); } What would be the best way to mock

Jenkins pipeline job: Set sleep time from a string parameter?

混江龙づ霸主 提交于 2020-01-22 10:29:07
问题 I'm new to Jenkins Pipeline jobs, and I'm facing an issue I cannot solve. I have a stage with a hardcoded sleep seconds value: stage ("wait_prior_starting_smoke_testing") { echo 'Waiting 5 minutes for deployment to complete prior starting smoke testing' sleep 300 // seconds } But I would like to provide the time argument via a job (string) parameter SLEEP_TIME_IN_SECONDS . But whatever I have tried, I am not able to get it to work. How do you convert a string parameter to the int time

no such DSL method `stages`

僤鯓⒐⒋嵵緔 提交于 2020-01-22 04:35:12
问题 I'm trying to create my first Groovy script for Jenkins: After looking here https://jenkins.io/doc/book/pipeline/, I created this: node { stages { stage('HelloWorld') { echo 'Hello World' } stage('git clone') { git clone "ssh://git@mywebsite.com/myrepo.git" } } } However, I'm getting: java.lang.NoSuchMethodError: No such DSL method "stages" found among steps What am I missing? Also, how can I pass my credentials to the Git Repository without writing the password in plain text? 回答1: You are

Manifest.MF issue with MSSQLSERVER 2008 and Groovy

拥有回忆 提交于 2020-01-22 02:11:14
问题 I have created a simple Groovy project in GGTS IDE that connects to Oracle and SQLServer. The Program runs fine within the IDE but when I run the program through the command line I seem to get some sort of enconding error in MANIFEST.MF?. See the stacktrace below: Command Line groovy -cp lib\ojdbc14_g.jar lib\sqljdbc4.jar src\Starter.groovy Result org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: C:\workspace-ggts-3.1.0.RELEASE\Test\lib\sqljdbc4.jar: 1:

Quotes appearing on CSV after concatnate fields using Groovy

假装没事ソ 提交于 2020-01-21 19:12:42
问题 I'm using groovy to concatenate two fields in CSV It's working ok except that the concatenated field is appearing with quotes. Is there any way to resolve this? ant.mkdir(dir:"target") new File("target/UpsertCheckDeals.csv").withWriter { new File("C:/Users/alon/Documents/CheckDealReadyForConcat.csv").splitEachLine(",") {Customer__c,Name__c,Deal__c,Check_Count__c -> it.println "${Customer__c},${Deal__c},${Deal_Source__c},${Salesperson_Name__c},${Customer__c}-${Deal__c}" 回答1: CSV is a more

RestClient Grails Import fails

ⅰ亾dé卋堺 提交于 2020-01-21 10:33:19
问题 I can't import the RESTClient in my grails project. The message is: Groovy:unable to resolve class groovyx.net.http.RESTClient In the BuildConfig.groovy I uncommented: mavenRepo "http://repository.codehaus.org" and added: compile ":rest-client-builder:2.0.0" I'm using grails 2.3.8 and Windows 7. Any ideas? The grails install-plugin does not work in this grails version. 回答1: The rest-client-builder plugin doesn't provide a class called groovyx.net.http.RESTClient . I think you are getting