To start create a new Bolt schedule and make sure to add the deferred_schedule configuration. Depending on your intended behavior you can choose to defer to another production job or defer back to the last CD run.
The deferred_schedule_name set in the configuration should have at least one successful run available, so that Paradime can pick the manifest.json for state comparison.
Example schedule
... - name:continuous_deployment_run# the name of your CD jobdeferred_schedule:enabled:true# true to enabled this Turbo CI job to run on pull requestdeferred_schedule_name:continuous_deployment_run#the name of the bolt schedule where the CD job will look for the most recent successful run manifest.json for state comparisonschedule:"OFF"# set the schedule configuration to not run on a schedule (to be used for PR only)environment:production#the environment used to run the schedule -> this is always productioncommands: - dbt run --select state:modified+#the dbt™️ command you want to run after the pull request is mergedowner_email:"john@acme.io"#the email of the CD job owner_email...
Generate API keys and find you workspace token
API keys are generate at a workspace level.
To be able to trigger Bolt using the API, you will first need to generate API keys for your workspace. Got to account settings and generate your API keys, make sure to save in your password manager:
API key
API secret
API Endpoint
You will need this later when setting up the secret in GitLab pipelines.
GitLab merged results pipelines is a feature available only on Tier: Premium, Ultimate. Make sure to enable merge results pipelines in GitLab before proceeding to next step.
Now you will need to create a new .gitlab-ci.yml file at the root of your project your dbt™️ repository. Copy the code block below and enter the values required.
Example GitLab pipelines configuration file
.gitlab-ci.yml
# Define the stages of the pipeline. In this case, we only have one stagestages: - paradime_continuous_deployment# Main job definitionparadime_continuous_deployment:# Specify which stage this job belongs tostage:paradime_continuous_deployment# Use Python 3.11 as the base Docker image for this jobimage:python:3.11# Define when this pipeline should be triggeredrules:# This job will only run when all these conditions are met:# - CI_PIPELINE_SOURCE == "merge_request_event": Triggered by a merge request# - CI_MERGE_REQUEST_EVENT_TYPE == "merged": The merge request is being merged# - CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main": The target branch is 'main' - if:'$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_EVENT_TYPE == "merged" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'# Define environment variables needed for the jobvariables:# These variables should be configured in GitLab CI/CD settings as protected variablesPARADIME_API_KEY:${PARADIME_API_KEY}# API key for Paradime authenticationPARADIME_API_SECRET:${PARADIME_API_SECRET}# API secret for Paradime authenticationPARADIME_API_ENDPOINT:${PARADIME_API_ENDPOINT}# Paradime API endpoint URLPARADIME_SCHEDULE_NAME:"continuous_deployment_run"# Name of the Paradime schedule to run# Commands to run before the main scriptbefore_script:# Install the Paradime Python SDK - pip install paradime-io==4.7.1# Check for latest version of the Paradime Python SDK on https://github.com/paradime-io/paradime-python-sdk/releases# Main script to execute# Run the Paradime bolt schedule with the specified name# The --wait flag makes the script wait for the schedule to completescript:| paradime bolt run "$PARADIME_SCHEDULE_NAME" --wait# Set a timeout of 60 minutes for this job# If the job hasn't completed within this time, it will be terminatedtimeout:60 minutes
Add the API key and Credential in the GitLab variables
Finally you need to add the API key and credentials generated in the previous step in GitLab CI/CD pipelines.
Set the corresponding values using your credentials for the variable names: