Brian Pohl
05/11/2023, 9:23 PMos.environ
as long as the code is inside an op.
The series of hoops I’ve jumped through work, but I’ve finally run into a scenario where this doesn’t cut it. I want to use an environment variable to construct a string, which gets set in my job config (it’s the dbt target). If I didn’t need to do any string transformations, I could set resources: dbt: config: target: env: MY_ENV_VARIABLE
, but because I need to modify it, I am forced to do this in my Python scripts. And my Python scripts can only access environment variables during op runtime…
So, if I had build args during the build, I could turn all my ARGs into ENVs in the Dockerfile. I could cut Pulumi out of this whole process - passing variables from CI/CD straight into Dagster - and simplify a lot of my Python that today is restricted by only having access to environment variables at runtime.Sean Lopp
05/11/2023, 9:55 PMdocker/build-push-action
. The docs are in review but here is a working example: https://github.com/dagster-io/hooli-data-eng-pipelines/blob/master/.github/workflows/deploy-dagster-cloud.yml
Having full control of the build-push-action
should let you build with whatever env vars you want in your image
You can deploy this workflow in a branch as well. Note this workflow replaces two yaml files with one since it combines branch and prod deploys into the same workflow.Brian Pohl
05/11/2023, 9:58 PMShalabh Chaturvedi
05/11/2023, 10:01 PMci-init
step runs the dagster-cloud ci init
command which inspects the github context. if it is running in a PR (specifically, if HEAD_REF is present) then it determines the branch deployment name by using the dagster cloud API. this is recorded in the build session and used for all subsequent steps.Shalabh Chaturvedi
05/11/2023, 10:07 PMGITHUB_EVENT_PATH
and look for the pull_request
key. this is only present for pull requests. docs.Brian Pohl
05/11/2023, 11:26 PMShalabh Chaturvedi
05/11/2023, 11:29 PM@v0.1.27
in the example above with @v0.1
so you track any future fixes. let us know if you run into any issues.Brian Pohl
05/11/2023, 11:30 PM