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.

Parameterized Remote Trigger Plugin

triggerRemoteJob: Trigger Remote Job

The `triggerRemoteJob` pipeline step triggers a job on a remote Jenkins.
The full documentation is available in GitHub.

Example:
//Trigger remote job
def handle = triggerRemoteJob(remoteJenkinsName: 'remoteJenkins', job: 'RemoteJob')

//Get information from the handle
def status = handle.getBuildStatus()
def buildUrl = handle.getBuildUrl()
echo buildUrl.toString() + " finished with " + status.toString()

//Download and parse the archived "build-results.json" (if generated and archived by remote build)
def results = handle.readJsonFileFromBuildArchive('build-results.json')
echo results.urlToTestResults //only example


//List other available methods
echo handle.help()
  • job
    Remote Job Name or full URL.
    The name or URL of the job on the remote Jenkins host which you would like to trigger. If the full job URL is specified the URL of the remote Jenkins host configured above will be ignored.

    mandatory: yes

    • Type: String
  • auth (optional)
    Using this parameter you can override the authentication used to connect to the selected remote Jenkins.
    • Don't Override
      The authentication configured in the (global) settings of the selected 'remote host' is used.
    • Token Authentication
      The specified user id and Jenkins API token is used.
    • Credentials Authentication
      The specified Jenkins Credentials are used. This can be either user/password or user/API Token.
    • No Authentication
      No Authorization header will be sent, independent of the global 'remote host' settings.
    Note: Jenkins API Tokens are recommended since, if stolen, they allow access only to a specific Jenkins while user and password typically provide access to many systems.
      Nested Choice of Objects
    • CredentialsAuth
      • credentials (optional)
        • Type: String
    • NoneAuth
      • NullAuth
        • TokenAuth
          • apiToken (optional)
            • Type: String
          • userName (optional)
            • Type: String
      • blockBuildUntilComplete (optional)
        Wait/Block Until Remote Build Complete
        If enabled the remote job is called synchronously and the plugin waits until the remote job finished.
        If disabled the plugin triggers the remote job and returns.

        In both cases a handle is returned for further tracking the remote job or getting the results (see plugin main help page).

        mandatory: no
        default: true

        • Type: boolean
      • enhancedLogging (optional)
        Enable Enhanced Logging
        If this option is enabled, the console output of the remote job is also logged.

        mandatory: no
        default: false

        • Type: boolean
      • loadParamsFromFile (optional)
        • Type: boolean
      • parameterFile (optional)
        • Type: String
      • parameters (optional)
        Job Parameters
        Parameters which will be used when triggering the remote job.
        If no parameters are needed, then just leave this blank.
        Any line start with a pound-sign (#) will be treated as a comment.
        • Type: String
      • pollInterval (optional)
        Polling Interval
        The plugin identifies the status of the remote build by polling. Here you can specify how often the plugin shall poll the remote status.
        Be aware that polling too often might cause an increased load on the remote Jenkins.

        mandatory: no
        default: 10

        • Type: int
      • preventRemoteBuildQueue (optional)
        Prevent Remote Build Queue
        Wait to trigger remote builds until no other builds are running.

        mandatory: no
        default: false

        • Type: boolean
      • remoteJenkinsName (optional)
        Remote Jenkins Name
        The name of the remote Jenkins as configured in the Jenkins global configuration (Manage Jenkins > Configure System > Parameterized Remote Trigger Configuration > Remote Hosts).

        mandatory: yes

        • Type: String
      • remoteJenkinsUrl (optional)
        It is possible to override the Remote Jenkins URL for each Pipeline separately.

        mandatory: no

        • Type: String
      • shouldNotFailBuild (optional)
        Do Not Fail If Remote Fails
        If this option is enabled, the build will not fail even if the remote build fails.

        mandatory: no
        default: false

        • Type: boolean
      • token (optional)
        Remote Job Token
        Security token which is defined on the job of the remote Jenkins host.
        If no job token is needed to trigger this job, then just leave it blank

        mandatory: no
        default: ""

        • 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.