Re: jobdsl - publish-over-ssh - How can i add ssh servers in global configuration

2018-04-05 Thread Dirk Heinrichs
From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Volker Groß

> Ok, it seems that the following line is the problem:
> 
> publish_ssh.removeHostConfiguration(host[0])
> 
> After commenting it out, the job runs perfectly using "Execute system Groovy 
> script".

You might need to go into Manage Jenkins -> In-process Script Approval and 
approve the method.

HTH...

Dirk
-- 
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 mailto:jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_jenkinsci-2Dusers_8dc8643a-2Dda74-2D45dc-2D8714-2D9baaf47ecb98-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=ZgVRmm3mf2P1-XDAyDsu4A&r=TsKycyisPP_6FVCeETRooIdY_8hdAsXoxwbvHso_TaI&m=uP6G3jxbaKTH_YK03ZaG2TZhQFdiFzO9Cqd4M8-XDqI&s=6TigJFccIzcyDjv24SEJp0zX-TpdaDlPhd6JRVNKmks&e=.
For more options, visit 
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwMFaQ&c=ZgVRmm3mf2P1-XDAyDsu4A&r=TsKycyisPP_6FVCeETRooIdY_8hdAsXoxwbvHso_TaI&m=uP6G3jxbaKTH_YK03ZaG2TZhQFdiFzO9Cqd4M8-XDqI&s=xA1ozapx1IJhMQXfv4ZmzAeJmpcg4Syi5-J-msJ3BB8&e=.

-- 
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/SN6PR15MB24164A9F26B21BC1E5F24BE8AABB0%40SN6PR15MB2416.namprd15.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.


Re: jobdsl - publish-over-ssh - How can i add ssh servers in global configuration

2018-04-05 Thread Volker Groß
Ok, it seems that the following line is the problem:

publish_ssh.removeHostConfiguration(host[0])

After commenting it out, the job runs perfectly using "Execute system 
Groovy script".

Volker


Am Mittwoch, 4. April 2018 13:36:23 UTC+2 schrieb Volker Groß:
>
> Hi,
>
> i'm having a bunch of groovy-scripts, which are at least about 2,5 years 
> old. At the time the scripts where set up, we were able to add 
> publish-over-ssh ssh-servers within the jenkins global configuration tab.
> After one update those scripts won't run again. I'm always getting this 
> error:
>
> Started by user Entwicklung
> [EnvInject] - Loading node environment variables.
> Building in workspace /var/lib/jenkins/workspace/DSL-Global-Credentials
> Processing provided DSL script
> ERROR: startup failed:
> script: 33: unable to resolve class BapSshHostConfiguration 
>  @ line 33, column 23.
>  def configuration = new 
> BapSshHostConfiguration(host[0],host[1],host[2],host[3],host[4],host[5],host[6],host[7],host[8],host[9],host[10])
>  ^
>
> 1 error
>
> Finished: FAILURE
>
> This is my script, i just deleted the host-values ;)
>
> import jenkins.model.*
> import jenkins.plugins.publish_over_ssh.BapSshHostConfiguration
>
> def inst = Jenkins.getInstance()
> def publish_ssh = 
> inst.getDescriptor('jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin')
>
>
> println 
> ""
> println "PublishOverSsh - Creating global list of Server/Paths"
> println 
> ""
>
>
> /* Serverlist
>  The following has to be set.
>   
> name,hostname,username,encryptedPassword,remoteRootDir,port,timeout,overrideKey,keyPath,key,disableExec
> */
> def hosts = [
>
> ['Hostalias','hostname','user','encryptedPassword','remoteRootDir',22,3,false,'','',true]
> ]
>
> println 'Renewing Global Publish-Over-SSH-Server Configs'
>
> hosts.each { host->
>   def configuration = new 
> BapSshHostConfiguration(host[0],host[1],host[2],host[3],host[4],host[5],host[6],host[7],host[8],host[9],host[10])
>   println " - SSH-Host ${host[0]}"
>   publish_ssh.removeHostConfiguration(host[0])
>   publish_ssh.addHostConfiguration(configuration)
> }
>
> I hope one can help.
>
> Best from DE
> Volker
>

-- 
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/8dc8643a-da74-45dc-8714-9baaf47ecb98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: jobdsl - publish-over-ssh - How can i add ssh servers in global configuration

2018-04-05 Thread Volker Groß
Thank you Dirk, for pointing me the right direction, but let me hopefully 
ask a final question:

Is there a way to execute this tiny groovy-script, which runs in the script 
console without errors, within a Jenkins job? 

I tried it with using "Execute system Groovy script, which brings up this 
error:

ERROR: Build step failed with exception
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts 
not permitted to use staticMethod jenkins.model.Jenkins getInstance
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectStaticMethod(StaticWhitelist.java:189)
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:160)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:186)
at 
org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:190)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:97)
at 
org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at Script1.run(Script1.groovy:4)
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:141)
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:333)
at hudson.plugins.groovy.SystemGroovy.run(SystemGroovy.java:95)
at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:59)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1727)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Execute system Groovy script' marked build as failure
Finished: FAILURE


and as "Execute Groovy Script" with the error i posted before. "I can't see 
the wood, as there are too many trees"...

Yours 
Volker

Am Mittwoch, 4. April 2018 13:36:23 UTC+2 schrieb Volker Groß:
>
> Hi,
>
> i'm having a bunch of groovy-scripts, which are at least about 2,5 years 
> old. At the time the scripts where set up, we were able to add 
> publish-over-ssh ssh-servers within the jenkins global configuration tab.
> After one update those scripts won't run again. I'm always getting this 
> error:
>
> Started by user Entwicklung
> [EnvInject] - Loading node environment variables.
> Building in workspace /var/lib/jenkins/workspace/DSL-Global-Credentials
> Processing provided DSL script
> ERROR: startup failed:
> script: 33: unable to resolve class BapSshHostConfiguration 
>  @ line 33, column 23.
>  def configuration = new 
> BapSshHostConfiguration(host[0],host[1],host[2],host[3],host[4],host[5],host[6],host[7],host[8],host[9],host[10])
>  ^
>
> 1 error
>
> Finished: FAILURE
>
> This is my script, i just deleted the host-values ;)
>
> import jenkins.model.*
> import jenkins.plugins.publish_over_ssh.BapSshHostConfiguration
>
> def inst = Jenkins.getInstance()
> def publish_ssh = 
> inst.getDescriptor('jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin')
>
>
> println 
> ""
> println "PublishOverSsh - Creating global list of Server/Paths"
> println 
> ""
>
>
> /* Serverlist
>  The following has to be set.
>   
> name,hostname,username,encryptedPassword,remoteRootDir,port,timeout,overrideKey,keyPath,key,disableExec
> */
> def hosts = [
>
> ['Hostalias','hostname','user','encryptedPassword','remoteRootDir',22,3,false,'','',true]
> ]
>
> println 'Renewing Global Publish-Over-SSH-Server Configs'
>
> hosts.each { host->
>   def configuration = new 
> BapSshHostConfiguration(host[0],host[1],host[2],host[3],host[4],host[5],host[6],host[7],host[8],host[9],host[10])
>   println " - SSH-Host ${host[0]}"
>   publish_ssh.removeHostConfiguration(host[0])
>   publish_ssh.addHostConfiguration(configuration)
> }
>
> I hope one can help.
>
> Best from DE
> Volker
>

-- 
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...@go

Re: jobdsl - publish-over-ssh - How can i add ssh servers in global configuration

2018-04-05 Thread Dirk Heinrichs
From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Volker Groß

> Build step 'Execute Groovy script' marked build as failure

"Groovy Script" != "System Groovy Script".

You can test System Groovy scripts in the Script Console (Manage Jenkins -> 
Script Console). Attention: Don't use System.exit() there since it would tell 
your Jenkins to exit.

Bye...

Dirk
-- 
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 mailto:jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_jenkinsci-2Dusers_c754f25d-2D8fb4-2D49b3-2D983c-2D1cd8748e56e9-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=ZgVRmm3mf2P1-XDAyDsu4A&r=TsKycyisPP_6FVCeETRooIdY_8hdAsXoxwbvHso_TaI&m=qlNVPmHNbBxQ7gS7RMLid6YHTNZU_UtnVqi-sA9pl50&s=-2qwFFMqFB18ZA_uDcZ6AoCy48RVzZcS9_5WFwLSBio&e=.
For more options, visit 
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwMFaQ&c=ZgVRmm3mf2P1-XDAyDsu4A&r=TsKycyisPP_6FVCeETRooIdY_8hdAsXoxwbvHso_TaI&m=qlNVPmHNbBxQ7gS7RMLid6YHTNZU_UtnVqi-sA9pl50&s=uWsksHHAftDhpewEtGGWRRgyKn4HL_e6PSrWfCvUnzc&e=.

-- 
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/SN6PR15MB241658005F7C777BF03D79C5AABB0%40SN6PR15MB2416.namprd15.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.


Re: jobdsl - publish-over-ssh - How can i add ssh servers in global configuration

2018-04-04 Thread Volker Groß
Oh dear...

Thanks. But after changing the job i'm again getting the following error:

Started by user Entwicklung 
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/DSL-Global-Credentials
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url XXX@XXX:deploytools/DSL_buildJobs.git # 
 > timeout=10
Fetching upstream changes from XXX@XXX:deploytools/DSL_buildJobs.git
 > git --version # timeout=10
