Re: Why does somestring.digest('SHA-1') fail in pipeline

2019-05-01 Thread ZillaYT
Jenkins pipeline has been working for us so far, except for these little 
gotchas.

Thanks!

On Wednesday, May 1, 2019 at 1:55:16 PM UTC-4, Daniel Beck wrote:
>
>
>
> > On 1. May 2019, at 02:11, Slide > 
> wrote: 
> > 
> > I don't know what version pipeline is using right now. 
>
> We're on 2.4.x. 
>
> And as usual, don't (ab)use pipeline as a general purpose programming 
> environment. It's not intended to be, never was. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/49eb9169-9995-45ce-a844-66e2f08ce5e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why does somestring.digest('SHA-1') fail in pipeline

2019-05-01 Thread Daniel Beck



> On 1. May 2019, at 02:11, Slide  wrote:
> 
> I don't know what version pipeline is using right now.

We're on 2.4.x.

And as usual, don't (ab)use pipeline as a general purpose programming 
environment. It's not intended to be, never was.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/48CE7C33-BEBE-41DB-9C79-C3643459F107%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


Re: Why does somestring.digest('SHA-1') fail in pipeline

2019-05-01 Thread Mykola Nikishov
ZillaYT  writes:

> I have this simple code and it works on my Macs groovy
>
> String sigStr = 'iurpeirupru04790734'
> sigStr = sigStr.digest('SHA-1')
> println sigStr

Try

sigStr = sigStr.decodeBase64()

which is available since Groovy 1.0 [1]

digest() is available since 2.5.0 [2].

[1] 
http://docs.groovy-lang.org/2.4.0/html/api/org/codehaus/groovy/runtime/EncodingGroovyMethods.html
[2] 
http://docs.groovy-lang.org/latest/html/api/org/codehaus/groovy/runtime/EncodingGroovyMethods.html

> But I get this error when I run it in a Jenkins pipeline. Why? Thanks!

Different Groovy version?

> hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No 
> signature of method: java.lang.String.digest() is applicable for argument 
> types: (java.lang.String) values: [SHA-1] Possible solutions: getAt(java.
> lang.String), size(), toSet(), size(), next(), toList()

-- 
Mykola

Libre/Free Java Software Developer
https://manandbytes.gitlab.io/

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/87bm0mh469.fsf%40think.
For more options, visit https://groups.google.com/d/optout.


Re: Why does somestring.digest('SHA-1') fail in pipeline

2019-04-30 Thread Slide
Pipeline is a subset of groovy, so something may not work in pipeline that
work in groovy standalone. It also may depend on what version of groovy
pipeline is using as the digest method was added in groovy 2.5.0 I believe.
I don't know what version pipeline is using right now.

On Tue, Apr 30, 2019, 14:41 ZillaYT  wrote:

> I have this simple code and it works on my Macs groovy
>
> String sigStr = 'iurpeirupru04790734'
> sigStr = sigStr.digest('SHA-1')
> println sigStr
>
> But I get this error when I run it in a Jenkins pipeline. Why? Thanks!
>
> hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No
> signature of method: java.lang.String.digest() is applicable for argument
> types: (java.lang.String) values: [SHA-1] Possible solutions: getAt(java.
> lang.String), size(), toSet(), size(), next(), toList()
>  at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(
> ScriptBytecodeAdapter.java:58)
>  at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(
> PojoMetaClassSite.java:49)
>  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(
> CallSiteArray.java:48)
>  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(
> AbstractCallSite.java:113)
>  at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(
> DefaultInvoker.java:20)
>  at WorkflowScript.run(WorkflowScript:6)
>  at ___cps.transform___(Native Method)
>  at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(
> ContinuationGroup.java:57)
>  at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.
> dispatchOrArg(FunctionCallBlock.java:109)
>  at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.
> fixArg(FunctionCallBlock.java:82)
>  at sun.reflect.GeneratedMethodAccessor372.invoke(Unknown Source)
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498)
>  at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive
> (ContinuationPtr.java:72)
>  at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21
> )
>  at com.cloudbees.groovy.cps.Next.step(Next.java:83)
>  at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
>  at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
>  at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.
> use(GroovyCategorySupport.java:122)
>  at org.codehaus.groovy.runtime.GroovyCategorySupport.use(
> GroovyCategorySupport.java:261)
>  at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
>  at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.
> java:174)
>  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.
> java:332)
>  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(
> CpsThreadGroup.java:83)
>  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(
> CpsThreadGroup.java:244)
>  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(
> CpsThreadGroup.java:232)
>  at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(
> CpsVmExecutorService.java:64)
>  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>  at hudson.remoting.SingleLaneExecutorService$1.run(
> SingleLaneExecutorService.java:131)
>  at jenkins.util.ContextResettingExecutorService$1.run(
> ContextResettingExecutorService.java:28)
>  at jenkins.security.ImpersonatingExecutorService$1.run(
> ImpersonatingExecutorService.java:59)
>  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511
> )
>  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
> java:1149)
>  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
> java:624)
>  at java.lang.Thread.run(Thread.java:748)
> Finished: FAILURE
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/86563179-18e2-4dd7-afeb-5859e1ecb7da%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVf-x6EEtFryc%2BMep%2B%3DFXBFSUyg0YKJoZFXpnrqPYuQ0Tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Why does somestring.digest('SHA-1') fail in pipeline

2019-04-30 Thread ZillaYT
I have this simple code and it works on my Macs groovy

String sigStr = 'iurpeirupru04790734'
sigStr = sigStr.digest('SHA-1')
println sigStr

But I get this error when I run it in a Jenkins pipeline. Why? Thanks!

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No 
signature of method: java.lang.String.digest() is applicable for argument 
types: (java.lang.String) values: [SHA-1] Possible solutions: getAt(java.
lang.String), size(), toSet(), size(), next(), toList()
 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(
ScriptBytecodeAdapter.java:58)
 at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(
PojoMetaClassSite.java:49)
 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(
CallSiteArray.java:48)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(
AbstractCallSite.java:113)
 at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(
DefaultInvoker.java:20)
 at WorkflowScript.run(WorkflowScript:6)
 at ___cps.transform___(Native Method)
 at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(
ContinuationGroup.java:57)
 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.
dispatchOrArg(FunctionCallBlock.java:109)
 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(
FunctionCallBlock.java:82)
 at sun.reflect.GeneratedMethodAccessor372.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(
ContinuationPtr.java:72)
 at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
 at com.cloudbees.groovy.cps.Next.step(Next.java:83)
 at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
 at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
 at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use
(GroovyCategorySupport.java:122)
 at org.codehaus.groovy.runtime.GroovyCategorySupport.use(
GroovyCategorySupport.java:261)
 at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
 at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java
:174)
 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.
java:332)
 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(
CpsThreadGroup.java:83)
 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.
java:244)
 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.
java:232)
 at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(
CpsVmExecutorService.java:64)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at hudson.remoting.SingleLaneExecutorService$1.run(
SingleLaneExecutorService.java:131)
 at jenkins.util.ContextResettingExecutorService$1.run(
ContextResettingExecutorService.java:28)
 at jenkins.security.ImpersonatingExecutorService$1.run(
ImpersonatingExecutorService.java:59)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
java:624)
 at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/86563179-18e2-4dd7-afeb-5859e1ecb7da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.