[JIRA] (JENKINS-31201) Job DSL support for ScriptApproval (was: Groovy postbuild ignores RUN_SCRIPTS permission)

2017-03-16 Thread jgl...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Jesse Glick commented on  JENKINS-31201  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Job DSL support for ScriptApproval (was: Groovy postbuild ignores RUN_SCRIPTS permission)   
 

  
 
 
 
 

 
 

Without some solution to this problem
 Best to switch to using the Groovy sandbox, which bypasses all these issues.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-31201) Job DSL support for ScriptApproval (was: Groovy postbuild ignores RUN_SCRIPTS permission)

2017-01-27 Thread nels4...@me.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Jeffrey Nelson commented on  JENKINS-31201  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Job DSL support for ScriptApproval (was: Groovy postbuild ignores RUN_SCRIPTS permission)   
 

  
 
 
 
 

 
 Figured out a workaround. 1. Write a scriptler script that approves pending scripts with a given identifier (we used something simple like '// SCRIPTLER AUTO APPROVE'). Thanks to Sam Gleske for pointing me to the code to approve a script. – Select 'Permission' option (Allow execution by user with RunScripts permission) – Select 'Restriction' option (Script is always executed on Master) – Script parameter: "approvalPrefix" – Script: 

 
import jenkins.model.Jenkins

def scriptApproval = Jenkins.instance.getExtensionList('org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval')[0]
def hashesToApprove = scriptApproval.pendingScripts.findAll{ it.script.startsWith(approvalPrefix) }.collect{ it.getHash() }
hashesToApprove.each { 
  scriptApproval.approveScript(it)
} 

 2. use the configure UI to add another step to your DSL seed job to run this scriptler script created in step 1 3. add '// SCRIPTLER AUTO APPROVE' at the top of any groovy script you want approved If your DSL seed job is itself configured by DSL, complete steps 4-5 4. look at the config.xml generated by manually adding this step to your DSL seed job. You need to grab the value in the 'builderId' field 5. add the additional step to your DSL seed job to run this scriptler script created above in step 1. – dsl for adding the step:  

 
  def approvePrefixParam = {
name 'approvalPrefix'
value '// SCRIPTLER AUTO APPROVE'
  }
  
  configure { project ->
project / builders << 'org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder' {
  builderId()
  scriptId('approveGroovyScripts.groovy')
  propagateParams(false)
  parameters {
'org.jenkinsci.plugins.scriptler.config.Parameter' approvePrefixParam
  }
}
  } 

  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 

[JIRA] (JENKINS-31201) Job DSL support for ScriptApproval (was: Groovy postbuild ignores RUN_SCRIPTS permission)

2017-01-26 Thread nels4...@me.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Jeffrey Nelson commented on  JENKINS-31201  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Job DSL support for ScriptApproval (was: Groovy postbuild ignores RUN_SCRIPTS permission)   
 

  
 
 
 
 

 
 Any ideas when a solution for this issue could be worked on?  My project is now building many pipelines where the starting job uses the Active Choices Param plugin with complex groovy scripts. Without some solution to this problem, we are stuck manually approving all (60+) scripts that are all near identical.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.