-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Run pip check to verify production images #12511
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
Conversation
|
The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it! |
|
@potiuk do I have to make a change in airflow sources to trigger this step or is there other way? |
No - the step is queued. Whenever any of the "scripts" changes , all tests are run. |
Ah. But in this case, the "master" script is run (because building image is done in master). You need to push it to your own fork as master to get it run if you want to check it. 'git push yourbranch:master' (just be careful not to push to Airflow) But after we merge it, it will run for all PRs. |
|
I got this: and I'm not sure how this should be addressed as the docutils are only devel dependency in setup.py. Should this constraint be added to constraints or to aws section? https://github.com/PolideaInternal/airflow/runs/1432065455?check_suite_focus=true |
|
It is likely required by another dependency transitively. We have to run "pipdeptree" to find out. |
|
Those cases should be analysed one-by-one and decision should be taken individually in each case I am afraid. |
|
Upgrading boto3 should update the version of botocore we use |
Yup, using |
ba505e5 to
24c4a8b
Compare
|
I think we will only find out if we have problems after running (and possibly fixing) all the tests (and then possibly running some system tests with real AWS. This is the "individual" part of each such upgrade. Regarding constraints - if we have a "green" (all tests passing) build in master with such a setup.py change, then constraints will be updated automatically. The condition is that the PR passes all the tests after merging to master -> this automatically triggers constraints update for master. Same with v1-10-stable. Once a test passes in "v1-10-stable" (those are run with "eager" pip update that update to latest version of dependencies matching setup.py) the constraints-1-10 are also updated automatically. |
|
So the process is simple:
|
|
So what should I do now? The setup.py was updated, the dependencies in image were not so the check is failing. And because it is failing we won't run tests 😄 |
24c4a8b to
b76d850
Compare
Push the fork as master in your own fork. When the test run with your own master it will run eager upgrade check after first installing it, and it will run all tests there |
|
And we can also think about handling this case automatically. Selective checks should allow that: if you look in Maybe that's a good time you implement it :)? We'd have to move it to "selective_checks" because there we set conditional variables based on which files changed. In this case, the logic should be: But note again -> this logic in "build-workflow-image" will only work in master so in order to check it and test all the changes, you have to push it to your fork's master |
b76d850 to
05e83d1
Compare
ff7380c to
4a43996
Compare
I'm doing this since you suggested it in one of the first comments. For example here: But the dependencies are still not updated even if the flag is set to true: |
|
There is a bug in the code - result of one of the latest refactors (and main reason why I opened a support ticket to GitHub). IT's extremely difficult to see such bugs in GA when you have a typo in name of an output because this is silently ignored: The "Set upgrade to latest constraints" is not executed because the output has earlier version of the job name, In this code (this bug is in two lines): |
72759b4 to
a14761f
Compare
|
In this build: but the problem still occurs. Update of constraints is in ci build not in build image workflow, so I'm wodnering if I'm doing changes in right place |
That's good! IThe problem is that we are running the tests in CI environment and UPGRADE_TO_LATEST_CONSTRAINTS works only in the CI image. The pip-check should be running there! |
|
I generally think failing Prod image by PIP check in workflow build is a bad idea. Because we don't even see the tests running then. I think such a check should only run AFTER all the tests are run and before we Push the new constraints. That is also better, because we can then make sure that we are doing the check in the very place we need. Give me a few moments and I will provide guidance: |
|
Proposal: In ci.yaml we have this: (added some comments): I think you will have to add a new matrix job (inject it before 'constraint push" and add the same prerequisites). Because we want to run It should have likely few steps similar to those: Then you should make the "constraints-push" depend on the above job (and only this job). This way we will only update the constraints in "constraints-master" branch when both CI tests passes, and |
|
I will take a look tomorrow. But this PR aimed to validate only prod image. And I think having this check in the same place where we run other validations for image make sense. And it does not require additional matrix = less jobs to run in parallel. |
I am afraid it has to be done in the matrix and using the upgraded constraints from CI builds. We have quite a different set of dependencies for different python versions. And if a pip check succeeds on one there is no guarantee it will succeed with the other. We also cannot upgrade the constraints when we are building the image for regular PRs - because of our transitive dependency problems. If we do this, then we go back to the situation we had where PRs start failing because someone released a new version of a transitive library we are using (remember werkzeug drama ?). The constraint mechanism is specially designed to prevent this case. Do you remember the last time it happened recently for us ? Probably not because we are preventing this from happening and the constraint mechanism does it. So we have to only run upgrade constraints in case of the "master push/schedule builds" and the constraints are now only really updated after all tests pass for them. And this is the perfect time to do the pip check - not sooner, not later. Because this is the moment where the constraints get updated. And we must do a pip check there, otherwise pip check will start failing in master after such constraint push. So we really have to do the pip-check just before we push updated constraints. |
|
Thanks @potiuk for explanation. I'm testing suggested approach: |
This comment has been minimized.
This comment has been minimized.
|
@potiuk it seems that we have exactly the same problem but in different place:
Digging deeper the problem seems to be in the fact that we are using master constraints to build the image ( I changed setup.py but the image is still building using old dependencies. Can you explain (or point to docs) how changes to setup.py|cfg gets propagated to prod images? |
Sure. It is something new we want to do, so It needs likely local running first, to see all the details and then transferring that into CI setup with all the right environment variables etc. It has a lot of variable parts, because we have complex constraint requirements and local optimizations that make the image builds faster in the CI - this is why it needs some special treatment, The technical details and architecture of how images are built are here: https://github.com/apache/airflow/blob/master/IMAGES.rst#technical-details-of-airflow-images. Building production image from the user perspective is described here: https://github.com/apache/airflow/blob/master/docs/production-deployment.rst#production-container-images because this is not a developer, but user-facing feature. But I perfectly understand it can be overwhelming initially. It's also good to take a look at the Dockerfile: https://github.com/apache/airflow/blob/master/Dockerfile Basically in the CI environment you will see the The installation you mentioned is controlled by this: This step can eb entirely skipped by setting So to cut long story short - you need to set AIRFLOW_PRE_CACHED_PIP_PACKAGES to false and AIRFLOW_CONSTRAINTS_LOCATION to your files located in "./docker-context-files" |
|
After discussion with @potiuk we decided to move the check to ci image. And that's are the problem we have: The main problem is snowflake due to snowflakedb/snowflake-connector-python#324 and this comment: Lines 385 to 392 in ce91991
what's more this library has constraint for boto3, I'm wondering how we should solve it. Or what should be our criteria when selecting versions? |
|
I am fixing some of those in a moment. It is rather easy to do manually. What I tried to do is to run those in Breeze: And after that: seems tht simply downgrading request to 2.23.0 and docutils to 0.15.2 should fix the problem for requests (but there will still be problems for azure that needs fixing. The problem comes from snowflake's adding the limitation after we upgraded to 2.24.0 it seems. But now, with the latest version of snowflake request will not be upgraded. then we can move on to the others. |
|
I am double-checking that and pushing new images shortly (BTW. once we add pip check to the pipeline and fix all of those this should never happen in the future). |
|
Indeed this seems to be working on 3.8: |
|
It's not that easy though. I found that on 3.7 there is more to it and we might break some tests when we do it. What I am going to do is to add a special case that we will be able to test new set of constraints separately so that we do not break people's code. Bear with me. |
e791357 to
f8d4eff
Compare
This is first step to address apache#12508 fixup! Run pip check when to verify production images fixup! Run pip check when to verify production images
f8d4eff to
22311a8
Compare
|
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
|
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
|
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
|
Closing as it has been merged into #12664 |
This is first step to address #12508
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.