Skip to content

Add preliminary job_runs resource#5603

Draft
radakam wants to merge 8 commits into
mainfrom
job-runs-resource
Draft

Add preliminary job_runs resource#5603
radakam wants to merge 8 commits into
mainfrom
job-runs-resource

Conversation

@radakam

@radakam radakam commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Changes

Add a job_runs bundle resource (direct engine). Deploying it triggers a job run via the Jobs RunNow API and stores the run id in state.

resources:
  job_runs:
    my_run:
      job_id: ${resources.jobs.my_job.id}

Includes the resource + direct CRUD, lifecycle config, generated schema/validation, run_as handling, acceptance tests, and updates to the resource-enumeration tests.

Because a run isn't a normal CRUD resource, a few deliberate choices:

  • Create = trigger (RunNow); the run id is the tracked identity.
  • No update: there's no API to modify a run, so all request fields are recreate_on_changes — changes re-trigger a fresh run.
  • No-op delete: a triggered run can't be "undeployed".
  • Ignore drift: GetRun never echoes the RunNow request, so request fields are ignore_remote_changes (write-only inputs).
  • run_as: RunNow has no run_as, so a differing bundle run_as is rejected early.

Closes DECO-27355.

(Waiting for completion + run URL are deferred to a later milestone.)

Why

Today, triggering a job as part of bundle deploy requires custom scripts outside the bundle. This project adds a resources.job_runs section to direct engine so users can declaratively run jobs as part of deployment — e.g. schema migrations, model training, data prep.

Tests

  • Acceptance: job_runs/basic (one run-now, run id stored, clean destroy) and job_runs/redeploy (recreate on job_parameters change).
  • TestAll/job_runs direct CRUD.
  • Updated/passing: run_as, permissions, target-mode, Terraform lifecycle, bind-support enumeration, workspace-URL completeness (job_runs added to noURL — no stable run URL yet), and StateToBundle enumeration tests.

@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 07:21 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 07:21 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 336177f

Run: 27553474693

Env 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 15 264 980 8:05
🟨​ aws windows 7 15 266 978 12:38
💚​ aws-ucws linux 7 15 360 894 8:40
💚​ aws-ucws windows 7 15 362 892 10:49
🔄​ azure linux 2 1 17 265 978 7:47
💚​ azure windows 1 17 269 976 8:35
💚​ azure-ucws linux 1 17 365 890 8:12
💚​ azure-ucws windows 1 17 367 888 10:18
💚​ gcp linux 1 17 263 981 6:34
💚​ gcp windows 1 17 265 979 9:20
24 interesting tests: 15 SKIP, 7 KNOWN, 2 flaky
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/grants/select 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestFetchRepositoryInfoAPI_FromRepo/root ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p
🔄​ TestFetchRepositoryInfoAPI_FromRepo/subdir ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p
Top 24 slowest tests (at least 2 minutes):
duration env testname
4:32 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:32 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
4:19 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
4:19 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:29 gcp windows TestAccept
3:29 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:28 azure-ucws windows TestAccept
3:23 azure windows TestAccept
3:17 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:17 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:16 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:13 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:11 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:09 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:02 aws-ucws windows TestAccept
3:00 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:58 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:57 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:54 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:51 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:39 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:38 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:36 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:30 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 10:55 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 10:55 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:01 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:01 — with GitHub Actions Inactive
@radakam radakam force-pushed the job-runs-resource branch from 63df005 to ff9faea Compare June 15, 2026 12:02
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:03 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:03 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:40 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:40 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:50 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 12:50 — with GitHub Actions Inactive
radakam added 6 commits June 15, 2026 13:24
Introduce the job_runs bundle resource backed by the Jobs RunNow API.
This is a preliminary skeleton: it wires up the config type, the direct
engine resource, registration, and drift handling. Generated schema,
validation output, and tests are intentionally left for follow-ups.
Run the schema generator for the new job_runs resource and add real
descriptions for the job_runs map, JobRun.lifecycle, and
JobRun.python_named_params so the required-annotations guard test passes.
Regenerate the validation rules so job_runs picks up its required field
(job_id) and the performance_target enum. Missing required fields surface
as warnings via the existing validate:required mutator.
Deploy a bundle with a job and a job_run referencing it, and assert that
exactly one RunNow request is made and the returned run id is stored in
state. Restricted to the direct engine since job_runs has no Terraform
equivalent.
Verify that changing a job_run's configuration re-triggers the run: after
the initial deploy, a config change (job_parameters) causes a second,
distinct RunNow request on redeploy via the recreate-on-change path.
Several reflection/enumeration tests iterate or hardcode the full resource
set and were not updated when the job_runs resource was added, leaving CI
red. Add job_runs to each: the run_as allResourceTypes list, the permissions
unsupportedResources list, the target-mode mock bundle, the Terraform
lifecycle skip list (direct-only), a bind fixture + GetRun mock, and a direct
CRUD fixture that triggers a run against a newly created job. The CRUD test
also treats job_runs as a no-op delete, since a triggered run cannot be
undeployed and stays readable afterward.
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 13:24 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 13:24 — with GitHub Actions Inactive
@radakam radakam force-pushed the job-runs-resource branch from a899c09 to 3fb23a7 Compare June 15, 2026 13:24
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 13:25 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 13:25 — with GitHub Actions Inactive
Fully populate the GetRunRequest and JobRunRemote literals in job_run.go to
satisfy exhaustruct, and regenerate the schema/refschema/apitypes artifacts so
the committed job_runs generated files match their generators.
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 13:45 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 13:45 — with GitHub Actions Inactive
Add job_runs coverage to the two reflection-driven completeness tests:
add "job_runs" to the noURL set in TestBundleResourcePluralNamesResolveInWorkspaceURLs
(no stable workspace URL yet) and exercise Resources.JobRuns in the
StateToBundle test suite.
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 14:29 — with GitHub Actions Inactive
@radakam radakam temporarily deployed to test-trigger-is June 15, 2026 14:29 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants