Class ModelASTUtils

java.lang.Object
io.jenkins.plugins.todeclarative.converter.api.ModelASTUtils

public class ModelASTUtils extends Object
Some util methods to work with Declarative Model
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    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
    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
    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
    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
    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
    static org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStep
    buildGenericStep(Publisher publisher, Object source)
    Create a generic step from a publisher
    static org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTKeyValueOrMethodCallPair
    Create a ModelASTKeyValueOrMethodCallPair
    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
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • buildKeyPairArg

      public static org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTKeyValueOrMethodCallPair buildKeyPairArg(String key, Object value)
      Create a ModelASTKeyValueOrMethodCallPair
      Parameters:
      key - the key
      value - 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 condition
      condition - 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 modify
      stage - 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 modify
      option - 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 to
      step - 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 modify
      key - tool type
      value - 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 modify
      trigger - 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 modify
      parameter - 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 result
      mainStep - the step to add/wrap
      mainBranch - 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 convert
      source - source of the publisher
      Returns:
      ModelASTStep representation of the publisher