Skip to content

Instantly share code, notes, and snippets.

@ranma2913
Forked from ggarcia24/pipeline.gdsl
Last active September 11, 2023 05:33
Show Gist options
  • Save ranma2913/6c2424a5bda07d12d034502fb4b0b7c2 to your computer and use it in GitHub Desktop.
Save ranma2913/6c2424a5bda07d12d034502fb4b0b7c2 to your computer and use it in GitHub Desktop.
GDSL supporting pipeline declarative
//The global script scope
def ctx = context(scope: scriptScope())
//What things can be on the script scope
contributor(ctx) {
method(name: 'pipeline', type: 'Object', params: [body: Closure])
method(name: 'build', type: 'Object', params: [job: 'java.lang.String'], doc: 'Build a job')
method(name: 'build', type: 'Object', namedParams: [parameter(name: 'job', type: 'java.lang.String'), parameter(name: 'parameters', type: 'Map'), parameter(name: 'propagate', type: 'boolean'), parameter(name: 'quietPeriod', type: 'java.lang.Integer'), parameter(name: 'wait', type: 'boolean'),], doc: 'Build a job')
method(name: 'echo', type: 'Object', params: [message: 'java.lang.String'], doc: 'Print Message')
method(name: 'emailextrecipients', type: 'Object', params: [recipientProviders: 'Map'], doc: 'Extended Email Recipients')
method(name: 'error', type: 'Object', params: [message: 'java.lang.String'], doc: 'Error signal')
method(name: 'input', type: 'Object', params: [message: 'java.lang.String'], doc: 'Wait for interactive input')
method(name: 'input', type: 'Object', namedParams: [parameter(name: 'message', type: 'java.lang.String'), parameter(name: 'id', type: 'java.lang.String'), parameter(name: 'ok', type: 'java.lang.String'), parameter(name: 'parameters', type: 'Map'), parameter(name: 'submitter', type: 'java.lang.String'), parameter(name: 'submitterParameter', type: 'java.lang.String'),], doc: 'Wait for interactive input')
method(name: 'isUnix', type: 'Object', params: [:], doc: 'Checks if running on a Unix-like node')
method(name: 'library', type: 'Object', params: [identifier: 'java.lang.String'], doc: 'Load a shared library on the fly')
method(name: 'library', type: 'Object', namedParams: [parameter(name: 'identifier', type: 'java.lang.String'), parameter(name: 'retriever', type: 'Map'),], doc: 'Load a shared library on the fly')
method(name: 'libraryResource', type: 'Object', params: [resource: 'java.lang.String'], doc: 'Load a resource file from a shared library')
method(name: 'lock', type: 'Object', params: [resource: java.lang.String, body: 'Closure'], doc: 'Lock shared resource')
method(name: 'lock', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'resource', type: 'java.lang.String'), parameter(name: 'inversePrecedence', type: 'boolean'), parameter(name: 'label', type: 'java.lang.String'), parameter(name: 'quantity', type: 'int'),], doc: 'Lock shared resource')
method(name: 'mail', type: 'Object', namedParams: [parameter(name: 'subject', type: 'java.lang.String'), parameter(name: 'body', type: 'java.lang.String'), parameter(name: 'bcc', type: 'java.lang.String'), parameter(name: 'cc', type: 'java.lang.String'), parameter(name: 'charset', type: 'java.lang.String'), parameter(name: 'from', type: 'java.lang.String'), parameter(name: 'mimeType', type: 'java.lang.String'), parameter(name: 'replyTo', type: 'java.lang.String'), parameter(name: 'to', type: 'java.lang.String'),], doc: 'Mail')
method(name: 'milestone', type: 'Object', params: [ordinal: 'java.lang.Integer'], doc: 'The milestone step forces all builds to go through in order')
method(name: 'milestone', type: 'Object', namedParams: [parameter(name: 'ordinal', type: 'java.lang.Integer'), parameter(name: 'label', type: 'java.lang.String'),], doc: 'The milestone step forces all builds to go through in order')
method(name: 'node', type: 'Object', params: [label: java.lang.String, body: 'Closure'], doc: 'Allocate node')
method(name: 'properties', type: 'Object', params: [properties: 'Map'], doc: 'Set job properties')
method(name: 'readTrusted', type: 'Object', params: [path: 'java.lang.String'], doc: 'Read trusted file from SCM')
method(name: 'resolveScm', type: 'Object', namedParams: [parameter(name: 'source', type: 'Map'), parameter(name: 'targets', type: 'Map'), parameter(name: 'ignoreErrors', type: 'boolean'),], doc: 'Resolves an SCM from an SCM Source and a list of candidate target branch names')
method(name: 'retry', type: 'Object', params: [count: int, body: 'Closure'], doc: 'Retry the body up to N times')
method(name: 'sauce', type: 'Object', params: [credentialsId: java.lang.String, body: 'Closure'], doc: 'Sauce')
method(name: 'sauceconnect', type: 'Object', params: [body: 'Closure'], doc: 'Sauce Connect')
method(name: 'sauceconnect', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'options', type: 'java.lang.String'), parameter(name: 'sauceConnectPath', type: 'java.lang.String'), parameter(name: 'useGeneratedTunnelIdentifier', type: 'java.lang.Boolean'), parameter(name: 'verboseLogging', type: 'java.lang.Boolean'),], doc: 'Sauce Connect')
method(name: 'script', type: 'Object', params: [body: 'Closure'], doc: 'Run arbitrary Pipeline script')
method(name: 'sleep', type: 'Object', params: [time: 'int'], doc: 'Sleep')
method(name: 'sleep', type: 'Object', namedParams: [parameter(name: 'time', type: 'int'), parameter(name: 'unit', type: 'java.util.concurrent.TimeUnit'),], doc: 'Sleep')
method(name: 'stage', type: 'Object', params: [name: java.lang.String, body: 'Closure'], doc: 'Stage')
method(name: 'stage', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'concurrency', type: 'java.lang.Integer'),], doc: 'Stage')
method(name: 'timeout', type: 'Object', params: [time: int, body: 'Closure'], doc: 'Enforce time limit')
method(name: 'timeout', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'time', type: 'int'), parameter(name: 'unit', type: 'java.util.concurrent.TimeUnit'),], doc: 'Enforce time limit')
method(name: 'tool', type: 'Object', params: [name: 'java.lang.String'], doc: 'Use a tool from a predefined Tool Installation')
method(name: 'tool', type: 'Object', namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'type', type: 'java.lang.String'),], doc: 'Use a tool from a predefined Tool Installation')
method(name: 'waitUntil', type: 'Object', params: [body: 'Closure'], doc: 'Wait for condition')
method(name: 'withEnv', type: 'Object', params: [overrides: Map, body: 'Closure'], doc: 'Set environment variables')
method(name: 'ws', type: 'Object', params: [dir: java.lang.String, body: 'Closure'], doc: 'Allocate workspace')
method(name: 'artifactoryPromoteBuild', type: 'Object', namedParams: [parameter(name: 'promotionConfig', type: 'Map'), parameter(name: 'server', type: 'Map'),], doc: 'Promote build')
method(name: 'catchError', type: 'Object', params: [body: 'Closure'], doc: 'Advanced/Deprecated Catch error and set build result')
method(name: 'collectEnv', type: 'Object', params: [env: 'Map'], doc: 'Advanced/Deprecated Collect environment variables and system properties')
method(name: 'dockerFingerprintRun', type: 'Object', params: [containerId: 'java.lang.String'], doc: 'Advanced/Deprecated Record trace of a Docker image run in a container')
method(name: 'dockerFingerprintRun', type: 'Object', namedParams: [parameter(name: 'containerId', type: 'java.lang.String'), parameter(name: 'toolName', type: 'java.lang.String'),], doc: 'Record trace of a Docker image run in a container')
method(name: 'envVarsForTool', type: 'Object', namedParams: [parameter(name: 'toolId', type: 'java.lang.String'), parameter(name: 'toolVersion', type: 'java.lang.String'),], doc: 'Fetches the environment variables for a given tool in a list of \'FOO=bar\' strings suitable for the withEnv step.')
method(name: 'getArtifactoryServer', type: 'Object', params: [artifactoryServerID: 'java.lang.String'], doc: 'Advanced/Deprecated Get Artifactory server from Jenkins config')
method(name: 'getContext', type: 'Object', params: [type: 'Map'], doc: 'Advanced/Deprecated Get contextual object from internal APIs')
method(name: 'newBuildInfo', type: 'Object', params: [:], doc: 'Advanced/Deprecated New buildInfo')
method(name: 'newGradleBuild', type: 'Object', params: [:], doc: 'Advanced/Deprecated New Artifactory gradle executor')
method(name: 'newMavenBuild', type: 'Object', params: [:], doc: 'Advanced/Deprecated New Artifactory maven')
method(name: 'podTemplate', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'label', type: 'java.lang.String'), parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'cloud', type: 'java.lang.String'), parameter(name: 'containers', type: 'Map'), parameter(name: 'inheritFrom', type: 'java.lang.String'), parameter(name: 'instanceCap', type: 'int'), parameter(name: 'nodeSelector', type: 'java.lang.String'), parameter(name: 'serviceAccount', type: 'java.lang.String'), parameter(name: 'volumes', type: 'Map'), parameter(name: 'workingDir', type: 'java.lang.String'),], doc: 'Define a podTemplate to use in the kubernetes plugin')
method(name: 'withContext', type: 'Object', params: [context: java.lang.Object, body: 'Closure'], doc: 'Advanced/Deprecated Use contextual object from internal APIs within a block')
method(name: 'xrayScanBuild', type: 'Object', namedParams: [parameter(name: 'xrayScanConfig', type: 'Map'), parameter(name: 'server', type: 'Map'),], doc: 'Xray build scanning')
property(name: 'openshift', type: 'com.openshift.jenkins.plugins.pipeline.OpenShiftGlobalVariable')
property(name: 'docker', type: 'org.jenkinsci.plugins.docker.workflow.DockerDSL')
property(name: 'pipeline', type: 'org.jenkinsci.plugins.pipeline.modeldefinition.ModelStepLoader')
property(name: 'env', type: 'org.jenkinsci.plugins.workflow.cps.EnvActionImpl.Binder')
property(name: 'params', type: 'org.jenkinsci.plugins.workflow.cps.ParamsVariable')
property(name: 'currentBuild', type: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder')
property(name: 'scm', type: 'org.jenkinsci.plugins.workflow.multibranch.SCMVar')
property(name: 'Artifactory', type: 'org.jfrog.hudson.pipeline.dsl.ArtifactoryDSL')
property(name: 'cleanPreNonProdAppFromOse', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'cleanPreNonProdAppFromOseNoCreds', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'dtrDeleteCurrentBuildImageTag', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'dtrDeleteOldImageTags', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'getOseServiceRoute', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'oseDeleteOldReplicationControllers', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'setupJavaMavenOseDockerBuildEnvironment', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'updatePath', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'verifyApplicationIsInitialized', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
property(name: 'verifyApplicationIsInitializedNoCreds', type: 'org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable')
}
//Steps that require a node context
def closures = context(scope: closureScope())
contributor(closures) {
// What things can be inside a node or pipeline
if (enclosingCall('node') || enclosingCall("pipeline")) {
method(name: '_OcAction', type: 'Object', namedParams: [parameter(name: 'server', type: 'java.lang.String'), parameter(name: 'project', type: 'java.lang.String'), parameter(name: 'verb', type: 'java.lang.String'), parameter(name: 'verbArgs', type: 'java.util.List'), parameter(name: 'userArgs', type: 'java.util.List'), parameter(name: 'options', type: 'java.util.List'), parameter(name: 'verboseOptions', type: 'java.util.List'), parameter(name: 'token', type: 'java.lang.String'), parameter(name: 'streamStdOutToConsolePrefix', type: 'java.lang.String'), parameter(name: 'reference', type: 'Map'), parameter(name: 'logLevel', type: 'int'),], doc: 'Internal utility function for OpenShift DSL')
method(name: '_OcContextInit', type: 'Object', params: [:], doc: 'Advanced/Deprecated Internal utility function for OpenShift DSL')
method(name: '_OcWatch', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'server', type: 'java.lang.String'), parameter(name: 'project', type: 'java.lang.String'), parameter(name: 'verb', type: 'java.lang.String'), parameter(name: 'verbArgs', type: 'java.util.List'), parameter(name: 'userArgs', type: 'java.util.List'), parameter(name: 'options', type: 'java.util.List'), parameter(name: 'verboseOptions', type: 'java.util.List'), parameter(name: 'token', type: 'java.lang.String'), parameter(name: 'logLevel', type: 'int'),], doc: 'Internal utility function for OpenShift DSL')
method(name: 'agent', type: 'Object', params: [body: 'Closure'], doc: 'Label expression to select agents')
method(name: 'archive', type: 'Object', namedParams: [parameter(name: 'includes', type: 'java.lang.String'), parameter(name: 'excludes', type: 'java.lang.String'),], doc: 'Archive artifacts')
method(name: 'archive', type: 'Object', params: [includes: 'java.lang.String'], doc: 'Advanced/Deprecated Archive artifacts')
method(name: 'artifactoryDownload', type: 'Object', namedParams: [parameter(name: 'spec', type: 'java.lang.String'), parameter(name: 'buildInfo', type: 'Map'), parameter(name: 'server', type: 'Map'),], doc: 'Download artifacts')
method(name: 'ArtifactoryGradleBuild', type: 'Object', namedParams: [parameter(name: 'gradleBuild', type: 'Map'), parameter(name: 'tool', type: 'java.lang.String'), parameter(name: 'rootDir', type: 'java.lang.String'), parameter(name: 'buildFile', type: 'java.lang.String'), parameter(name: 'tasks', type: 'java.lang.String'), parameter(name: 'switches', type: 'java.lang.String'), parameter(name: 'useWrapper', type: 'boolean'), parameter(name: 'buildInfo', type: 'Map'), parameter(name: 'usesPlugin', type: 'boolean'),], doc: 'run Artifactory gradle')
method(name: 'ArtifactoryMavenBuild', type: 'Object', namedParams: [parameter(name: 'mavenBuild', type: 'Map'), parameter(name: 'tool', type: 'java.lang.String'), parameter(name: 'pom', type: 'java.lang.String'), parameter(name: 'goals', type: 'java.lang.String'), parameter(name: 'opts', type: 'java.lang.String'), parameter(name: 'buildInfo', type: 'Map'),], doc: 'run Artifactory maven')
method(name: 'artifactoryUpload', type: 'Object', namedParams: [parameter(name: 'spec', type: 'java.lang.String'), parameter(name: 'buildInfo', type: 'Map'), parameter(name: 'server', type: 'Map'),], doc: 'Upload artifacts')
method(name: 'bat', type: 'Object', namedParams: [parameter(name: 'script', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'), parameter(name: 'returnStatus', type: 'boolean'), parameter(name: 'returnStdout', type: 'boolean'),], doc: 'Windows Batch Script')
method(name: 'build', type: 'Object', namedParams: [parameter(name: 'job', type: 'java.lang.String'), parameter(name: 'parameters', type: 'Map'), parameter(name: 'propagate', type: 'boolean'), parameter(name: 'quietPeriod', type: 'java.lang.Integer'), parameter(name: 'wait', type: 'boolean'),], doc: 'Build a job')
method(name: 'catchError', type: 'Object', params: [body: 'Closure'], doc: 'Advanced/Deprecated Catch error and set build result')
method(name: 'checkout', type: 'Object', namedParams: [parameter(name: 'scm', type: 'Map'), parameter(name: 'changelog', type: 'boolean'), parameter(name: 'poll', type: 'boolean'),], doc: 'General SCM')
method(name: 'container', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'cloud', type: 'java.lang.String'),], doc: 'Run build steps in a container')
method(name: 'deleteDir', type: 'Object', params: [:], doc: 'Recursively delete the current directory from the workspace')
method(name: 'dir', type: 'Object', params: [path: java.lang.String, body: 'Closure'], doc: 'Change current directory')
method(name: 'dockerFingerprintFrom', type: 'Object', namedParams: [parameter(name: 'dockerfile', type: 'java.lang.String'), parameter(name: 'image', type: 'java.lang.String'), parameter(name: 'toolName', type: 'java.lang.String'),], doc: 'Record trace of a Docker image used in FROM')
method(name: 'dockerFingerprintRun', type: 'Object', params: [containerId: 'java.lang.String'], doc: 'Advanced/Deprecated Record trace of a Docker image run in a container')
method(name: 'dockerPullStep', type: 'Object', namedParams: [parameter(name: 'image', type: 'java.lang.String'), parameter(name: 'credentialsConfig', type: 'Map'), parameter(name: 'host', type: 'java.lang.String'), parameter(name: 'buildInfo', type: 'Map'),], doc: 'Artifactory docker pull')
method(name: 'dockerPushStep', type: 'Object', namedParams: [parameter(name: 'image', type: 'java.lang.String'), parameter(name: 'credentialsConfig', type: 'Map'), parameter(name: 'host', type: 'java.lang.String'), parameter(name: 'targetRepo', type: 'java.lang.String'), parameter(name: 'buildInfo', type: 'Map'),], doc: 'Artifactory docker push')
method(name: 'ec2', type: 'Object', namedParams: [parameter(name: 'cloud', type: 'java.lang.String'), parameter(name: 'template', type: 'java.lang.String'),], doc: 'Cloud template provisioning')
method(name: 'echo', type: 'Object', params: [message: 'java.lang.String'], doc: 'Print Message')
method(name: 'emailext', type: 'Object', namedParams: [parameter(name: 'subject', type: 'java.lang.String'), parameter(name: 'body', type: 'java.lang.String'), parameter(name: 'attachLog', type: 'boolean'), parameter(name: 'attachmentsPattern', type: 'java.lang.String'), parameter(name: 'compressLog', type: 'boolean'), parameter(name: 'mimeType', type: 'java.lang.String'), parameter(name: 'recipientProviders', type: 'Map'), parameter(name: 'replyTo', type: 'java.lang.String'), parameter(name: 'to', type: 'java.lang.String'),], doc: 'Extended Email')
method(name: 'envVarsForTool', type: 'Object', namedParams: [parameter(name: 'toolId', type: 'java.lang.String'), parameter(name: 'toolVersion', type: 'java.lang.String'),], doc: 'Fetches the environment variables for a given tool in a list of \'FOO=bar\' strings suitable for the withEnv step.')
method(name: 'error', type: 'Object', params: [message: 'java.lang.String'], doc: 'Error signal')
method(name: 'fileExists', type: 'Object', params: [file: 'java.lang.String'], doc: 'Verify if file exists in workspace')
method(name: 'findFiles', type: 'Object', namedParams: [parameter(name: 'glob', type: 'java.lang.String'),], doc: 'Find files in the workspace')
method(name: 'getContext', type: 'Object', params: [type: 'Map'], doc: 'Advanced/Deprecated Get contextual object from internal APIs')
method(name: 'git', type: 'Object', namedParams: [parameter(name: 'url', type: 'java.lang.String'), parameter(name: 'branch', type: 'java.lang.String'), parameter(name: 'changelog', type: 'boolean'), parameter(name: 'credentialsId', type: 'java.lang.String'), parameter(name: 'poll', type: 'boolean'),], doc: 'Git')
method(name: 'input', type: 'Object', namedParams: [parameter(name: 'message', type: 'java.lang.String'), parameter(name: 'id', type: 'java.lang.String'), parameter(name: 'ok', type: 'java.lang.String'), parameter(name: 'parameters', type: 'Map'), parameter(name: 'submitter', type: 'java.lang.String'), parameter(name: 'submitterParameter', type: 'java.lang.String'),], doc: 'Wait for interactive input')
method(name: 'isUnix', type: 'Object', params: [:], doc: 'Checks if running on a Unix-like node')
method(name: 'jiraComment', type: 'Object', namedParams: [parameter(name: 'issueKey', type: 'java.lang.String'), parameter(name: 'body', type: 'java.lang.String'),], doc: 'JIRA: Add a comment to issue(s)')
method(name: 'jiraIssueSelector', type: 'Object', namedParams: [parameter(name: 'issueSelector', type: 'Map'),], doc: 'JIRA: Issue selector')
method(name: 'jiraSearch', type: 'Object', params: [jql: 'java.lang.String'], doc: 'JIRA: Search issues')
method(name: 'library', type: 'Object', namedParams: [parameter(name: 'identifier', type: 'java.lang.String'), parameter(name: 'changelog', type: 'java.lang.Boolean'), parameter(name: 'retriever', type: 'Map'),], doc: 'Load a shared library on the fly')
method(name: 'libraryResource', type: 'Object', params: [resource: 'java.lang.String'], doc: 'Load a resource file from a shared library')
method(name: 'load', type: 'Object', params: [path: 'java.lang.String'], doc: 'Evaluate a Groovy source file into the Pipeline script')
method(name: 'mail', type: 'Object', namedParams: [parameter(name: 'subject', type: 'java.lang.String'), parameter(name: 'body', type: 'java.lang.String'), parameter(name: 'bcc', type: 'java.lang.String'), parameter(name: 'cc', type: 'java.lang.String'), parameter(name: 'charset', type: 'java.lang.String'), parameter(name: 'from', type: 'java.lang.String'), parameter(name: 'mimeType', type: 'java.lang.String'), parameter(name: 'replyTo', type: 'java.lang.String'), parameter(name: 'to', type: 'java.lang.String'),], doc: 'Mail')
method(name: 'MavenDescriptorStep', type: 'Object', namedParams: [parameter(name: 'pomFile', type: 'java.lang.String'), parameter(name: 'version', type: 'java.lang.String'), parameter(name: 'versionPerModule', type: 'Map'), parameter(name: 'failOnSnapshot', type: 'boolean'), parameter(name: 'dryRun', type: 'boolean'),], doc: 'Get Artifactory Maven descriptor')
method(name: 'milestone', type: 'Object', namedParams: [parameter(name: 'ordinal', type: 'java.lang.Integer'), parameter(name: 'label', type: 'java.lang.String'),], doc: 'The milestone step forces all builds to go through in order')
method(name: 'newArtifactoryServer', type: 'Object', namedParams: [parameter(name: 'url', type: 'java.lang.String'), parameter(name: 'username', type: 'java.lang.String'), parameter(name: 'password', type: 'java.lang.String'), parameter(name: 'credentialsId', type: 'java.lang.String'),], doc: 'Returns new Artifactory server')
method(name: 'node', type: 'Object', params: [label: 'String', body: 'Closure'], doc: 'Allocate node')
method(name: 'openshiftBuild', type: 'Object', namedParams: [parameter(name: 'bldCfg', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'buildName', type: 'java.lang.String'), parameter(name: 'checkForTriggeredDeployments', type: 'java.lang.String'), parameter(name: 'commitID', type: 'java.lang.String'), parameter(name: 'env', type: 'Map'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'showBuildLogs', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'), parameter(name: 'waitTime', type: 'java.lang.String'), parameter(name: 'waitUnit', type: 'java.lang.String'),], doc: 'Trigger OpenShift Build')
method(name: 'openshiftCreateResource', type: 'Object', namedParams: [parameter(name: 'jsonyaml', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'),], doc: 'Create OpenShift Resource(s)')
method(name: 'openshiftDeleteResourceByJsonYaml', type: 'Object', namedParams: [parameter(name: 'jsonyaml', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'),], doc: 'Delete OpenShift Resource(s) from JSON/YAML')
method(name: 'openshiftDeleteResourceByKey', type: 'Object', namedParams: [parameter(name: 'types', type: 'java.lang.String'), parameter(name: 'keys', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'),], doc: 'Delete OpenShift Resource(s) by Key')
method(name: 'openshiftDeleteResourceByLabels', type: 'Object', namedParams: [parameter(name: 'types', type: 'java.lang.String'), parameter(name: 'keys', type: 'java.lang.String'), parameter(name: 'values', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'),], doc: 'Delete OpenShift Resource(s) using Labels')
method(name: 'openshiftDeploy', type: 'Object', namedParams: [parameter(name: 'depCfg', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'), parameter(name: 'waitTime', type: 'java.lang.String'), parameter(name: 'waitUnit', type: 'java.lang.String'),], doc: 'Trigger OpenShift Deployment')
method(name: 'openshiftExec', type: 'Object', namedParams: [parameter(name: 'pod', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'arguments', type: 'Map'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'command', type: 'java.lang.String'), parameter(name: 'container', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'), parameter(name: 'waitTime', type: 'java.lang.String'), parameter(name: 'waitUnit', type: 'java.lang.String'),], doc: 'OpenShift Exec')
method(name: 'openshiftExec', type: 'Object', params: [pod: 'java.lang.String'], doc: 'OpenShift Exec')
method(name: 'openshiftImageStream', type: 'Object', namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'tag', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'changelog', type: 'boolean'), parameter(name: 'poll', type: 'boolean'), parameter(name: 'verbose', type: 'java.lang.String'),], doc: 'OpenShift ImageStreams')
method(name: 'openshiftScale', type: 'Object', namedParams: [parameter(name: 'depCfg', type: 'java.lang.String'), parameter(name: 'replicaCount', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'), parameter(name: 'verifyReplicaCount', type: 'java.lang.String'), parameter(name: 'waitTime', type: 'java.lang.String'), parameter(name: 'waitUnit', type: 'java.lang.String'),], doc: 'Scale OpenShift Deployment')
method(name: 'openshiftTag', type: 'Object', namedParams: [parameter(name: 'srcStream', type: 'java.lang.String'), parameter(name: 'srcTag', type: 'java.lang.String'), parameter(name: 'destStream', type: 'java.lang.String'), parameter(name: 'destTag', type: 'java.lang.String'), parameter(name: 'alias', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'destinationAuthToken', type: 'java.lang.String'), parameter(name: 'destinationNamespace', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'),], doc: 'Tag OpenShift Image')
method(name: 'openshiftVerifyBuild', type: 'Object', namedParams: [parameter(name: 'bldCfg', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'checkForTriggeredDeployments', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'), parameter(name: 'waitTime', type: 'java.lang.String'), parameter(name: 'waitUnit', type: 'java.lang.String'),], doc: 'Verify OpenShift Build')
method(name: 'openshiftVerifyDeployment', type: 'Object', namedParams: [parameter(name: 'depCfg', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'replicaCount', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'), parameter(name: 'verifyReplicaCount', type: 'java.lang.String'), parameter(name: 'waitTime', type: 'java.lang.String'), parameter(name: 'waitUnit', type: 'java.lang.String'),], doc: 'Verify OpenShift Deployment')
method(name: 'openshiftVerifyService', type: 'Object', namedParams: [parameter(name: 'svcName', type: 'java.lang.String'), parameter(name: 'apiURL', type: 'java.lang.String'), parameter(name: 'authToken', type: 'java.lang.String'), parameter(name: 'namespace', type: 'java.lang.String'), parameter(name: 'retryCount', type: 'java.lang.String'), parameter(name: 'verbose', type: 'java.lang.String'),], doc: 'Verify OpenShift Service')
method(name: 'options', type: 'Object', params: [body: 'Closure'])
method(name: 'parameters', type: 'Object', params: [body: 'Closure'], doc: 'Job parameters')
method(name: 'post', type: 'Object', params: [body: 'Closure'], doc: 'Post build actions')
method(name: 'properties', type: 'Object', params: [properties: 'Map'], doc: 'Set job properties')
method(name: 'publishBuildInfo', type: 'Object', namedParams: [parameter(name: 'buildInfo', type: 'Map'), parameter(name: 'server', type: 'Map'),], doc: 'Publish build Info to Artifactory')
method(name: 'publishHTML', type: 'Object', params: [target: 'Map'], doc: 'Publish HTML reports')
method(name: 'pwd', type: 'Object', namedParams: [parameter(name: 'tmp', type: 'boolean'),], doc: 'Determine current directory')
method(name: 'readFile', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'),], doc: 'Read file from workspace')
method(name: 'readJSON', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'text', type: 'java.lang.String'),], doc: 'Read JSON from files in the workspace.')
method(name: 'readManifest', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'text', type: 'java.lang.String'),], doc: 'Read a Jar Manifest')
method(name: 'readMavenPom', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'),], doc: 'Read a maven project file.')
method(name: 'readProperties', type: 'Object', namedParams: [parameter(name: 'defaults', type: 'Map'), parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'text', type: 'java.lang.String'),], doc: 'Read properties from files in the workspace or text.')
method(name: 'readTrusted', type: 'Object', params: [path: 'java.lang.String'], doc: 'Read trusted file from SCM')
method(name: 'readYaml', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'text', type: 'java.lang.String'),], doc: 'Read yaml from files in the workspace or text.')
method(name: 'resolveScm', type: 'Object', namedParams: [parameter(name: 'source', type: 'Map'), parameter(name: 'targets', type: 'Map'), parameter(name: 'ignoreErrors', type: 'boolean'),], doc: 'Resolves an SCM from an SCM Source and a list of candidate target branch names')
method(name: 'retry', type: 'Object', params: [count: int, body: 'Closure'], doc: 'Retry the body up to N times')
method(name: 'script', type: 'Object', params: [body: 'Closure'], doc: 'Run arbitrary Pipeline script')
method(name: 'sh', type: 'Object', namedParams: [parameter(name: 'script', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'), parameter(name: 'returnStatus', type: 'boolean'), parameter(name: 'returnStdout', type: 'boolean'),], doc: 'Shell Script')
method(name: 'sleep', type: 'Object', namedParams: [parameter(name: 'time', type: 'int'), parameter(name: 'unit', type: 'java.util.concurrent.TimeUnit'),], doc: 'Sleep')
method(name: 'sshagent', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'credentials', type: 'Map'), parameter(name: 'ignoreMissing', type: 'boolean'),], doc: 'SSH Agent')
method(name: 'stages', type: 'Object', params: [body: 'Closure'], doc: 'Stages')
method(name: 'stash', type: 'Object', namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'excludes', type: 'java.lang.String'), parameter(name: 'includes', type: 'java.lang.String'), parameter(name: 'useDefaultExcludes', type: 'boolean'),], doc: 'Stash some files to be used later in the build')
method(name: 'step', type: 'Object', params: [delegate: 'Map'], doc: 'General Build Step')
method(name: 'svn', type: 'Object', namedParams: [parameter(name: 'url', type: 'java.lang.String'), parameter(name: 'changelog', type: 'boolean'), parameter(name: 'poll', type: 'boolean'),], doc: 'Subversion')
method(name: 'timeout', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'time', type: 'int'), parameter(name: 'unit', type: 'java.util.concurrent.TimeUnit'),], doc: 'Enforce time limit')
method(name: 'timeout', type: 'Object', params: [time: int, body: 'Closure'], doc: 'Enforce time limit')
method(name: 'tool', type: 'Object', namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'type', type: 'java.lang.String'),], doc: 'Use a tool from a predefined Tool Installation')
method(name: 'touch', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'timestamp', type: 'java.lang.Long'),], doc: 'Create a file (if not already exist) in the workspace, and set the timestamp')
method(name: 'triggers', type: 'Object', params: [body: 'Closure'], doc: 'Build triggers')
method(name: 'unarchive', type: 'Object', namedParams: [parameter(name: 'mapping', type: 'Map'),], doc: 'Copy archived artifacts into the workspace')
method(name: 'unstash', type: 'Object', params: [name: 'java.lang.String'], doc: 'Restore files previously stashed')
method(name: 'unzip', type: 'Object', namedParams: [parameter(name: 'zipFile', type: 'java.lang.String'), parameter(name: 'charset', type: 'java.lang.String'), parameter(name: 'dir', type: 'java.lang.String'), parameter(name: 'glob', type: 'java.lang.String'), parameter(name: 'read', type: 'boolean'), parameter(name: 'test', type: 'boolean'),], doc: 'Extract Zip file')
method(name: 'validateDeclarativePipeline', type: 'Object', params: [path: 'java.lang.String'], doc: 'Validate a file containing a Declarative Pipeline')
method(name: 'waitUntil', type: 'Object', params: [body: 'Closure'], doc: 'Wait for condition')
method(name: 'withContext', type: 'Object', params: [context: 'Object', body: 'Closure'], doc: 'Advanced/Deprecated Use contextual object from internal APIs within a block')
method(name: 'withCredentials', type: 'Object', params: [bindings: Map, body: 'Closure'], doc: 'Bind credentials to variables')
method(name: 'withDockerContainer', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'image', type: 'java.lang.String'), parameter(name: 'args', type: 'java.lang.String'), parameter(name: 'toolName', type: 'java.lang.String'),], doc: 'Run build steps inside a Docker container')
method(name: 'withDockerRegistry', type: 'Object', params: [registry: Map, body: 'Closure'], doc: 'Advanced/Deprecated Sets up Docker registry endpoint')
method(name: 'withDockerServer', type: 'Object', params: [server: Map, body: 'Closure'], doc: 'Advanced/Deprecated Sets up Docker server endpoint')
method(name: 'withEnv', type: 'Object', params: [overrides: Map, body: 'Closure'], doc: 'Set environment variables')
method(name: 'wrap', type: 'Object', params: [delegate: Map, body: 'Closure'], doc: 'General Build Wrapper')
method(name: 'writeFile', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'text', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'),], doc: 'Write file to workspace')
method(name: 'writeJSON', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'json', type: 'Map'),], doc: 'Write JSON to a file in the workspace.')
method(name: 'writeMavenPom', type: 'Object', namedParams: [parameter(name: 'model', type: 'Map'), parameter(name: 'file', type: 'java.lang.String'),], doc: 'Write a maven project file.')
method(name: 'ws', type: 'Object', params: [dir: 'String', body: 'Closure'], doc: 'Allocate workspace')
method(name: 'zip', type: 'Object', namedParams: [parameter(name: 'zipFile', type: 'java.lang.String'), parameter(name: 'archive', type: 'boolean'), parameter(name: 'dir', type: 'java.lang.String'), parameter(name: 'glob', type: 'java.lang.String'),], doc: 'Create Zip file')
//The only thing inside agent can be label
if (enclosingCall("agent")) {
property(name: 'any')
property(name: 'none')
method(name: 'label', type: 'String', params: [expr: 'String'])
method(name: 'docker', type: 'String', params: [docker_image: 'String'])
method(name: 'dockerfile', type: 'boolean', params: [use_dockerfile: 'boolean'])
}
if (enclosingCall("triggers")) {
method(name: 'cron', type: 'String', params: [expr: 'String'], doc: 'Cron expression can be one of @daily, @hourly, etc')
method(name: 'upstream', type: 'Object', params: [name: 'String', build_status: 'Object'])
method(name: 'pollSCM', type: 'String', params: [expr: 'String'])
method(name: 'bitbucketPush')
}
// Parameters can only contain
if (enclosingCall("parameters")) {
method(name: 'string', type: 'Object', namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'defaultValue', type: 'java.lang.String'), parameter(name: 'description', type: 'java.lang.String')])
method(name: 'booleanParam', type: 'Object', namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'defaultValue', type: 'java.lang.Boolean'), parameter(name: 'description', type: 'java.lang.String')])
method(name: 'choice', type: 'Object', namedParams: [parameter(name: 'choice', type: 'java.lang.String'), parameter(name: 'defaultValue', type: 'java.lang.Boolean'), parameter(name: 'description', type: 'java.lang.String')])
}
// Find the options!
if (enclosingCall("options")) {
method(name: 'buildDiscarder')
method(name: 'timestamps')
method(name: 'timeout', type: 'Object', namedParams: [parameter(name: 'time', type: 'java.lang.Integer'), parameter(name: 'unit', type: 'java.lang.String')])
}
// Inside stages can be, stage or stage('Name')
if (enclosingCall("stages")) {
method(name: 'stage', type: 'Object', params: [name: 'String', body: 'Closure'], doc: 'Stage')
method(name: 'stage', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'concurrency', type: 'java.lang.Integer'),], doc: 'Stage')
}
// Inside steps only steps
if (enclosingCall("stage")) {
method(name: 'agent', type: 'Object', params: [body: 'Closure'], doc: 'Label expression to select agents')
method(name: 'steps', type: 'Object', params: [body: 'Closure'], doc: 'Steps to execute on stage')
method(name: 'post', type: 'Object', params: [body: 'Closure'], doc: 'Post actions can be executed on a per-stage basis as well')
}
// Only inside steps
if (enclosingCall("steps") || enclosingCall("always") || enclosingCall("success") ||
enclosingCall("failure") || enclosingCall("unstable") || enclosingCall("changed")) {
method(name: 'timestamp', type: 'Object', params: [body: 'Closure'], doc: 'Timestamps')
method(name: 'bat', type: 'Object', params: [script: 'java.lang.String'], doc: 'Windows Batch Script')
method(name: 'bat', type: 'Object', namedParams: [parameter(name: 'script', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'), parameter(name: 'returnStatus', type: 'boolean'), parameter(name: 'returnStdout', type: 'boolean'),], doc: 'Windows Batch Script')
method(name: 'checkout', type: 'Object', params: [scm: 'Map'], doc: 'General SCM')
method(name: 'checkout', type: 'Object', namedParams: [parameter(name: 'scm', type: 'Map'), parameter(name: 'changelog', type: 'boolean'), parameter(name: 'poll', type: 'boolean'),], doc: 'General SCM')
method(name: 'deleteDir', type: 'Object', params: [:], doc: 'Recursively delete the current directory from the workspace')
method(name: 'dir', type: 'Object', params: [path: 'String', body: 'Closure'], doc: 'Change current directory')
method(name: 'fileExists', type: 'Object', params: [file: 'java.lang.String'], doc: 'Verify if file exists in workspace')
method(name: 'git', type: 'Object', params: [url: 'java.lang.String'], doc: 'Git')
method(name: 'git', type: 'Object', namedParams: [parameter(name: 'url', type: 'java.lang.String'), parameter(name: 'branch', type: 'java.lang.String'), parameter(name: 'changelog', type: 'boolean'), parameter(name: 'credentialsId', type: 'java.lang.String'), parameter(name: 'poll', type: 'boolean'),], doc: 'Git')
method(name: 'junit', type: 'Object', params: [testResults: 'java.lang.String'], doc: 'Archive JUnit-formatted test results')
method(name: 'junit', type: 'Object', namedParams: [parameter(name: 'testResults', type: 'java.lang.String'), parameter(name: 'allowEmptyResults', type: 'boolean'), parameter(name: 'healthScaleFactor', type: 'double'), parameter(name: 'keepLongStdio', type: 'boolean'), parameter(name: 'testDataPublishers', type: 'Map'),], doc: 'Archive JUnit-formatted test results')
method(name: 'load', type: 'Object', params: [path: 'java.lang.String'], doc: 'Evaluate a Groovy source file into the Pipeline script')
method(name: 'powershell', type: 'Object', params: [script: 'java.lang.String'], doc: 'PowerShell Script')
method(name: 'powershell', type: 'Object', namedParams: [parameter(name: 'script', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'), parameter(name: 'returnStatus', type: 'boolean'), parameter(name: 'returnStdout', type: 'boolean'),], doc: 'PowerShell Script')
method(name: 'publishHTML', type: 'Object', params: [target: 'Map'], doc: 'Publish HTML reports')
method(name: 'pwd', type: 'Object', params: [:], doc: 'Determine current directory')
method(name: 'pwd', type: 'Object', namedParams: [parameter(name: 'tmp', type: 'boolean'),], doc: 'Determine current directory')
method(name: 'readFile', type: 'Object', params: [file: 'java.lang.String'], doc: 'Read file from workspace')
method(name: 'readFile', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'),], doc: 'Read file from workspace')
method(name: 'sh', type: 'Object', params: [script: 'java.lang.String'], doc: 'Shell Script')
method(name: 'sh', type: 'Object', namedParams: [parameter(name: 'script', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'), parameter(name: 'returnStatus', type: 'boolean'), parameter(name: 'returnStdout', type: 'boolean'),], doc: 'Shell Script')
method(name: 'stash', type: 'Object', params: [name: 'java.lang.String'], doc: 'Stash some files to be used later in the build')
method(name: 'stash', type: 'Object', namedParams: [parameter(name: 'name', type: 'java.lang.String'), parameter(name: 'allowEmpty', type: 'boolean'), parameter(name: 'excludes', type: 'java.lang.String'), parameter(name: 'includes', type: 'java.lang.String'), parameter(name: 'useDefaultExcludes', type: 'boolean'),], doc: 'Stash some files to be used later in the build')
method(name: 'tm', type: 'Object', params: [stringWithMacro: 'java.lang.String'], doc: 'Expand a string containing macros')
method(name: 'unstash', type: 'Object', params: [name: 'java.lang.String'], doc: 'Restore files previously stashed')
method(name: 'validateDeclarativePipeline', type: 'Object', params: [path: 'java.lang.String'], doc: 'Validate a file containing a Declarative Pipeline')
method(name: 'wrap', type: 'Object', params: [delegate: Map, body: 'Closure'], doc: 'General Build Wrapper')
method(name: 'writeFile', type: 'Object', namedParams: [parameter(name: 'file', type: 'java.lang.String'), parameter(name: 'text', type: 'java.lang.String'), parameter(name: 'encoding', type: 'java.lang.String'),], doc: 'Write file to workspace')
method(name: 'archive', type: 'Object', params: [includes: 'java.lang.String'], doc: 'Advanced/Deprecated Archive artifacts')
method(name: 'archive', type: 'Object', namedParams: [parameter(name: 'includes', type: 'java.lang.String'), parameter(name: 'excludes', type: 'java.lang.String'),], doc: 'Archive artifacts')
method(name: 'dockerFingerprintFrom', type: 'Object', namedParams: [parameter(name: 'dockerfile', type: 'java.lang.String'), parameter(name: 'image', type: 'java.lang.String'), parameter(name: 'buildArgs', type: 'Map'), parameter(name: 'toolName', type: 'java.lang.String'),], doc: 'Record trace of a Docker image used in FROM')
method(name: 'unarchive', type: 'Object', params: [:], doc: 'Advanced/Deprecated Copy archived artifacts into the workspace')
method(name: 'unarchive', type: 'Object', namedParams: [parameter(name: 'mapping', type: 'Map'),], doc: 'Copy archived artifacts into the workspace')
method(name: 'withDockerContainer', type: 'Object', params: [image: 'String', body: 'Closure'], doc: 'Advanced/Deprecated Run build steps inside a Docker container')
method(name: 'withDockerContainer', type: 'Object', params: [body: Closure], namedParams: [parameter(name: 'image', type: 'java.lang.String'), parameter(name: 'args', type: 'java.lang.String'), parameter(name: 'toolName', type: 'java.lang.String'),], doc: 'Run build steps inside a Docker container')
method(name: 'withDockerRegistry', type: 'Object', params: [registry: Map, body: 'Closure'], doc: 'Advanced/Deprecated Sets up Docker registry endpoint')
method(name: 'withDockerServer', type: 'Object', params: [server: Map, body: 'Closure'], doc: 'Advanced/Deprecated Sets up Docker server endpoint')
method(name: 'parallel', type: 'Object', params: [body: 'Map'], doc: 'Run taask in parallel')
}
// Post actions!
if (enclosingCall("post")) {
method(name: 'always', type: 'Object', params: [body: 'Closure'])
method(name: 'success', type: 'Object', params: [body: 'Closure'])
method(name: 'failure', type: 'Object', params: [body: 'Closure'])
method(name: 'unstable', type: 'Object', params: [body: 'Closure'])
method(name: 'changed', type: 'Object', params: [body: 'Closure'])
}
}
}
// Define default env vars
def envVars = context(ctype: 'org.jenkinsci.plugins.workflow.cps.EnvActionImpl.Binder')
contributor(envVars) {
property(name: 'BRANCH_NAME', type: 'String', doc: 'For a multibranch project, this will be set to the name of the branch being built, for example in case you wish to deploy to production from master but not from feature branches; if corresponding to some kind of change request, the name is generally arbitrary (refer to CHANGE_ID and CHANGE_TARGET).')
property(name: 'CHANGE_ID', type: 'String', doc: 'For a multibranch project corresponding to some kind of change request, this will be set to the change ID, such as a pull request number, if supported; else unset.')
property(name: 'CHANGE_URL', type: 'Strig', doc: 'For a multibranch project corresponding to some kind of change request, this will be set to the change URL, if supported; else unset.')
property(name: 'CHANGE_TITLE', type: 'String', doc: 'For a multibranch project corresponding to some kind of change request, this will be set to the title of the change, if supported; else unset.')
property(name: 'CHANGE_AUTHOR', type: 'String', doc: 'For a multibranch project corresponding to some kind of change request, this will be set to the username of the author of the proposed change, if supported; else unset.')
property(name: 'CHANGE_AUTHOR_DISPLAY_NAME', type: 'String', doc: 'For a multibranch project corresponding to some kind of change request, this will be set to the human name of the author, if supported; else unset.')
property(name: 'CHANGE_AUTHOR_EMAIL', type: 'String', doc: 'For a multibranch project corresponding to some kind of change request, this will be set to the email address of the author, if supported; else unset.')
property(name: 'CHANGE_TARGET', type: 'String', doc: 'rFo a multibranch project corresponding to some kind of change request, this will be set to the target or base branch to which the change could be merged, if supported; else unset.')
property(name: 'BUILD_NUMBER', type: 'String', doc: 'The current build number, such as "153"')
property(name: 'BUILD_ID', type: 'String', doc: 'The current build ID, identical to BUILD_NUMBER for builds created in 1.597+, but a YYYY-MM-DD_hh-mm-ss timestamp for older builds')
property(name: 'BUILD_DISPLAY_NAME', type: 'String', doc: 'The display name of the current build, which is something like "#153" by default.')
property(name: 'JOB_NAME', type: 'String', doc: 'Name of the project of this build, such as "foo" or "foo/bar".')
property(name: 'JOB_BASE_NAME', type: 'String', doc: 'Short Name of the project of this build stripping off folder paths, such as "foo" for "bar/foo".')
property(name: 'BUILD_TAG', type: 'String', doc: 'String of "jenkins-${JOB_NAME}-${BUILD_NUMBER}". All forward slashes (/) in the JOB_NAME are replaced with dashes (-). Convenient to put into a resource file, a jar file, etc for easier identification.')
property(name: 'EXECUTOR_NUMBER', type: 'String', doc: 'The unique number that identifies the current executor (among executors of the same machine) that’s carrying out this build. This is the number you see in the "build executor status", except that the number starts from 0, not 1.')
property(name: 'NODE_NAME', type: 'String', doc: 'Name of the agent if the build is on an agent, or "master" if run on master')
property(name: 'NODE_LABELS', type: 'String', doc: 'Whitespace-separated list of labels that the node is assigned.')
property(name: 'WORKSPACE', type: 'String', doc: 'The absolute path of the directory assigned to the build as a workspace.')
property(name: 'JENKINS_HOME', type: 'String', doc: 'The absolute path of the directory assigned on the master node for Jenkins to store data.')
property(name: 'JENKINS_URL', type: 'String', doc: 'Full URL of Jenkins, like http://server:port/jenkins/ (note: only available if Jenkins URL set in system configuration)')
property(name: 'BUILD_URL', type: 'String', doc: 'Full URL of this build, like http://server:port/jenkins/job/foo/15/ (Jenkins URL must be set)')
property(name: 'JOB_URL', type: 'String', doc: 'Full URL of this job, like http://server:port/jenkins/job/foo/ (Jenkins URL must be set)')
}
// Definew all the properties in current builds
def currentBuild = context(ctype: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder')
contributor(currentBuild) {
method(name: 'resultIsBetterOrEqualTo', type: 'Boolean', params: [buildStatus: 'String'], doc: 'Compares the current build result to the provided result string (SUCCESS, UNSTABLE, or FAILURE) and returns true if the current build result is better than or equal to the provided result.')
method(name: 'resultIsWorseOrEqualTo', type: 'Boolean', params: [buildStatus: 'String'], doc: 'Compares the current build result to the provided result string (SUCCESS, UNSTABLE, or FAILURE) and returns true if the current build result is worse than or equal to the provided result.')
property(name: 'number', type: 'Integer', doc: 'build number')
property(name: 'result', type: 'String', doc: 'typically SUCCESS, UNSTABLE, or FAILURE (may be null for an ongoing build)')
property(name: 'currentResult', type: 'String', doc: 'typically SUCCESS, UNSTABLE, or FAILURE (never null)')
property(name: 'displayName', type: 'String', doc: 'normally #123 but sometimes set to, e.g., an SCM commit identifier')
property(name: 'description', type: 'String', doc: 'additional information about the build')
property(name: 'id', type: 'String', doc: 'normally number as a string')
property(name: 'timeInMillis', type: 'long', doc: 'time since the epoch when the build was scheduled')
property(name: 'startTimeInMillis', type: 'long', doc: 'time since the epoch when the build started running')
property(name: 'duration', type: 'long', doc: 'duration of the build in milliseconds')
property(name: 'durationString', type: 'String', doc: 'a human-readable representation of the build duration')
property(name: 'previousBuild', type: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder', doc: 'another similar object, or null')
property(name: 'nextBuild', type: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder', doc: 'another similar object, or null')
property(name: 'absoluteUrl', type: 'String', doc: 'URL of build index page')
property(name: 'buildVariables', type: 'Map', doc: 'for a non-Pipeline downstream build, offers access to a map of defined build variables; for a Pipeline downstream build, any variables set globally on env')
property(name: 'changeSets', type: 'String', doc: 'a list of changesets coming from distinct SCM checkouts; each has a kind and is a list of commits; each commit has a commitId, timestamp, msg, author, and affectedFiles each of which has an editType and path; the value will not generally be Serializable so you may only access it inside a method marked @NonCPS')
property(name: 'rawBuild', type: 'String', doc: 'a hudson.model.Run with further APIs, only for trusted libraries or administrator-approved scripts outside the sandbox; the value will not be Serializable so you may only access it inside a method marked @NonCPS')
}
@peteyan
Copy link

peteyan commented Sep 7, 2020

Very cooool : )

@jaydubb12
Copy link

@ranma2913 I've done some work on the same...and have resolved the problem some have faced with IntellJ where they get warnings / resolution issues within the .gdsl.

Thank you for your leadership and work on this topic.

I've also added several methods and properties, and published an example repo with a sample pipeline to illustrate it working
Screen Shot 2022-08-10 at 1 35 23 PM

Screen Shot 2022-08-10 at 1 35 23 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment