Add sandbox option to dsl builder

Job DSL plugin supports execution of its groovy DSL code
via sandbox, but until now there was missing option to control it.

Change-Id: I8dccfc608cf59ac46ded712dc937983a22b9d3b3
This commit is contained in:
Pavel Sedlák 2022-10-21 00:16:59 +02:00
parent a191e0b174
commit c12f334ac7
5 changed files with 7 additions and 0 deletions

View File

@ -2976,6 +2976,7 @@ def dsl(registry, xml_parent, data):
:arg str additional-classpath: Newline separated list of additional
classpath entries for the Job DSL scripts. All entries must be
relative to the workspace root, e.g. build/classes/main. (optional)
:arg bool sandbox: Execute script inside of groovy sandbox (default false)
Example:
@ -3012,6 +3013,8 @@ def dsl(registry, xml_parent, data):
else:
raise MissingAttributeError(["script-text", "target"])
XML.SubElement(dsl, "sandbox").text = str(data.get("sandbox", "false")).lower()
XML.SubElement(dsl, "ignoreExisting").text = str(
data.get("ignore-existing", False)
).lower()

View File

@ -4,6 +4,7 @@
<javaposse.jobdsl.plugin.ExecuteDslScripts>
<targets>jobs/*/*/*.groovy</targets>
<usingScriptText>false</usingScriptText>
<sandbox>false</sandbox>
<ignoreExisting>true</ignoreExisting>
<removedJobAction>IGNORE</removedJobAction>
<removedViewAction>IGNORE</removedViewAction>

View File

@ -4,6 +4,7 @@
<javaposse.jobdsl.plugin.ExecuteDslScripts>
<scriptText>job { name 'dsljob' }</scriptText>
<usingScriptText>true</usingScriptText>
<sandbox>true</sandbox>
<ignoreExisting>true</ignoreExisting>
<removedJobAction>DISABLE</removedJobAction>
<removedViewAction>DELETE</removedViewAction>

View File

@ -6,3 +6,4 @@ builders:
removed-view-action: "DELETE"
lookup-strategy: "SEED_JOB"
additional-classpath: "*.jar"
sandbox: "true"

View File

@ -4,6 +4,7 @@
<javaposse.jobdsl.plugin.ExecuteDslScripts>
<targets>jobs/**/*.groovy</targets>
<usingScriptText>false</usingScriptText>
<sandbox>false</sandbox>
<ignoreExisting>true</ignoreExisting>
<removedJobAction>DISABLE</removedJobAction>
<removedViewAction>DELETE</removedViewAction>