-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
airbyte-ci: Pass env vars to poetry container in test command #34288
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Apply Sweep Rules to your PR?
This is an automated message generated by Sweep AI. |
@aaronsteers we can use this to pass the GCM credentials to the airbyte-lib test to download secrets for integration tests using external resources. |
Fixing PR: track the progress here.I'm currently fixing this PR to address the following: [Sweep GHA Fix] The GitHub Actions run failed with the following error logs:
An error has occurred: Cmd('git') failed due to: exit code(128) |
Fixing PR: track the progress here.I'm currently fixing this PR to address the following: [Sweep GHA Fix] The GitHub Actions run failed with the following error logs:
An error has occurred: Cmd('git') failed due to: exit code(128) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement!
I'm wondering what the more convenient:
- Explicitly passing env var like in
docker run
with--env MY_ENV_VAR='my-value'
- Passing already set env vars
1 has the benefit of not pre-setting the env var on your host
2 has the benefit of not passing secret as CLI input
Please bump the package version in pyproject.toml
and README.md
.
for var in pipeline_context.params["pass_env_var"]: | ||
secret = dagger_client.set_secret(var, os.environ[var]) | ||
test_container = test_container.with_secret_variable(var, secret) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set this at a more higher level during container declaration?
Let's say we want to override DOCKER_VERSION
or if poetry install
behavior depends on some env var value? The drawback of setting this earlier is that it'll clear downstream layers (re-running poetry install on env var changes).
@@ -44,6 +52,13 @@ async def run_poetry_command(container: dagger.Container, command: str) -> Tuple | |||
help="The poetry run command to run.", | |||
required=True, | |||
) | |||
@click.option( | |||
"--pass-env-var", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"--pass-env-var", | |
"--pass-env-var", "-e", "passed_env_vars" |
To have a shorter -e
option and a context object key named with plural passed_env_vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for my part!
This PR allows to pass through environment variables of the host sytem to the container executing tests:
Behavior: