-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
DockerOperator: use DOCKER_HOST as default for docker_url #38387
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
Simple tests which check respect docker host, case if env set to empty string (edge case) and if DOCKER_HOST not set Tests usual stored into the test/{path-from-airflow-package}, e.g.tests/providers/docker/operators/test_docker.py Test environ variables might be done by class TestDockerOperator:
...
def test_respect_docker_host_env(self, monkeypatch):
monkeypatch.setenv("DOCKER_HOST", "foo.bar")
assert DockerOperator(task_id="test-task", image="test").docker_url == "foo.bar"
def test_docker_host_env_empty(self, monkeypatch):
monkeypatch.setenv("DOCKER_HOST", "")
assert DockerOperator(task_id="test-task", image="test").docker_url == "expected-host-here"
def test_docker_host_env_not_set(self, monkeypatch):
monkeypatch.delenv("DOCKER_HOST", raising=False)
assert DockerOperator(task_id="test-task", image="test").docker_url == "expected-host-here"
Is it backward incompatible change? |
Thanks so much @Taragolis for the advice! I will look into it.
It depends on your definition of "backward incompatible". The only breakage I can imagine is quite contrived:
Do you think this warrants a newsfragment? |
We do not use newfragments for the providers changes, so this not this case. However if you thought it might break someone pipeline than better create a new major version of the provider. airflow/airflow/providers/docker/provider.yaml Lines 27 to 28 in 83316b8
And add into the CHANGELOG.rst info about Breaking changes and how it might be resolved, and what user should change Some example for reference: airflow/airflow/providers/slack/CHANGELOG.rst Lines 153 to 188 in bfb054e
cc: @eladkal @potiuk do you think this changes might considered as breaking changes? |
I'd treat is a bug-fix but add a separate note in the changelog. DOCKER_HOST overrididng default value is well-respected standard and we should follow it. It's very unlikely that somoene sets DOCKER_HOST and does not want it to be used by default. |
I agree |
a154e05
to
3bb3cac
Compare
Thanks so much for the support! I pushed some draft tests. I haven't set up testing locally, and I'm hoping that things are simple enough that I can use the CI test suite. Seems like I require approval, so I'll look into setting it up locally.
It looks like the changelog is managed semi-automatically, so I'm not sure if I should edit the changelog by hand. If you want a one-liner, I could suggest:
|
Add a one liner at the top please (see comment at the beginning of the changelog) -we will almost for sure forget to add the line if it is not added now and release manager will have to remember about looking back to all the PRs to see if one is missing. |
756f733
to
1f21acb
Compare
I think I've addressed all the feedback, and I'm optimistic that the tests are succeeding. I'll keep an eye on them and wait for everything to go green unless I hear more feedback. Thanks so much for the awesome review process!!! |
1f21acb
to
ddc2634
Compare
ddc2634
to
3d7e433
Compare
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.
LGTM. @Taragolis @eladkal ?
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
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Respect the
DOCKER_HOST
environment variable with the DockerOperator.I was really surprised that the
DOCKER_HOST
environment variable is ignored. I was also surprised that I didn't find any proposal to add it, so apologies in case I missed a previous discussion. Might this be an acceptable change?Of course this will break in situations where
DOCKER_HOST
is set, but the user is relying on the default value ofdocker_url
to override this setting. Having such a setup is really begging for trouble, so I wouldn't feel so guilty about breaking those cases.TODO if I get 👍 to proceed:
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.