dbt · Arazzo Workflow

dbt Cloud Provision a Job in a Project Environment

Version 1.0.0

Resolve a project and one of its environments, then create a job bound to both.

1 workflow 1 source API 1 provider
View Spec View on GitHub Analytics EngineeringDataELTMetricsProjectsSQLTransformationArazzoWorkflows

Provider

dbt

Workflows

provision-job-in-environment
Create a job using the first available environment in the account.
Confirms the project, lists environments, picks the first environment id, and creates a job bound to the project and that environment.
3 steps inputs: accountId, executeSteps, jobName, projectId, token outputs: environmentId, jobId
1
confirmProject
getProject
Read the target project to confirm it exists.
2
listEnvironments
listEnvironments
List the account's environments and select the first one as the target environment for the new job.
3
createJob
createJob
Create a job in the confirmed project bound to the selected environment.

Source API Descriptions

Arazzo Workflow Specification

dbt-provision-job-in-environment-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: dbt Cloud Provision a Job in a Project Environment
  summary: Resolve a project and one of its environments, then create a job bound to both.
  description: >-
    Sets up a job without the caller needing to know an environment id up front.
    The workflow confirms the project exists, lists the account's environments
    and selects the first one, and then creates a job bound to that project and
    environment. 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: dbtAdminApi
  url: ../openapi/dbt-cloud-administrative-api-openapi.yml
  type: openapi
workflows:
- workflowId: provision-job-in-environment
  summary: Create a job using the first available environment in the account.
  description: >-
    Confirms the project, lists environments, picks the first environment id,
    and creates a job bound to the project and that environment.
  inputs:
    type: object
    required:
    - accountId
    - projectId
    - jobName
    - executeSteps
    - token
    properties:
      accountId:
        type: integer
        description: The dbt Cloud account id.
      projectId:
        type: integer
        description: The project the new job belongs to.
      jobName:
        type: string
        description: A display name for the new job.
      executeSteps:
        type: array
        description: The list of dbt commands the job runs.
        items:
          type: string
      token:
        type: string
        description: The dbt Cloud service token (sent as Authorization Bearer Token).
  steps:
  - stepId: confirmProject
    description: >-
      Read the target project to confirm it exists.
    operationId: getProject
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.token
    - name: accountId
      in: path
      value: $inputs.accountId
    - name: projectId
      in: path
      value: $inputs.projectId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      projectId: $response.body#/data/id
  - stepId: listEnvironments
    description: >-
      List the account's environments and select the first one as the target
      environment for the new job.
    operationId: listEnvironments
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.token
    - name: accountId
      in: path
      value: $inputs.accountId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      environmentId: $response.body#/data/0/id
    onSuccess:
    - name: environmentFound
      type: goto
      stepId: createJob
      criteria:
      - context: $response.body
        condition: $.data.length > 0
        type: jsonpath
    - name: noEnvironments
      type: end
      criteria:
      - context: $response.body
        condition: $.data.length == 0
        type: jsonpath
  - stepId: createJob
    description: >-
      Create a job in the confirmed project bound to the selected environment.
    operationId: createJob
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.token
    - name: accountId
      in: path
      value: $inputs.accountId
    requestBody:
      contentType: application/json
      payload:
        account_id: $inputs.accountId
        project_id: $steps.confirmProject.outputs.projectId
        environment_id: $steps.listEnvironments.outputs.environmentId
        name: $inputs.jobName
        execute_steps: $inputs.executeSteps
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      jobId: $response.body#/data/id
  outputs:
    environmentId: $steps.listEnvironments.outputs.environmentId
    jobId: $steps.createJob.outputs.jobId