Jenkins · Arazzo Workflow

Jenkins Trigger a Build and Await the Result

Version 1.0.0

Trigger a parameterless job, watch it leave the queue, and poll the build until it finishes.

1 workflow 1 source API 1 provider
View Spec View on GitHub AutomationBuild ServerCI/CDContinuous DeliveryContinuous IntegrationDevOpsOpen-SourceRemote Access APIArazzoWorkflows

Provider

jenkins

Workflows

trigger-build-and-await-result
Trigger a Jenkins job and block until the resulting build completes.
Reads the job to capture nextBuildNumber, triggers the build, confirms the queue accepted it, and polls the build until building is false. Note that nextBuildNumber is the number this build receives provided no other client triggers the same job concurrently; on busy shared jobs, follow the queue item URL returned in the trigger Location header instead.
4 steps inputs: jobName, token outputs: buildNumber, buildUrl, queueItemUrl, result
1
resolveJob
getJob
Read the job to confirm it exists, that it is buildable, and to capture the number the next build will be assigned.
2
triggerBuild
triggerBuild
Post the build trigger for the parameterless job. Jenkins responds 201 with a Location header pointing at the newly created queue item.
3
inspectQueue
getQueue
Read the build queue to confirm the trigger was accepted and to see whether the build is still waiting for an executor.
4
awaitBuild
getBuild
Poll the build resource until Jenkins reports it is no longer building, then capture the final result. Retries allow time for the build to leave the queue, start on an executor, and run to completion.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Jenkins Trigger a Build and Await the Result
  summary: Trigger a parameterless job, watch it leave the queue, and poll the build until it finishes.
  description: >-
    The canonical Jenkins Remote Access API integration. The workflow resolves
    the job to confirm it exists and is buildable and to capture the number the
    next build will receive, posts the build trigger, inspects the queue to
    confirm the request was accepted, and then polls the build resource until it
    is no longer building before reporting the final result. Every step spells
    out its request inline so the flow can be read and executed without opening
    the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: jenkinsApi
  url: ../openapi/jenkins-openapi.yml
  type: openapi
workflows:
- workflowId: trigger-build-and-await-result
  summary: Trigger a Jenkins job and block until the resulting build completes.
  description: >-
    Reads the job to capture nextBuildNumber, triggers the build, confirms the
    queue accepted it, and polls the build until building is false. Note that
    nextBuildNumber is the number this build receives provided no other client
    triggers the same job concurrently; on busy shared jobs, follow the queue
    item URL returned in the trigger Location header instead.
  inputs:
    type: object
    required:
    - jobName
    properties:
      jobName:
        type: string
        description: The name of the Jenkins job to build (e.g. "my-pipeline").
      token:
        type: string
        description: >-
          Optional remote build trigger token configured on the job, required
          when the job is set up for authenticated remote triggering.
  steps:
  - stepId: resolveJob
    description: >-
      Read the job to confirm it exists, that it is buildable, and to capture
      the number the next build will be assigned.
    operationId: getJob
    parameters:
    - name: jobName
      in: path
      value: $inputs.jobName
    - name: tree
      in: query
      value: name,buildable,inQueue,nextBuildNumber
    successCriteria:
    - condition: $statusCode == 200
    - context: $response.body
      condition: $.buildable == true
      type: jsonpath
    outputs:
      nextBuildNumber: $response.body#/nextBuildNumber
      buildable: $response.body#/buildable
  - stepId: triggerBuild
    description: >-
      Post the build trigger for the parameterless job. Jenkins responds 201
      with a Location header pointing at the newly created queue item.
    operationId: triggerBuild
    parameters:
    - name: jobName
      in: path
      value: $inputs.jobName
    - name: token
      in: query
      value: $inputs.token
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      queueItemUrl: $response.header.Location
  - stepId: inspectQueue
    description: >-
      Read the build queue to confirm the trigger was accepted and to see
      whether the build is still waiting for an executor.
    operationId: getQueue
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      queueItems: $response.body#/items
  - stepId: awaitBuild
    description: >-
      Poll the build resource until Jenkins reports it is no longer building,
      then capture the final result. Retries allow time for the build to leave
      the queue, start on an executor, and run to completion.
    operationId: getBuild
    parameters:
    - name: jobName
      in: path
      value: $inputs.jobName
    - name: buildNumber
      in: path
      value: $steps.resolveJob.outputs.nextBuildNumber
    - name: tree
      in: query
      value: number,building,result,duration,timestamp,url
    successCriteria:
    - condition: $statusCode == 200
    - context: $response.body
      condition: $.building == false
      type: jsonpath
    onFailure:
    - name: waitForBuildToFinish
      type: retry
      retryAfter: 10
      retryLimit: 60
    outputs:
      buildNumber: $response.body#/number
      result: $response.body#/result
      duration: $response.body#/duration
      buildUrl: $response.body#/url
  outputs:
    buildNumber: $steps.awaitBuild.outputs.buildNumber
    result: $steps.awaitBuild.outputs.result
    buildUrl: $steps.awaitBuild.outputs.buildUrl
    queueItemUrl: $steps.triggerBuild.outputs.queueItemUrl

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/jenkins-trigger-build-and-await-result-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.