diff --git a/README.md b/README.md index be0a46abe..41e20e80f 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,11 @@ provided pipeline library. ## API -All steps are intended to be used by Pipelines. All the classes / groovy-scripts -contained in the `src` folder are by default not part of the API and are subjected to change -without prior notice. Types and methods annotated with `@API` are considered to be API, used e.g. -from other shared libraries. Changes to those methods/types needs to be announced, disussed and -agreed. +All steps (`vars` directory) are intended to be used by Pipelines and are considered API. +All the classes / groovy-scripts contained in the `src` folder are by default not part of +the API and are subjected to change without prior notice. Types and methods annotated with +`@API` are considered to be API, used e.g. from other shared libraries. Changes to those +methods/types needs to be announced, discussed and agreed. # Requirements diff --git a/src/com/sap/piper/ConfigurationHelper.groovy b/src/com/sap/piper/ConfigurationHelper.groovy index 116fa8051..d8781eafd 100644 --- a/src/com/sap/piper/ConfigurationHelper.groovy +++ b/src/com/sap/piper/ConfigurationHelper.groovy @@ -2,6 +2,7 @@ package com.sap.piper import com.cloudbees.groovy.cps.NonCPS +@API class ConfigurationHelper implements Serializable { static ConfigurationHelper newInstance(Script step, Map config = [:]) { @@ -31,19 +32,16 @@ class ConfigurationHelper implements Serializable { return this } - @API ConfigurationHelper mixinGeneralConfig(commonPipelineEnvironment, Set filter = null, Map compatibleParameters = [:]){ Map stepConfiguration = ConfigurationLoader.generalConfiguration([commonPipelineEnvironment: commonPipelineEnvironment]) return mixin(stepConfiguration, filter, compatibleParameters) } - @API ConfigurationHelper mixinStageConfig(commonPipelineEnvironment, stageName, Set filter = null, Map compatibleParameters = [:]){ Map stageConfiguration = ConfigurationLoader.stageConfiguration([commonPipelineEnvironment: commonPipelineEnvironment], stageName) return mixin(stageConfiguration, filter, compatibleParameters) } - @API ConfigurationHelper mixinStepConfig(commonPipelineEnvironment, Set filter = null, Map compatibleParameters = [:]){ Map stepConfiguration = ConfigurationLoader.stepConfiguration([commonPipelineEnvironment: commonPipelineEnvironment], name) return mixin(stepConfiguration, filter, compatibleParameters) @@ -103,7 +101,6 @@ class ConfigurationHelper implements Serializable { return this } - @API @NonCPS // required because we have a closure in the // method body that cannot be CPS transformed Map use(){ @@ -152,7 +149,6 @@ class ConfigurationHelper implements Serializable { } } - @API ConfigurationHelper withMandatoryProperty(key, errorMessage = null, condition = null){ if(condition){ if(condition(this.config)) diff --git a/src/com/sap/piper/ConfigurationLoader.groovy b/src/com/sap/piper/ConfigurationLoader.groovy index f3c8a15a2..c140cfd35 100644 --- a/src/com/sap/piper/ConfigurationLoader.groovy +++ b/src/com/sap/piper/ConfigurationLoader.groovy @@ -2,6 +2,7 @@ package com.sap.piper import com.cloudbees.groovy.cps.NonCPS +@API class ConfigurationLoader implements Serializable { @NonCPS static Map stepConfiguration(script, String stepName) { diff --git a/src/com/sap/piper/ConfigurationMerger.groovy b/src/com/sap/piper/ConfigurationMerger.groovy index 4c3ec4675..d6988037f 100644 --- a/src/com/sap/piper/ConfigurationMerger.groovy +++ b/src/com/sap/piper/ConfigurationMerger.groovy @@ -2,6 +2,7 @@ package com.sap.piper import com.cloudbees.groovy.cps.NonCPS +@API class ConfigurationMerger { @NonCPS static Map merge(Map configs, Set configKeys, Map defaults) { diff --git a/src/com/sap/piper/DefaultValueCache.groovy b/src/com/sap/piper/DefaultValueCache.groovy index a620d3dce..7ae3ffd1e 100644 --- a/src/com/sap/piper/DefaultValueCache.groovy +++ b/src/com/sap/piper/DefaultValueCache.groovy @@ -2,6 +2,7 @@ package com.sap.piper import com.cloudbees.groovy.cps.NonCPS +@API class DefaultValueCache implements Serializable { private static DefaultValueCache instance diff --git a/src/com/sap/piper/JenkinsUtils.groovy b/src/com/sap/piper/JenkinsUtils.groovy index e8c43005b..f49d158ff 100644 --- a/src/com/sap/piper/JenkinsUtils.groovy +++ b/src/com/sap/piper/JenkinsUtils.groovy @@ -4,6 +4,7 @@ import com.cloudbees.groovy.cps.NonCPS import jenkins.model.Jenkins import org.jenkinsci.plugins.workflow.steps.MissingContextVariableException +@API @NonCPS static def isPluginActive(pluginId) { return Jenkins.instance.pluginManager.plugins.find { p -> p.isActive() && p.getShortName() == pluginId } diff --git a/src/com/sap/piper/k8s/ContainerMap.groovy b/src/com/sap/piper/k8s/ContainerMap.groovy index 5cdaae796..7a9402f57 100644 --- a/src/com/sap/piper/k8s/ContainerMap.groovy +++ b/src/com/sap/piper/k8s/ContainerMap.groovy @@ -1,5 +1,8 @@ package com.sap.piper.k8s +import com.sap.piper.API + +@API @Singleton class ContainerMap { private Map containerMap = null