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: environmentsApi
url: ../openapi/dbt-environments-api-openapi.yml
type: openapi
- name: jobsApi
url: ../openapi/dbt-jobs-api-openapi.yml
type: openapi
- name: projectsApi
url: ../openapi/dbt-projects-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
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.