Class ModelASTUtils
java.lang.Object
io.jenkins.plugins.todeclarative.converter.api.ModelASTUtils
Some util methods to work with Declarative Model
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addOption
(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTOption option) Adds a declarative option to the pipeline modelstatic void
addParameter
(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBuildParameter parameter) Add a single build parameter to the pipeline modelstatic void
addStage
(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStage stage) Adds a stage to the pipeline modelstatic void
addStep
(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBuildCondition buildCondition, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStep step) Add an individual step to the pipeline modelstatic void
addTool
(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTKey key, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTValue value) Add a tool to the pipeline modelstatic void
addTrigger
(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTTrigger trigger) Add a trigger to the pipeline modelstatic org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStep
buildGenericStep
(Publisher publisher, Object source) Create a generic step from a publisherstatic org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTKeyValueOrMethodCallPair
buildKeyPairArg
(String key, Object value) Create a ModelASTKeyValueOrMethodCallPairstatic org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBuildCondition
buildOrFindBuildCondition
(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, String condition) Finds build condition or, if one does not exist, creates a new onestatic void
wrapBranch
(ConverterResult converterResult, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStep mainStep, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBranch mainBranch) Wrap your step with build wrapper such withCredential, configFile
-
Method Details
-
buildKeyPairArg
public static org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTKeyValueOrMethodCallPair buildKeyPairArg(String key, Object value) Create a ModelASTKeyValueOrMethodCallPair- Parameters:
key
- the keyvalue
- the value- Returns:
- ModelASTKeyValueorMethodCallPair
-
buildOrFindBuildCondition
public static org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBuildCondition buildOrFindBuildCondition(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, String condition) Finds build condition or, if one does not exist, creates a new one- Parameters:
modelASTPipelineDef
- the pipeline model to find or create the build conditioncondition
- the build condition to search- Returns:
- ModelASTBuildCondition of the condtion
-
addStage
public static void addStage(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStage stage) Adds a stage to the pipeline model- Parameters:
modelASTPipelineDef
- the pipeline model to modifystage
- the stage to add
-
addOption
public static void addOption(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTOption option) Adds a declarative option to the pipeline model- Parameters:
modelASTPipelineDef
- the pipeline model to modifyoption
- the option to add
-
addStep
public static void addStep(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBuildCondition buildCondition, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStep step) Add an individual step to the pipeline model- Parameters:
buildCondition
- build that the step should belong tostep
- the step to add
-
addTool
public static void addTool(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTKey key, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTValue value) Add a tool to the pipeline model- Parameters:
modelASTPipelineDef
- the pipeline model to modifykey
- tool typevalue
- tool name
-
addTrigger
public static void addTrigger(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTTrigger trigger) Add a trigger to the pipeline model- Parameters:
modelASTPipelineDef
- the pipeline model to modifytrigger
- the trigger that will be added to the model
-
addParameter
public static void addParameter(org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef modelASTPipelineDef, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBuildParameter parameter) Add a single build parameter to the pipeline model- Parameters:
modelASTPipelineDef
- the pipeline model to modifyparameter
- the parameter to add
-
wrapBranch
public static void wrapBranch(ConverterResult converterResult, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStep mainStep, org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTBranch mainBranch) Wrap your step with build wrapper such withCredential, configFile- Parameters:
converterResult
- the current resultmainStep
- the step to add/wrapmainBranch
- the current branch
-
buildGenericStep
public static org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStep buildGenericStep(Publisher publisher, Object source) Create a generic step from a publisher- Parameters:
publisher
- publisher to convertsource
- source of the publisher- Returns:
- ModelASTStep representation of the publisher
-