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

step([$class: 'RemoteBuildConfiguration']): Trigger a remote parameterized job

  • abortTriggeredJob : boolean (optional)
  • auth2 (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.
    • Bearer Authentication
      The bearer token is used.
    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
    • BearerTokenAuth
      • token (optional)
        • Type: class hudson.util.Secret
    • CredentialsAuth
      • credentials : String (optional)
    • NoneAuth
      • NullAuth
        • TokenAuth
          • apiToken (optional)
            • Type: class hudson.util.Secret
          • userName : String (optional)
      • blockBuildUntilComplete : boolean (optional)
      • disabled : boolean (optional)
        Set this field to disable the job step instead of removing it from job configuration.
      • enhancedLogging : boolean (optional)
        Enable Enhanced Logging
        If this option is enabled, the console output of the remote job is also logged.
      • httpGetReadTimeout : int (optional)
      • httpPostReadTimeout : int (optional)
      • job : String (optional)
        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.
      • maxConn : int (optional)
        The max concurrent connections to the remote host, default is 1, max is 5. It'll be 5 even if you set it greater than 5. Note: Set this field with caution, too many concurrent requests will not only fail your local jobs,
        but also block the remote server.
      • overrideTrustAllCertificates : boolean (optional)
      • parameters : String (optional)
      • parameters2 (optional)
        Job Parameters
        Parameters which will be used when triggering the remote job.
        If no parameters are needed, then just leave this blank.
        • Map parameters
          This is the recommended type. It allows you to provide parameters with key/value and supports multi-line parameters.
        • String parameters (legacy)
          This type allows to describe parameters within a big string like in versions 3.1.5 and lower. It does not support multi-line parameters.
        • File parameters (legacy)
          This type allows to describe parameters within a file like in versions 3.1.5 and lower. It does not support multi-line parameters.
          Nested Choice of Objects
        • FileParameters
          • filePath : String (optional)
        • MapParameters
          • parameters (optional)
              Array / List of Nested Object
            • name : String (optional)
            • value : String (optional)
        • StringParameters
          • parameters : String (optional)
      • pollInterval : int (optional)
      • preventRemoteBuildQueue : boolean (optional)
      • remoteJenkinsName : String (optional)
      • remoteJenkinsUrl : String (optional)
        It is possible to override the Remote Jenkins URL for each Job separately.
      • shouldNotFailBuild : boolean (optional)
        Do Not Fail If Remote Fails
        If this option is enabled, the build will not fail even if the remote build fails.
      • token : String (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
      • trustAllCertificates : boolean (optional)
        Trust all certificates

        It is possible to override/rewrite the 'Trust all certificate'-setting for each Job separately. Setting this checkbox to 'true' will result in accepting all certificates for the given Job.

        If your remote Jenkins host has a self-signed certificate or its certificate is not trusted, you may want to enable this option. It will accept untrusted certificates for the given host.

        This is unsafe and should only be used for testing or if you trust the host.

      • useCrumbCache : boolean (optional)
        Set this field to enable cache of the crumb of remote server.
        It'll be more efficient for the local job execution & more stable for remote server when massive concurrent jobs are triggered.
        This cache will be cleared every 10 minutes.
      • useJobInfoCache : boolean (optional)
        Set this field to enable cache of the job info of remote server.
        It'll be more efficient for the local job execution & more stable for remote server when massive concurrent jobs are triggered.
        This cache will be cleared every 10 minutes.

      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 : String
        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

      • abortTriggeredJob : boolean (optional)
      • 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
        • BearerTokenAuth
          • token (optional)
            • Type: class hudson.util.Secret
        • CredentialsAuth
          • credentials : String (optional)
        • NoneAuth
          • NullAuth
            • TokenAuth
              • apiToken (optional)
                • Type: class hudson.util.Secret
              • userName : String (optional)
          • blockBuildUntilComplete : boolean (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

          • disabled : boolean (optional)
            Set this field to disable the job step instead of removing it from job configuration.
          • enhancedLogging : boolean (optional)
            Enable Enhanced Logging
            If this option is enabled, the console output of the remote job is also logged.

            mandatory: no
            default: false

          • httpGetReadTimeout : int (optional)
          • httpPostReadTimeout : int (optional)
          • maxConn : int (optional)
            The max concurrent connections to the remote host, default is 1, max is 5. It'll be 5 even if you set it greater than 5. Note: Set this field with caution, too many concurrent requests will not only fail your local jobs,
            but also block the remote server.
          • overrideTrustAllCertificates : boolean (optional)
          • parameterFile : String (optional)
          • parameters : Object (optional)
            Job Parameters
            Parameters which will be used when triggering the remote job.
            If no parameters are needed, then just leave this blank.
            In case of a String, the plugin uses String/File parameters depending on the parameter's content.
            • Map parameters

              Map<String, Object>

              This is the recommended type. It allows you to provide parameters with key/value and supports multi-line parameters.

            • String parameters (legacy)

              String

              This type allows to describe parameters within a big string like in versions 3.1.5 and lower. It does not support multi-line parameters.

            • File parameters (legacy)

              String

              This type allows to describe parameters within a file like in versions 3.1.5 and lower. It does not support multi-line parameters.
          • pollInterval : int (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

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

            mandatory: no
            default: false

          • remoteJenkinsName : String (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

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

            mandatory: no

          • shouldNotFailBuild : boolean (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

          • token : String (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: ""

          • trustAllCertificates : boolean (optional)
            Trust all certificates

            It is possible to override/rewrite the 'Trust all certificate'-setting for each Job separately. Setting this checkbox to 'true' will result in accepting all certificates for the given Job.

            If your remote Jenkins host has a self-signed certificate or its certificate is not trusted, you may want to enable this option. It will accept untrusted certificates for the given host.

            This is unsafe and should only be used for testing or if you trust the host.

          • useCrumbCache : boolean (optional)
            Set this field to enable cache of the crumb of remote server.
            It'll be more efficient for the local job execution & more stable for remote server when massive concurrent jobs are triggered.
            This cache will be cleared every 10 minutes.
          • useJobInfoCache : boolean (optional)
            Set this field to enable cache of the job info of remote server.
            It'll be more efficient for the local job execution & more stable for remote server when massive concurrent jobs are triggered.
            This cache will be cleared every 10 minutes.

          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.