refined-cat-61929
04/29/2025, 9:21 PMdocker run -v ) because there's just no way to customize docker running for environments.
This is somewhat related to https://github.com/pantsbuild/pants/issues/18577, but in this case, we need to customize the docker run args, not the environment variable passed to the docker run command.
My question is: is my understanding of the limitations correct? Am I missing some other way to do what we want? And if my understanding is correct, and there is no other way, should I open up a feature request for this?broad-processor-92400
05/01/2025, 4:32 AMdocker exec --env ... some-container /path/to/the/command ... or similar).refined-cat-61929
05/01/2025, 3:54 PMGOOGLE_APPLICATION_CREDENTIALS is expected to point to a credentials file, not the credentials themselves, so it'd be a bit hacky to take in another environment variable, write it to the file system, then point to that with GOOGLE_APPLICATION_CREDENTIALS.refined-cat-61929
05/01/2025, 3:55 PMcurved-manchester-66006
05/01/2025, 4:05 PMservices:
cl_hello_world:
image: foo/bar-dagster-hello-world:localdev
container_name: cl_hello_world
restart: always
environment:
DAGSTER_POSTGRES_USER: "postgres"
which injects env vars. And then for integration tests that need cloud credentials we do something like:
@pytest.fixture(scope="session", autouse=True)
def aws_credentials():
with my_corp_test_helpers.aws_credentials(
"arn:aws:iam::123234234:role/foo-telemetry-ingest-role"
):
yield
However, I don't think we have a case where we inject aws creds into a docker container. If the compose+pyest pattern works for you I think you could do something like
- type: bind
source: '${HOME}/.aws'
target: '/root/.aws'
consistency: 'cached'refined-cat-61929
05/01/2025, 5:10 PMcurved-manchester-66006
05/01/2025, 5:27 PMdocker compose + pytest.We use https://pypi.org/project/pytest-docker/
refined-cat-61929
05/01/2025, 5:29 PMpants test?curved-manchester-66006
05/01/2025, 5:34 PMfresh-mechanic-68429
05/02/2025, 10:55 PMrefined-cat-61929
05/06/2025, 3:08 PMpytest-docker brought up and down the docker container, though). I was a bit confused at first, though - this doesn't run tests in a docker container like Pants does, it just sets up Docker containers for dependencies, which is useful, but also we're using Github workflows, which already do this. So I just switched to doing the equivalent thing in workflows, which worked. This solution, though, has the advantage of tests being more standardized between developer and Github workflows.victorious-dress-47449
06/16/2025, 6:38 PMrefined-cat-61929
06/16/2025, 7:16 PMvictorious-dress-47449
06/16/2025, 7:19 PMconftest.py file to write the secret files when setting up the tests. For dev I'm jsut generating dummy values but I think I could use google secrets manager client for integration tests.refined-cat-61929
06/16/2025, 7:29 PMvictorious-dress-47449
06/16/2025, 7:31 PMrefined-cat-61929
06/16/2025, 7:31 PMvictorious-dress-47449
06/16/2025, 8:27 PM[test]
extra_env_vars = [
"key=%(env.VAR)s"
]
I guess you could either pass in all the keys this way or pass in the credentials for gcloud and then set up the secret files using the gcloud client.refined-cat-61929
06/16/2025, 8:28 PMvictorious-dress-47449
06/16/2025, 8:34 PMrefined-cat-61929
06/16/2025, 9:08 PMvictorious-dress-47449
06/16/2025, 9:20 PMrefined-cat-61929
06/16/2025, 9:23 PMvictorious-dress-47449
06/16/2025, 10:57 PM