The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Inedo BuildMaster Plugin.

buildMasterCreateBuild: Create BuildMaster Build

Creates a new build for the selected BuildMaster application and sets the BUILDMASTER_BUILD_NUMBER environment variable with the value returned from BuildMaster for the new build.

If your Jenkins job has produced artifacts to be loaded into BuildMaster, you have the following options to import the artifacts into BuildMaster:

  1. Use BuildMasters Jenkins Extensions 'Jenkins::Import-Artifact' statement to import artifacts directly from Jenkins
  2. Use BuildMasters 'Create-Artifact' statement to import files from a folder that you've placed the artifacts into from the Jenkins build (eg using ArtifactDeployer Plugin)
  3. Use an external artifact repository such as Nexus, Artifactory or ProGet

Note: Jenkins declarative pipeline script has a somewhat restricted syntax, so to return the build number you need to wrap this in a script block. You only need to do this if you wish to use the build number in a later step. For more information see: https://jenkins.io/doc/book/pipeline/syntax/#script

script {
    BUILDMASTER_BUILD_NUMBER = buildMasterCreateBuild(applicationId: BUILDMASTER_APPLICATION_ID', releaseNumber: BUILDMASTER_RELEASE_NUMBER, buildVariables: 'hello=world', deployToFirstStage: [waitUntilCompleted: true])
}
  • applicationId

    The identifier of the BuildMaster application to trigger the build for.

    Options are:

    • The BUILDMASTER_APPLICATION_ID variable populated by a previous step
    • An application id
    • An application name
    • Type: String
  • releaseNumber

    The BuildMaster release number to trigger the build for. Options are:

    • BUILDMASTER_RELEASE_NUMBER: variable populated by a previous step
    • Latest Active Release: will automatically get the latest active release number from BuildMaster for the selected application
    • [Release Number]: a release number from the list of active releases

    The job will fail if there is no active BuildMaster release.

    • Type: String
  • deployToFirstStage (optional)
    Will trigger the deployment to the first stage, and any subsequent stages where the stage is configured to automatically deploy to the next stage.
      Nested Object
    • waitUntilCompleted
      If checked waits until BuildMaster has completed the deployment, otherwise will exits immediately after triggering the deployment to the first stage.
      • Type: boolean
    • printLogOnFailure (optional)
      If checked will print the BuildMaster log for the deployment to the Jenkins console if the build fails - but only if the "Wait until deployment completed" option is also checked.
      • Type: boolean
  • variables (optional)

    Provide a list of variables to pass to the build.

    • A variable must be in the format "variable=value"
    • Additional variables must be declared on separate lines
    • Lines starting with # are treated as comments
    • When using pipeline script and you want to pass several variables use one of these formats:
      • Separate variables using newline character. Generated script will resemble: variables: 'var1=one\nvar2=two'
      • Separate variables using multi-line string. Generated script will resemble: variables: '''var1=one
        var2=two'''
    • Type: String

step([$class: 'CreateBuildBuilder']): Create BuildMaster Build

Creates a new build for the selected BuildMaster application and sets the BUILDMASTER_BUILD_NUMBER environment variable with the value returned from BuildMaster for the new build.

If your Jenkins job has produced artifacts to be loaded into BuildMaster, you have the following options. The choice is largely dependent on how you import the build artifacts into BuildMaster:

  1. Use BuildMasters Jenkins Extensions 'Jenkins::Import-Artifact' statement to import artifacts directly from Jenkins: the post build action is required
  2. Use BuildMasters 'Create-Artifact' statement to import files from a folder that you've placed the artifacts into from the Jenkins build (eg using ArtifactDeployer Plugin): either the post build or build step actions will be fine
  3. Use an external artifact repository such as Nexus, Artifactory or ProGet: either the post build or build step actions will be fine
  • applicationId

    The identifier of the BuildMaster application to trigger the build for.

    Options are:

    • The BUILDMASTER_APPLICATION_ID variable populated by a previous step
    • An application
    • Type: String
  • releaseNumber

    The BuildMaster release number to trigger the build for. Options are:

    • BUILDMASTER_RELEASE_NUMBER: variable populated by a previous step
    • Latest Active Release: will automatically get the latest active release number from BuildMaster for the selected application
    • [Release Number]: a release number from the list of active releases

    The job will fail if there is no active BuildMaster release.

    • Type: String
  • deployToFirstStage (optional)
    Will trigger the deployment to the first stage, and any subsequent stages where the stage is configured to automatically deploy to the next stage.
      Nested Object
    • waitUntilCompleted
      If checked waits until BuildMaster has completed the deployment, otherwise will exits immediately after triggering the deployment to the first stage.
      • Type: boolean
    • printLogOnFailure (optional)
      If checked will print the BuildMaster log for the deployment to the Jenkins console if the build fails - but only if the "Wait until deployment completed" option is also checked.
      • Type: boolean
  • variables (optional)

    Provide a list of variables to pass to the build.

    • A variable must be in the format "variable=value"
    • Additional variables must be declared on separate lines
    • Lines starting with # are treated as comments
    • When using pipeline script and you want to pass several variables use one of these formats:
      • Separate variables using newline character. Generated script will resemble: variables: 'var1=one\nvar2=two'
      • Separate variables using multi-line string. Generated script will resemble: variables: '''var1=one
        var2=two'''
    • Type: String

buildMasterDeployBuildToStage: Deploy BuildMaster Build To Stage

Deploys (or re-deploys) a build to a particular stage.

Note: that when used in a pipeline step that the applicationId, releaseNumber, and buildNumber fields are required:

buildMasterDeployBuildToStage(applicationId: BUILDMASTER_APPLICATION_ID, releaseNumber: BUILDMASTER_RELEASE_NUMBER, buildNumber: BUILDMASTER_BUILD_NUMBER)
  • applicationId

    The identifier of the BuildMaster application to trigger the build for.

    Options are:

    • The BUILDMASTER_APPLICATION_ID variable populated by a previous step
    • An application id
    • An application name
    • Type: String
  • releaseNumber

    The BuildMaster release number to trigger the build for. Options are:

    • BUILDMASTER_RELEASE_NUMBER: variable populated by a previous step
    • Latest Active Release: will automatically get the latest active release number from BuildMaster for the selected application
    • [Release Number]: a release number from the list of active releases

    The job will fail if there is no active BuildMaster release.

    • Type: String
  • buildNumber

    The BuildMaster build number to trigger the deployment for.

    The must be set to an existing build number. Typically this would be obtained from the output of the createBuild step which populates the BUILDMASTER_BUILD_NUMBER environment variable.

    • Type: String
  • force (optional)
    Force deployment into the stage, even if a previous stage has failed.
    • Type: boolean
  • printLogOnFailure (optional)
    If checked will print the BuildMaster log for the deployment to the Jenkins console if the build fails - but only if the "Wait until deployment completed" option is also checked.
    • Type: boolean
  • stage (optional)

    Optional. If not supplied, the next stage in the pipeline will be used.

    • Type: String
  • variables (optional)

    Set deployment level variables.

    • Type: String
  • waitUntilCompleted (optional)
    If checked waits until BuildMaster has completed the deployment, otherwise will exits immediately after triggering the deployment. Defaults to checked.
    • Type: boolean

buildMasterWithApplicationRelease: Inject BuildMaster release details as environment variables

Obtains the Release and Build numbers for the selected BuildMaster application from BuildMaster and injects the following environment variables into the build job:

  • BUILDMASTER_APPLICATION_ID
  • BUILDMASTER_APPLICATION_NAME
  • BUILDMASTER_RELEASE_NUMBER
  • BUILDMASTER_LATEST_BUILD_NUMBER
  • BUILDMASTER_NEXT_BUILD_NUMBER

If you do not use these values in your build steps there is no requirement to use this task.

Note: If you have multiple jobs all triggering builds on the same BuildMaster application this task will queue those jobs so that you cannot get two jobs triggering a build at the same time.

When used within pipeline script this wraps a block and injects the above variables. Note that the applicationId parameter can contain either the id or name of a BuildMaster application.

buildMasterWithApplicationRelease('TestApplication') {
  echo """
    Application id = $BUILDMASTER_APPLICATION_ID
    Release Number = $BUILDMASTER_RELEASE_NUMBER
    Build Number = $BUILDMASTER_BUILD_NUMBER
  """
}
  • applicationId
    Select the BuildMaster application to populate environment variables for.
    • Type: String
  • releaseNumber (optional)

    Select the BuildMaster release to populate environment variables for:

    • Latest Active Release: will automatically get the latest active release number from BuildMaster for the selected application
    • [Release Number]: a release number from the list of active releases
    • Type: String

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.