potiuk opened a new pull request, #35617:
URL: https://github.com/apache/airflow/pull/35617

   Move prepare-provider-packages to be run entirely in Breeze Python
   
   This is a follow-up after https://github.com/apache/airflow/pull/35586 and 
it depends on this one. It
   moves the whole functionality of preparing provider packages to
   breeze, removing the need of doing it in the Breeze CI image.
   
   Since we have Python breeze with its own environment managed via
   pipx we can now make sure that all the necessary packages are
   installed in this environment and run package building in the
   same environment Breeze uses.
   
   Previously we have been running all the package building inside the
   CI image for two reasons:
   
   we could rely on the same version of build tools (wheel/setuptools)
   being installed in the CI image
   security of the provider package preparation that used setuptools
   pre PEP-517 way of building packages that executed setup.py code
   In order to isolate execution of potentially arbitrary code
   in setup.py from the HOST environment in CI - where the host
   environment might have access to secrets and tokens that would allow
   it to break out of the sandbox for PRs coming from forks. The setup.py
   file has been prepared by breeze using JINJA templates but it was
   potentially possible to manipulate provider package directory structure
   and get "Python" injection into generated setup.py, so it was safer
   to run it in the isolated Breeze CI environment.
   
   This PR makes it secure to run it in the Host environment,
   because instead of generating setup.cfg and setup.py we generate
   pyproject.toml with all the necessary information and we are using
   PEP-517 compliant way of building provider packages - no arbitrary
   code executed via setup.py is possible this way on the host,
   so we can safely build provider packages in the host. We are
   generating declarative pyproject.toml for that rather than imperative
   setup.py, so we are safe to run the build process in the host without
   being afraid of executing arbitrary code.
   
   We are using flit as build tool - this is one of the popular build
   tools - created by Python Packaging team. It is simple and not
   too opinionated, it supports PEP-517 as well as PEP-621, so most of
   the project mnetadata in pyproject toml can be added to PEP-621
   compliant "project" section of pyproject.toml.
   
   Together with the change we improves the process of generation of the
   extracted sources for the providers. Originally we copied the whole
   sources of Airflow to a single directory (provider_packages) and run
   sequentially provider packages building from that single directory,
   however it made it impossible to parallelise such builds - all
   providers had to be built sequentially.
   
   We change the approach now - instead of copying all airflow
   sources once to the single directory, we build providers in separate
   subdirectories of files/provider_packages/PROVIDER_ID and we only
   copy there relevant sources (i.e. only provider's subfolder from
   the "airflow/providers". This is quite a bit faster (each provider
   only gets built using only its own sources so just scanning the
   directory is faster) but it also allows to run package preparation
   in parallel because each provider is fully isolated from others.
   
   This PR also excludes not-needed prepare_providers_package.py
   and unneded provider_packages folder used to prepare providers
   before as well as bash script to build the providers and some
   unused bash functions.
   
   This change requires https://github.com/apache/airflow/pull/35586 to be 
merged first - only last commit
   counts.
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to