potiuk commented on issue #20741:
URL: https://github.com/apache/airflow/issues/20741#issuecomment-1048540404


   Few comments: 
   
   * use `Breeze2` instead of `./Breeze2` - similarly as `airflow-freespace`, 
Breeze2 is already installed by the earlier `pip install` step
   * You will need to modify the options of build-ci-image command to use 
ENV_VARIABLES. in the original Breeze, we read the variables during 
intialization, but in Python command we just need to make sure the options can 
be read from the env variable. See this chapter in click docs: 
https://click.palletsprojects.com/en/8.0.x/options/#values-from-environment-variables
   
   You will need to modify this code: 
https://github.com/apache/airflow/blob/e8afff9cb52c8c2bc8bd6587656c67703fd87956/dev/breeze/src/airflow_breeze/breeze.py#L93
   
   For example:
   
   ```
   @click.option('-p', '--python', help='Choose your python version')
   ```
   
   You will have to change to:
   
   ```
   @click.option('-p', '--python', help='Choose your python version', 
envvar='PYTHON_MAJOR_MINOR_VERSION')
   ```
   
   If you look at the execution of the build step in CI you will see that there 
are already many variables set there by ci,yaml and selective checks. 
   
   ```
   env:
       MOUNT_SELECTED_LOCAL_SOURCES: false
       FORCE_ANSWER_TO_QUESTIONS: yes
       CHECK_IMAGE_FOR_REBUILD: true
       SKIP_CHECK_REMOTE_IMAGE: true
       DB_RESET: true
       VERBOSE: true
       GITHUB_REPOSITORY: edithturn/airflow
       GITHUB_USERNAME: edithturn
       CONSTRAINTS_GITHUB_REPOSITORY: apache/airflow
       GITHUB_REGISTRY_PULL_IMAGE_TAG: latest
       INSTALL_PROVIDERS_FROM_SOURCES: true
       AIRFLOW_LOGIN_TO_GITHUB_REGISTRY: true
       BACKEND: postgres
       PYTHON_MAJOR_MINOR_VERSION: 3.7
       UPGRADE_TO_NEWER_DEPENDENCIES: false
       DOCKER_CACHE: disable:
   ```
   
   For example the case you mentioned is handled by `GITHUB_REPOSITORY` 
variable. 
   You will find that there is this option:
   ```
   @click.option('--github-repository', help='Choose repository to push/pull 
image.')
   ```
   
   And again adding `envvar='GITHUB_REPOSITORY`) should help. 
   
   You will find the variables used for each option in 
https://github.com/apache/airflow/blob/main/breeze#L799  - there is 
"parse-flags" and each flag has appropriate env variable assigned.
   


-- 
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