using GIT_SSH to set credentials jenkins
 > git fetch --tags --progress XXX@XXX:deploytools/DSL_buildJobs.git 
 > +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision b763c301b3b67ee9743718b79b750017b16c1e28 
(refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f b763c301b3b67ee9743718b79b750017b16c1e28
Commit message: "Anpassung -Jabber Notify"
 > git rev-list --no-walk b866121fc8d47761cb2e992dc5abc7731cb47c2b # timeout=10
[DSL-Global-Credentials] $ groovy 
/var/lib/jenkins/workspace/DSL-Global-Credentials/global/publishOverSsh.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/var/lib/jenkins/workspace/DSL-Global-Credentials/global/publishOverSsh.groovy: 
2: unable to resolve class 
jenkins.plugins.publish_over_ssh.BapSshHostConfiguration
 @ line 2, column 1.
   import jenkins.plugins.publish_over_ssh.BapSshHostConfiguration
   ^

1 error

Build step 'Execute Groovy script' marked build as failure
Finished: FAILURE


???


Thanks again for helping me out.

Volker




Am Mittwoch, 4. April 2018 13:36:23 UTC+2 schrieb Volker Groß:
>
> Hi,
>
> i'm having a bunch of groovy-scripts, which are at least about 2,5 years 
> old. At the time the scripts where set up, we were able to add 
> publish-over-ssh ssh-servers within the jenkins global configuration tab.
> After one update those scripts won't run again. I'm always getting this 
> error:
>
> Started by user Entwicklung
> [EnvInject] - Loading node environment variables.
> Building in workspace /var/lib/jenkins/workspace/DSL-Global-Credentials
> Processing provided DSL script
> ERROR: startup failed:
> script: 33: unable to resolve class BapSshHostConfiguration 
>  @ line 33, column 23.
>  def configuration = new 
> BapSshHostConfiguration(host[0],host[1],host[2],host[3],host[4],host[5],host[6],host[7],host[8],host[9],host[10])
>  ^
>
> 1 error
>
> Finished: FAILURE
>
> This is my script, i just deleted the host-values ;)
>
> import jenkins.model.*
> import jenkins.plugins.publish_over_ssh.BapSshHostConfiguration
>
> def inst = Jenkins.getInstance()
> def publish_ssh = 
> inst.getDescriptor('jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin')
>
>
> println 
> ""
> println "PublishOverSsh - Creating global list of Server/Paths"
> println 
> ""
>
>
> /* Serverlist
>  The following has to be set.
>   
> name,hostname,username,encryptedPassword,remoteRootDir,port,timeout,overrideKey,keyPath,key,disableExec
> */
> def hosts = [
>
> ['Hostalias','hostname','user','encryptedPassword','remoteRootDir',22,3,false,'','',true]
> ]
>
> println 'Renewing Global Publish-Over-SSH-Server Configs'
>
> hosts.each { host->
>   def configuration = new 
> BapSshHostConfiguration(host[0],host[1],host[2],host[3],host[4],host[5],host[6],host[7],host[8],host[9],host[10])
>   println " - SSH-Host ${host[0]}"
>   publish_ssh.removeHostConfiguration(host[0])
>   publish_ssh.addHostConfiguration(configuration)
> }
>
> I hope one can help.
>
> Best from DE
> Volker
>

-- 
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/c754f25d-8fb4-49b3-983c-1cd8748e56e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: jobdsl - publish-over-ssh - How can i add ssh servers in global configuration

2018-04-04 Thread Dirk Heinrichs
From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Volker Groß

> Processing provided DSL script

If I look at your script, it doesn't look like a Job-DSL script to me, but like 
a normal System-Groovy script.

HTH...

Dirk
-- 
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 mailto:jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_jenkinsci-2Dusers_ee560369-2Da31a-2D43f2-2Db517-2D6205aae11494-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=ZgVRmm3mf2P1-XDAyDsu4A&r=TsKycyisPP_6FVCeETRooIdY_8hdAsXoxwbvHso_TaI&m=gznpB5IAC2_ewqLBr19_HEk8l0KBoo2eoCrSPngNlsQ&s=v-t6Q6KnFJ_B99NvTfO8bBY6wzoEJ0eYv5yJy3d4S7w&e=.
For more options, visit 
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwMFaQ&c=ZgVRmm3mf2P1-XDAyDsu4A&r=TsKycyisPP_6FVCeETRooIdY_8hdAsXoxwbvHso_TaI&m=gznpB5IAC2_ewqLBr19_HEk8l0KBoo2eoCrSPngNlsQ&s=fZdlGyqWiqxyoGCJ63U_PryXl_mzeY7HTV8mG5QdHc4&e=.

-- 
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/BYAPR15MB24053C1489E21EB47DBBD9EBAAA40%40BYAPR15MB2405.namprd15.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.