Re-run Slim CI on dbt Cloud

The problem I’m having

We have moved from dbt Core on GitLab runners to a dbt Cloud Slim CI job targeting a tst environment. When we click Rerun on the Slim CI job in dbt Cloud, the run fails at parse time with a missing environment variable error for DBT_CLOUD_PR_ID. This variable is used in our generate_schema_name macro to suffix schemas with the merge request number (for example, <schema_name>_<mr_number>).

Here is the relevant extract from generate_schema_name.sql:

{% if target.name == 'tst' and env_var('DBT_CLOUD_PR_ID',none) is not none %}
    {% if custom_schema_name is not none %}
        {{ return(custom_schema_name ~ '_' ~ env_var('DBT_CLOUD_PR_ID',none) | lower) }}
    {% else %}
        {{ return(split_name[0] ~ '_' ~ env_var('DBT_CLOUD_PR_ID',none) | lower) }}
    {% endif %}
{% endif %}

If the Slim CI job is triggered by opening a merge request, or by commits to an open merge request, DBT_CLOUD_PR_ID is present and the run succeeds.

If we click Rerun on the Slim CI job, DBT_CLOUD_PR_ID is absent and the run fails during parsing.

Questions:

  • Is there a supported way to rerun a Slim CI job in dbt Cloud without committing to an open merge request?

  • Can the Rerun action (UI or API) be configured to pass a value for DBT_CLOUD_PR_ID, or to simulate MR context for the purposes of Slim CI?

The context of why I’m trying to do this

We want to re‑run the Slim CI job without pushing a new commit to the open merge request, for example to test an incremental model load. Previously, on GitLab we could manually re‑run the pipeline to re‑execute the dbt Core job.

What I’ve already tried

  • Confirmed that Slim CI runs triggered by merge request events include DBT_CLOUD_PR_ID, while manual Rerun does not.

  • Guarded the macro with a default (env_var('DBT_CLOUD_PR_ID', none)) and a tst‑only condition, as shown above.

  • Searched for a way to supply or override environment variables specifically for a Rerun, but have not found anything that applies to Slim CI reruns.

Some example code or error messages

03:08:04  Running dbt...
03:08:05  Unable to do partial parsing because saved manifest not found. Starting full parse.
03:08:06  Encountered an error:
Parsing Error
  Env var required but not provided: 'DBT_CLOUD_PR_ID'
dbt command failed