diff --git a/pipeline-model-declarative-agent/pom.xml b/pipeline-model-declarative-agent/pom.xml
index c0046bfe8..4fa602c62 100644
--- a/pipeline-model-declarative-agent/pom.xml
+++ b/pipeline-model-declarative-agent/pom.xml
@@ -42,7 +42,7 @@
org.jenkins-ci.plugins.workflow
workflow-cps
- 2.18
+ 2.21
diff --git a/pipeline-model-declarative-agent/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/DeclarativeAgent.java b/pipeline-model-declarative-agent/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/DeclarativeAgent.java
index 415eedbe0..508945cca 100644
--- a/pipeline-model-declarative-agent/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/DeclarativeAgent.java
+++ b/pipeline-model-declarative-agent/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/DeclarativeAgent.java
@@ -26,7 +26,6 @@
import hudson.ExtensionPoint;
import hudson.model.AbstractDescribableImpl;
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted;
import org.jenkinsci.plugins.workflow.cps.CpsScript;
import org.jenkinsci.plugins.workflow.cps.CpsThread;
@@ -47,13 +46,13 @@ public abstract class DeclarativeAgent extends AbstractDescribableImpl {
/**
- * The name for this agent type. Should match the {@code Symbol} on the class.
+ * The name for this agent type. Defaults to the first string in the {@code Symbol} on the class.
*
* @return The name.
*/
@@ -57,7 +60,8 @@ public abstract class DeclarativeAgentDescriptor extends Descriptor all() {
return ExtensionList.lookup(DeclarativeAgentDescriptor.class);
}
@@ -129,8 +138,7 @@ public static Map zeroArgModels() {
* @param name The name for the descriptor to look up
* @return The corresponding descriptor or null if not found.
*/
- @Whitelisted
- public static @CheckForNull DeclarativeAgentDescriptor byName(@Nonnull String name) {
+ public static @Nullable DeclarativeAgentDescriptor byName(@Nonnull String name) {
return (DeclarativeAgentDescriptor) SymbolLookup.get().findDescriptor(DeclarativeAgent.class, name);
}
@@ -142,9 +150,8 @@ public static Map zeroArgModels() {
* @return The instantiated {@link DeclarativeAgent} instance, or null if the name isn't found.
* @throws Exception
*/
- @Whitelisted
- public static @CheckForNull DeclarativeAgent instanceForName(@Nonnull String name,
- Map arguments) throws Exception {
+ public static @Nullable DeclarativeAgent instanceForName(@Nonnull String name,
+ Map arguments) throws Exception {
DeclarativeAgentDescriptor descriptor = byName(name);
if (descriptor != null) {
@@ -162,7 +169,6 @@ public static Map zeroArgModels() {
* @return The instantiated {@link DeclarativeAgent} instance.
* @throws Exception
*/
- @Whitelisted
public static @Nonnull DeclarativeAgent instanceForDescriptor(@Nonnull DeclarativeAgentDescriptor descriptor,
Map arguments) throws Exception {
if (zeroArgModels().keySet().contains(descriptor.getName())) {
diff --git a/pipeline-model-definition/pom.xml b/pipeline-model-definition/pom.xml
index 64c788c44..afe224f68 100644
--- a/pipeline-model-definition/pom.xml
+++ b/pipeline-model-definition/pom.xml
@@ -64,17 +64,17 @@
org.jenkins-ci.plugins.workflow
workflow-cps
- 2.18
+ 2.21
org.jenkins-ci.plugins.workflow
workflow-job
- 2.6
+ 2.8
org.jenkins-ci.plugins.workflow
workflow-multibranch
- 2.8
+ 2.9
org.jenkins-ci.plugins.workflow
@@ -84,12 +84,12 @@
org.jenkins-ci.plugins.workflow
workflow-basic-steps
- 2.1
+ 2.2
org.jenkins-ci.plugins.workflow
workflow-durable-task-step
- 2.4
+ 2.5
org.jenkins-ci.plugins
@@ -99,18 +99,13 @@
org.jenkins-ci.plugins
docker-workflow
- 1.8
+ 1.9
org.jenkins-ci.plugins
structs
1.5
-
- org.jenkins-ci.plugins
- script-security
- 1.22
-
@@ -148,7 +143,7 @@
org.jenkins-ci.plugins.workflow
workflow-cps-global-lib
- 2.3
+ 2.4
test
@@ -176,7 +171,7 @@
org.jenkins-ci.plugins.workflow
workflow-support
- 2.2
+ 2.10
tests
test
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
index 046a674d1..f5f0bba46 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
@@ -31,15 +31,13 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import hudson.ExtensionList
import hudson.model.Describable
import hudson.model.Descriptor
-import hudson.triggers.TriggerDescriptor
+import org.apache.commons.codec.digest.DigestUtils
import org.jenkinsci.plugins.pipeline.modeldefinition.actions.ExecutionModelAction
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages
import org.jenkinsci.plugins.pipeline.modeldefinition.model.MethodsToList
import org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
import org.jenkinsci.plugins.structs.SymbolLookup
-import org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable
import org.jenkinsci.plugins.workflow.cps.CpsScript
import org.jenkinsci.plugins.workflow.job.WorkflowRun
@@ -66,7 +64,6 @@ public class Utils {
* we'll get the actual name from actualFieldName(...)
* @return True if the field exists and is of the given type.
*/
- @Whitelisted
public static boolean isFieldA(Class fieldType, Class actualClass, String fieldName) {
def actualFieldName = actualFieldName(actualClass, fieldName)
def realFieldType = actualClass.metaClass.getMetaProperty(actualFieldName)?.type
@@ -85,7 +82,6 @@ public class Utils {
* @param fieldName The original field name, which could need to be pluralized.
* @return The real field name, pluralized if necessary, or null if not found.
*/
- @Whitelisted
public static String actualFieldName(Class actualClass, String fieldName) {
if (actualClass.metaClass.getMetaProperty(fieldName) != null) {
return fieldName
@@ -103,7 +99,6 @@ public class Utils {
* @param fieldName The field name we're looking for, which could get pluralized.
* @return The class of the field in the inspected class, or the class contained in the list or map.
*/
- @Whitelisted
public static Class actualFieldType(Class actualClass, String fieldName) {
def actualFieldName = actualFieldName(actualClass, fieldName)
if (actualFieldName == null) {
@@ -131,7 +126,6 @@ public class Utils {
* @param c A class.
* @return The parameterized type argument for the class, if it's a {@link MethodsToList} class. Null otherwise.
*/
- @Whitelisted
public static Class getMethodsToListType(Class c) {
Class retClass
c.genericInterfaces.each { Type t ->
@@ -152,7 +146,6 @@ public class Utils {
* @param o The object to check
* @return True if the object is an instance of the class, false otherwise
*/
- @Whitelisted
public static boolean instanceOfWrapper(Class c, Object o) {
return c.isInstance(o)
}
@@ -164,17 +157,10 @@ public class Utils {
* @param o The class to check
* @return True if o can be assigned to c, false otherwise
*/
- @Whitelisted
public static boolean assignableFromWrapper(Class c, Class o) {
return c.isAssignableFrom(o)
}
- @Whitelisted
- public static Object[] toObjectArray(List origList) {
- return origList.toArray()
- }
-
- @Whitelisted
public static boolean hasScmContext(CpsScript script) {
try {
// Just rely on SCMVar's own context-checking (via CpsScript) rather than brewing our own.
@@ -186,7 +172,6 @@ public class Utils {
}
}
- @Whitelisted
static void attachExecutionModel(CpsScript script) {
WorkflowRun r = script.$build()
ModelASTPipelineDef model = Converter.parseFromCpsScript(script)
@@ -198,6 +183,10 @@ public class Utils {
r.addAction(new ExecutionModelAction(stages))
}
+ public static String stringToSHA1(String s) {
+ return DigestUtils.sha1Hex(s)
+ }
+
/**
* Creates and sets the loading for a cache of {@link Describable}s descending from the given descriptor type.
*
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/AbstractBuildConditionResponder.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/AbstractBuildConditionResponder.groovy
index 166cffab0..6c2e363ac 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/AbstractBuildConditionResponder.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/AbstractBuildConditionResponder.groovy
@@ -25,7 +25,6 @@ package org.jenkinsci.plugins.pipeline.modeldefinition.model
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
import org.jenkinsci.plugins.workflow.job.WorkflowRun
import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
@@ -41,7 +40,6 @@ public abstract class AbstractBuildConditionResponder inMap) {
inMap.each { conditionName, conditionClosure ->
@@ -54,8 +52,6 @@ public abstract class AbstractBuildConditionResponder satisfiedConditions(Object runWrapperObj) {
RunWrapper runWrapper = (RunWrapper)runWrapperObj
WorkflowRun run = (WorkflowRun)runWrapper.getRawBuild()
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy
index 418d7f24c..38304edfb 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy
@@ -29,7 +29,6 @@ import groovy.transform.ToString
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgent
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentDescriptor
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.None
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
/**
@@ -42,10 +41,8 @@ import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
@EqualsAndHashCode
@SuppressFBWarnings(value="SE_NO_SERIALVERSIONID")
public class Agent implements Serializable {
- @Whitelisted
Map arguments = [:]
- @Whitelisted
public Agent(Map args) {
this.arguments.putAll(args)
}
@@ -53,7 +50,6 @@ public class Agent implements Serializable {
/**
* Special constructor for the no-additional-arguments agent types, i.e., none and any
*/
- @Whitelisted
public Agent(String s) {
this.arguments.put(s, "true")
}
@@ -63,7 +59,6 @@ public class Agent implements Serializable {
*
* @return The instantiated declarative agent or null if not found.
*/
- @Whitelisted
public DeclarativeAgent getDeclarativeAgent() {
DeclarativeAgentDescriptor foundDescriptor = DeclarativeAgentDescriptor.all().find { d ->
arguments.containsKey(d.getName())
@@ -76,7 +71,6 @@ public class Agent implements Serializable {
}
}
- @Whitelisted
public boolean hasAgent() {
DeclarativeAgent a = getDeclarativeAgent()
return a != null && !None.class.isInstance(a)
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/JobProperties.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/JobProperties.groovy
index 1367ec041..5e3c02194 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/JobProperties.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/JobProperties.groovy
@@ -32,9 +32,6 @@ import groovy.transform.ToString
import hudson.model.JobProperty
import hudson.model.JobPropertyDescriptor
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
-import org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable
-import org.jenkinsci.plugins.workflow.cps.CpsScript
import javax.annotation.Nonnull
@@ -72,7 +69,6 @@ public class JobProperties implements Serializable, MethodsToList {
*
* @return A map of valid property type keys to their actual type IDs.
*/
- @Whitelisted
public static Map getAllowedPropertyTypes() {
return propertyTypeCache.get(CACHE_KEY)
}
@@ -83,7 +79,6 @@ public class JobProperties implements Serializable, MethodsToList {
* @param key The key to look up.
* @return The type ID for that key, if it's in the property types cache.
*/
- @Whitelisted
public static String typeForKey(@Nonnull String key) {
return getAllowedPropertyTypes().get(key)
}
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/MappedClosure.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/MappedClosure.groovy
index 51e6f6127..a89beb4a9 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/MappedClosure.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/MappedClosure.groovy
@@ -26,7 +26,6 @@ package org.jenkinsci.plugins.pipeline.modeldefinition.model
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
/**
@@ -45,11 +44,9 @@ public abstract class MappedClosure>
@Delegate Map resultMap = [:]
- @Whitelisted
public MappedClosure() {
}
- @Whitelisted
public MappedClosure(Map inMap) {
this.modelFromMap(inMap)
}
@@ -76,12 +73,10 @@ public abstract class MappedClosure>
}
@Override
- @Whitelisted
public void modelFromMap(Map inMap) {
this.resultMap.putAll(inMap)
}
- @Whitelisted
public Map getMap() {
def mapCopy = [:]
mapCopy.putAll(resultMap)
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/NestedModel.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/NestedModel.groovy
index a9adbd9fb..685169a3a 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/NestedModel.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/NestedModel.groovy
@@ -23,8 +23,6 @@
*/
package org.jenkinsci.plugins.pipeline.modeldefinition.model
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
-
/**
* Marker for model classes which themselves may contain other model classes.
*
@@ -36,6 +34,5 @@ interface NestedModel {
*
* @param m The input map.
*/
- @Whitelisted
public void modelFromMap(Map m)
}
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Parameters.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Parameters.groovy
index bce3becfc..b39e497e7 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Parameters.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Parameters.groovy
@@ -31,7 +31,6 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import hudson.model.ParameterDefinition
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
import javax.annotation.Nonnull
@@ -61,7 +60,6 @@ public class Parameters implements Serializable, MethodsToList getAllowedParameterTypes() {
return parameterTypeCache.get(CACHE_KEY)
}
@@ -72,7 +70,6 @@ public class Parameters implements Serializable, MethodsToList args) {
this.agent = new Agent(args)
return this
}
- @Whitelisted
Root agent(String s) {
this.agent = new Agent(s)
return this
}
- @Whitelisted
Root environment(Environment m) {
this.environment = m
return this
}
- @Whitelisted
Root tools(Tools t) {
this.tools = t
return this
}
- @Whitelisted
Root jobProperties(JobProperties p) {
this.jobProperties = p
return this
}
- @Whitelisted
Root triggers(Triggers t) {
this.triggers = t
return this
}
- @Whitelisted
Root parameters(Parameters p) {
this.parameters = p
return this
}
- @Whitelisted
Root wrappers(Wrappers w) {
this.wrappers = w
return this
@@ -141,7 +119,6 @@ public class Root implements NestedModel, Serializable {
*
* @return a list of "key=value" strings.
*/
- @Whitelisted
List getEnvVars() {
return environment.collect { k, v ->
"${k}=${v}"
@@ -154,7 +131,6 @@ public class Root implements NestedModel, Serializable {
* @param runWrapperObj The {@link RunWrapper} for the build.
* @return a list of closures whose conditions have been satisfied.
*/
- @Whitelisted
List satisfiedNotifications(Object runWrapperObj) {
return satisfiedConditionsForField(notifications, runWrapperObj)
}
@@ -165,13 +141,11 @@ public class Root implements NestedModel, Serializable {
* @param runWrapperObj The {@link RunWrapper} for the build.
* @return a list of closures whose conditions have been satisfied.
*/
- @Whitelisted
List satisfiedPostBuilds(Object runWrapperObj) {
return satisfiedConditionsForField(postBuild, runWrapperObj)
}
@Override
- @Whitelisted
public void modelFromMap(Map m) {
m.each { k, v ->
this."${k}"(v)
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy
index 571c4b2a0..4bc2fbac7 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy
@@ -26,7 +26,6 @@ package org.jenkinsci.plugins.pipeline.modeldefinition.model
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
/**
* An individual stage to be executed within the build.
@@ -38,38 +37,30 @@ import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
@SuppressFBWarnings(value="SE_NO_SERIALVERSIONID")
public class Stage implements NestedModel, Serializable {
- @Whitelisted
String name
- @Whitelisted
StepsBlock steps
- @Whitelisted
Agent agent
- @Whitelisted
PostStage post
- @Whitelisted
StepsBlock when
Tools tools
Environment environment
- @Whitelisted
Stage name(String n) {
this.name = n
return this
}
- @Whitelisted
Stage agent(Agent a) {
this.agent = a
return this
}
- @Whitelisted
Stage agent(Map args) {
this.agent = new Agent(args)
return this
@@ -80,19 +71,16 @@ public class Stage implements NestedModel, Serializable {
return this
}
- @Whitelisted
Stage steps(StepsBlock s) {
this.steps = s
return this
}
- @Whitelisted
Stage post(PostStage post) {
this.post = post
return this
}
- @Whitelisted
Stage when(StepsBlock when) {
this.when = when
return this
@@ -122,7 +110,6 @@ public class Stage implements NestedModel, Serializable {
@Override
- @Whitelisted
public void modelFromMap(Map m) {
m.each { k, v ->
this."${k}"(v)
@@ -135,7 +122,6 @@ public class Stage implements NestedModel, Serializable {
* @param runWrapperObj The {@link org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper} for the build.
* @return a list of closures whose conditions have been satisfied.
*/
- @Whitelisted
List satisfiedPostStageConditions(Root root, Object runWrapperObj) {
return root.satisfiedConditionsForField(post, runWrapperObj)
}
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stages.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stages.groovy
index 0b4b64593..866a4affd 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stages.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stages.groovy
@@ -26,7 +26,6 @@ package org.jenkinsci.plugins.pipeline.modeldefinition.model
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
/**
@@ -38,22 +37,18 @@ import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
@EqualsAndHashCode
@SuppressFBWarnings(value="SE_NO_SERIALVERSIONID")
public class Stages implements NestedModel, Serializable {
- @Whitelisted
List stages = []
- @Whitelisted
Stages stages(List s) {
this.stages = s
return this
}
- @Whitelisted
List getStages() {
return stages
}
@Override
- @Whitelisted
public void modelFromMap(Map m) {
m.each { k, v ->
this."${k}"(v)
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/StepsBlock.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/StepsBlock.groovy
index d9bf5c92c..a16f52e9f 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/StepsBlock.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/StepsBlock.groovy
@@ -26,7 +26,6 @@ package org.jenkinsci.plugins.pipeline.modeldefinition.model
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
/**
@@ -38,19 +37,16 @@ import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
@EqualsAndHashCode
@SuppressFBWarnings(value="SE_NO_SERIALVERSIONID")
public class StepsBlock implements Serializable {
- @Whitelisted
Closure closure
/**
* Empty constructor to get around some weirdness...
*/
- @Whitelisted
public StepsBlock() {
}
// Jumping through weird hoops to get around the ejection for cases of JENKINS-26481.
- @Whitelisted
public void setClosure(Object c) {
this.closure = (Closure) c
}
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Tools.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Tools.groovy
index 516f673c3..68354e96e 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Tools.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Tools.groovy
@@ -28,7 +28,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import hudson.tools.ToolDescriptor
import org.jenkinsci.Symbol
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
import javax.annotation.Nonnull
@@ -51,7 +50,6 @@ public class Tools extends MappedClosure implements Serializable {
*
* @return A list of type/name tuples
*/
- @Whitelisted
public List> getToolEntries() {
return getMap().collect { k, v ->
return [k, v]
@@ -64,7 +62,6 @@ public class Tools extends MappedClosure implements Serializable {
*
* @return A map of valid tool type keys to their actual type IDs.
*/
- @Whitelisted
public static Map getAllowedToolTypes() {
return toolTypeCache.get(CACHE_KEY)
}
@@ -75,7 +72,6 @@ public class Tools extends MappedClosure implements Serializable {
* @param key The key to look up.
* @return The type ID for that key, if it's in the tool types cache.
*/
- @Whitelisted
public static String typeForKey(@Nonnull String key) {
return getAllowedToolTypes().get(key)
}
diff --git a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Triggers.groovy b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Triggers.groovy
index bd0ff9bf0..4715078e7 100644
--- a/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Triggers.groovy
+++ b/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Triggers.groovy
@@ -32,7 +32,6 @@ import groovy.transform.ToString
import hudson.triggers.Trigger
import hudson.triggers.TriggerDescriptor
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted
import javax.annotation.Nonnull
@@ -69,7 +68,6 @@ public class Triggers implements Serializable, MethodsToList {
*
* @return A map of valid parameter type keys to their actual type IDs.
*/
- @Whitelisted
public static Map getAllowedTriggerTypes() {
return triggerTypeCache.get(CACHE_KEY)
}
@@ -80,7 +78,6 @@ public class Triggers implements Serializable, MethodsToList {
* @param key The key to look up.
* @return The type ID for that key, if it's in the parameter types cache.
*/
- @Whitelisted
public static String typeForKey(@Nonnull String key) {
return getAllowedTriggerTypes().get(key)
}
diff --git a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ModelStepLoader.java b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ModelStepLoader.java
index 56804eb9b..5c3a42372 100644
--- a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ModelStepLoader.java
+++ b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ModelStepLoader.java
@@ -24,14 +24,11 @@
package org.jenkinsci.plugins.pipeline.modeldefinition;
import hudson.Extension;
-import org.jenkinsci.plugins.pipeline.modeldefinition.model.MethodMissingWrapperWhitelist;
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.ProxyWhitelist;
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist;
import org.jenkinsci.plugins.workflow.cps.CpsScript;
+import org.jenkinsci.plugins.workflow.cps.CpsThread;
import org.jenkinsci.plugins.workflow.cps.GlobalVariable;
import javax.annotation.Nonnull;
-import java.io.IOException;
/**
* Loads the main "pipeline" step as well as the additional CPS-transformed code it depends on.
@@ -51,6 +48,10 @@ public String getName() {
@Override
@Nonnull
public Object getValue(@Nonnull CpsScript script) throws Exception {
+ CpsThread c = CpsThread.current();
+ if (c == null)
+ throw new IllegalStateException("Expected to be called from CpsThread");
+
// Make sure we've already loaded ClosureModelTranslator or load it now.
script.getClass().getClassLoader().loadClass("org.jenkinsci.plugins.pipeline.modeldefinition.ClosureModelTranslator");
script.getClass().getClassLoader().loadClass("org.jenkinsci.plugins.pipeline.modeldefinition.PropertiesToMapTranslator");
@@ -63,20 +64,4 @@ public Object getValue(@Nonnull CpsScript script) throws Exception {
.newInstance(script);
}
- // TODO: Remember to prune out debugging stuff from the whitelist in place of a better debugging setup.
- @Extension
- public static class ModelDefinitionWhitelist extends ProxyWhitelist {
- public ModelDefinitionWhitelist() throws IOException {
- super(new MethodMissingWrapperWhitelist(), new StaticWhitelist(
- "method java.util.Map containsKey java.lang.Object",
- "method java.util.Collection isEmpty",
- "method java.util.Map putAll java.util.Map",
- "method java.util.Collection addAll java.util.Collection",
-
- // Used for debugging - can probably be removed eventually
- "staticField java.lang.System err",
- "method java.io.PrintStream println java.lang.String"
- ));
- }
- }
}
\ No newline at end of file
diff --git a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipeline.java b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipeline.java
index 155a8bb57..3e506fcd3 100644
--- a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipeline.java
+++ b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipeline.java
@@ -28,7 +28,6 @@
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgent;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentDescriptor;
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
@@ -45,7 +44,6 @@ public DockerPipeline(@Nonnull String docker) {
this.docker = docker;
}
- @Whitelisted
public @Nullable String getLabel() {
return label;
}
@@ -55,7 +53,6 @@ public void setLabel(String label) {
this.label = label;
}
- @Whitelisted
public @Nullable String getDockerArgs() {
return dockerArgs;
}
@@ -65,7 +62,6 @@ public void setDockerArgs(String dockerArgs) {
this.dockerArgs = dockerArgs;
}
- @Whitelisted
public @Nonnull String getDocker() {
return docker;
}
diff --git a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java
new file mode 100644
index 000000000..8638c385e
--- /dev/null
+++ b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java
@@ -0,0 +1,80 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2016, CloudBees, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl;
+
+import hudson.Extension;
+import org.jenkinsci.Symbol;
+import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgent;
+import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentDescriptor;
+import org.kohsuke.stapler.DataBoundConstructor;
+import org.kohsuke.stapler.DataBoundSetter;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+public class DockerPipelineFromDockerfile extends DeclarativeAgent {
+ private String label;
+ private Object dockerfile;
+ private String dockerArgs = "";
+
+ @DataBoundConstructor
+ public DockerPipelineFromDockerfile(@Nonnull Object dockerfile) {
+ this.dockerfile = dockerfile;
+ }
+
+ public @CheckForNull String getLabel() {
+ return label;
+ }
+
+ @DataBoundSetter
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public @CheckForNull String getDockerArgs() {
+ return dockerArgs;
+ }
+
+ @DataBoundSetter
+ public void setDockerArgs(String dockerArgs) {
+ this.dockerArgs = dockerArgs;
+ }
+
+ public @Nonnull Object getDockerfile() {
+ return dockerfile;
+ }
+
+ public String getDockerfileAsString() {
+ if (dockerfile instanceof String) {
+ return (String)dockerfile;
+ } else {
+ return "Dockerfile";
+ }
+ }
+
+ @Extension(ordinal = 999) @Symbol("dockerfile")
+ public static class DescriptorImpl extends DeclarativeAgentDescriptor {
+ }
+}
diff --git a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/Label.java b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/Label.java
index 7f239bd8e..d604ce80e 100644
--- a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/Label.java
+++ b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/Label.java
@@ -28,10 +28,8 @@
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgent;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentDescriptor;
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted;
import org.kohsuke.stapler.DataBoundConstructor;
-import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class Label extends DeclarativeAgent {
@@ -43,7 +41,6 @@ public Label(String label) {
this.label = label;
}
- @Whitelisted
public @Nullable String getLabel() {
return label;
}
diff --git a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/model/BuildCondition.java b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/model/BuildCondition.java
index 60994b5e9..568199eed 100644
--- a/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/model/BuildCondition.java
+++ b/pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/model/BuildCondition.java
@@ -26,14 +26,12 @@
import hudson.ExtensionComponent;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted;
import org.jenkinsci.plugins.structs.SymbolLookup;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -45,11 +43,13 @@
* @author Andrew Bayer
*/
public abstract class BuildCondition implements Serializable, ExtensionPoint {
- @Whitelisted
+
public abstract boolean meetsCondition(WorkflowRun r);
/**
* All the registered {@link BuildCondition}s.
+ *
+ * @return A list of all registered {@link BuildCondition}s.
*/
public static ExtensionList all() {
return ExtensionList.lookup(BuildCondition.class);
diff --git a/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy b/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
new file mode 100644
index 000000000..6408a9e5e
--- /dev/null
+++ b/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
@@ -0,0 +1,60 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2016, CloudBees, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+
+package org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl
+
+import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
+import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgent
+import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentScript
+import org.jenkinsci.plugins.workflow.cps.CpsScript
+
+public class DockerPipelineFromDockerfileScript extends DeclarativeAgentScript {
+
+ public DockerPipelineFromDockerfileScript(CpsScript s, DeclarativeAgent a) {
+ super(s, a)
+ }
+
+ @Override
+ public Closure run(Closure body) {
+ String targetLabel = declarativeAgent.label
+ if (targetLabel == null) {
+ targetLabel = script.dockerLabel()?.trim()
+ }
+ LabelScript labelScript = (LabelScript) Label.DescriptorImpl.instanceForName("label", [label: targetLabel]).getScript(script)
+ return labelScript.run {
+ script.checkout script.scm
+ try {
+ def hash = Utils.stringToSHA1(script.readFile(declarativeAgent.getDockerfileAsString()))
+ def imgName = "${hash}"
+ def img = script.getProperty("docker").build(imgName, "-f ${declarativeAgent.getDockerfileAsString()} .")
+ img.inside(declarativeAgent.dockerArgs, {
+ body.call()
+ })
+ } catch (FileNotFoundException f) {
+ script.error("No Dockerfile found at root of repository - failing.")
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
index 0c8a3f841..3758a019c 100644
--- a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
+++ b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
@@ -158,8 +158,9 @@ public static Iterable configsWithErrors() {
result.add(new Object[]{"perStageConfigMissingSteps", "At /pipeline/stages/0/branches/0: Missing one or more required properties: 'steps'"});
result.add(new Object[]{"perStageConfigUnknownSection", "At /pipeline/stages/0: additional properties are not allowed"});
+ result.add(new Object[]{"unknownAgentType", "No agent type specified. Must contain one of [otherField, docker, dockerfile, label, any, none]"});
result.add(new Object[]{"invalidWrapperType", "Invalid wrapper type 'echo'. Valid wrapper types: [retry, script, timeout, withEnv]"});
- result.add(new Object[]{"unknownAgentType", "No agent type specified. Must contain one of [otherField, docker, label, any, none]"});
+
result.add(new Object[]{"unknownBareAgentType", "Invalid argument for agent - 'foo' - must be map of config options or bare [any, none]."});
result.add(new Object[]{"agentMissingRequiredParam", "Missing required parameter for agent type 'otherField': label"});
result.add(new Object[]{"agentUnknownParamForType", "Invalid config option 'fruit' for agent type 'otherField'. Valid config options are [label, otherField]"});
diff --git a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
index 9f17e4170..184658b41 100644
--- a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
+++ b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
@@ -139,13 +139,50 @@ public void agentTypeOrdering() throws Exception {
@Test
public void agentAnyInStage() throws Exception {
prepRepoWithJenkinsfile("agentAnyInStage");
-
WorkflowRun b = getAndStartBuild();
j.assertBuildStatusSuccess(j.waitForCompletion(b));
j.assertLogContains("[Pipeline] { (foo)", b);
j.assertLogContains("THIS WORKS", b);
}
+ @Test
+ public void fromDockerfile() throws Exception {
+ assumeDocker();
+ // Bind mounting /var on OS X doesn't work at the moment
+ onAllowedOS(PossibleOS.LINUX);
+
+ prepRepoWithJenkinsfile("fromDockerfile");
+ sampleRepo.write("Dockerfile", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
+ sampleRepo.git("add", "Dockerfile");
+ sampleRepo.git("commit", "--message=Dockerfile");
+
+ WorkflowRun b = getAndStartBuild();
+ j.assertBuildStatusSuccess(j.waitForCompletion(b));
+ j.assertLogContains("[Pipeline] { (foo)", b);
+ j.assertLogContains("The answer is 42", b);
+ j.assertLogContains("-v /tmp:/tmp -p 8000:8000", b);
+ j.assertLogContains("HI THERE", b);
+ }
+
+ @Test
+ public void fromAlternateDockerfile() throws Exception {
+ assumeDocker();
+ // Bind mounting /var on OS X doesn't work at the moment
+ onAllowedOS(PossibleOS.LINUX);
+
+ prepRepoWithJenkinsfile("fromAlternateDockerfile");
+ sampleRepo.write("Dockerfile.alternate", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
+ sampleRepo.git("add", "Dockerfile.alternate");
+ sampleRepo.git("commit", "--message=Dockerfile");
+
+ WorkflowRun b = getAndStartBuild();
+ j.assertBuildStatusSuccess(j.waitForCompletion(b));
+ j.assertLogContains("[Pipeline] { (foo)", b);
+ j.assertLogContains("The answer is 42", b);
+ j.assertLogContains("-v /tmp:/tmp -p 8000:8000", b);
+ j.assertLogContains("HI THERE", b);
+ }
+
private WorkflowRun agentDocker(final String jenkinsfile) throws Exception {
assumeDocker();
// Bind mounting /var on OS X doesn't work at the moment
diff --git a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
index 4946eda65..4f2f6d2fd 100644
--- a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
+++ b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
@@ -382,7 +382,7 @@ public void globalLibraryObjectMethodCall() throws Exception {
public void unknownAgentType() throws Exception {
prepRepoWithJenkinsfile("errors", "unknownAgentType");
- assertFailWithError("No agent type specified. Must contain one of [otherField, docker, label, any, none]");
+ assertFailWithError("No agent type specified. Must contain one of [otherField, docker, dockerfile, label, any, none]");
}
@Test
diff --git a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelAndOtherFieldAgent.java b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelAndOtherFieldAgent.java
index 57c7f2de1..71c3a8722 100644
--- a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelAndOtherFieldAgent.java
+++ b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelAndOtherFieldAgent.java
@@ -27,7 +27,6 @@
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgent;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentDescriptor;
-import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted;
import org.kohsuke.stapler.DataBoundConstructor;
import javax.annotation.Nonnull;
@@ -42,12 +41,10 @@ public LabelAndOtherFieldAgent(String label, String otherField) {
this.otherField = otherField;
}
- @Whitelisted
public String getLabel() {
return label;
}
- @Whitelisted
public String getOtherField() {
return otherField;
}
diff --git a/pipeline-model-definition/src/test/resources/fromAlternateDockerfile.groovy b/pipeline-model-definition/src/test/resources/fromAlternateDockerfile.groovy
new file mode 100644
index 000000000..59a693380
--- /dev/null
+++ b/pipeline-model-definition/src/test/resources/fromAlternateDockerfile.groovy
@@ -0,0 +1,38 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2016, CloudBees, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+pipeline {
+ agent dockerfile:"Dockerfile.alternate", dockerArgs:"-v /tmp:/tmp -p 8000:8000"
+ stages {
+ stage("foo") {
+ steps {
+ sh 'cat /hi-there'
+ sh 'echo "The answer is 42"'
+ }
+ }
+ }
+}
+
+
+
diff --git a/pipeline-model-definition/src/test/resources/fromDockerfile.groovy b/pipeline-model-definition/src/test/resources/fromDockerfile.groovy
new file mode 100644
index 000000000..e843d890c
--- /dev/null
+++ b/pipeline-model-definition/src/test/resources/fromDockerfile.groovy
@@ -0,0 +1,38 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2016, CloudBees, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+pipeline {
+ agent dockerfile:true, dockerArgs:"-v /tmp:/tmp -p 8000:8000"
+ stages {
+ stage("foo") {
+ steps {
+ sh 'cat /hi-there'
+ sh 'echo "The answer is 42"'
+ }
+ }
+ }
+}
+
+
+