Skip to content
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

Make passing build args explicit in ci/prod builds #35768

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Nov 21, 2023

When building hte image, breeze converts some simple parameters passed as breeze command (with autocompletion and explanation) into much longer and more complex set of build args that are passed to docker build command. The way how passing hte args worked so far is that it was pretty implicit:

  • **kwargs were used to ingest click flags
  • parameters found as empty/None were filtered out from these
  • Build*Params dataclass was created out of such kwargs dict
  • argumenst from dataclass (with some customization) were converted to --build-arg (CAPITALIZED_PROPERTY_NAME)

This had a lot of implicitness and it was not easy to understand whether the parameters passed were correct and how they passed through this chain.

This change makes all the build arg much more explicit - without kwargs and dictionary. Each CI/PROD build param has now a method where it explicitly converts arguments into build-args - including specifying which of those are optional (where you can actually filter out Empty and None values) and which are required (where an actual value is expected).


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@@ -550,13 +614,6 @@ def run_build_ci_image(
:param ci_image_params: CI image parameters
:param output: output redirection
"""
if not ci_image_params.version_suffix_for_pypi:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved as default value for CI build

@@ -35,7 +35,7 @@
"--image-tag",
"--tag-as-latest",
"--docker-cache",
"--force-build",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not used. When you order a build build is forced.

@potiuk potiuk force-pushed the explicit_build_params branch from 29aa280 to c391940 Compare November 21, 2023 02:26
@potiuk potiuk requested a review from vincbeck November 21, 2023 02:26
@potiuk potiuk force-pushed the explicit_build_params branch from c391940 to c350c37 Compare November 21, 2023 02:43
When building hte image, breeze converts some simple parameters
passed as breeze command (with autocompletion and explanation)
into much longer and more complex set of build args that are passed
to `docker build` command. The way how passing hte args worked so far
is that it was pretty implicit:

* **kwargs were used to ingest `click` flags
* parameters found as empty/None were filtered out from these
* Build*Params dataclass was created out of such kwargs dict
* argumenst from dataclass (with some customization) were
  converted to --build-arg (CAPITALIZED_PROPERTY_NAME)

This had a lot of implicitness and it was not easy to understand
whether the parameters passed were correct and how they passed
through this chain.

This change makes all the build arg much more explicit - without
kwargs and dictionary. Each CI/PROD build param has now a method
where it explicitly converts arguments into build-args - including
specifying which of those are optional (where you can actually
filter out Empty and None values) and which are required (where
an actual value is expected).

This PR also cleans up the click flags sequence and their
presence as well as the output of help command (they were grouped
with more related parameters)
@potiuk potiuk marked this pull request as ready for review November 21, 2023 10:06
@potiuk
Copy link
Member Author

potiuk commented Nov 21, 2023

cc: @Bowrna -> rewritten the old breeze argument passing now to be more explicit :)

@potiuk
Copy link
Member Author

potiuk commented Nov 21, 2023

@potiuk
Copy link
Member Author

potiuk commented Nov 21, 2023

I checked carefully and mapping of parmeters to build args looks good - I also cleaned up some duplicates along the way (like duplicate --progress`

@potiuk potiuk merged commit 50e0b92 into main Nov 21, 2023
72 checks passed
potiuk added a commit to potiuk/airflow that referenced this pull request Nov 21, 2023
The `--force-build` command has not been used for a long time
in the `ci-image build` command for quite some time because the
sheer fact that you run the command means that you want to run
the build (so it made no sense to have it). The command only makes
sense when you want to force build when running `breeze` or
`breeze start-airflow` command.

However commands to build cache in CI still had this command used
and it caused the builds to fail after merging apache#35768 when the
option has been removed (it was not detected there, because
cache steps only run in main build)
potiuk added a commit that referenced this pull request Nov 21, 2023
The `--force-build` command has not been used for a long time
in the `ci-image build` command for quite some time because the
sheer fact that you run the command means that you want to run
the build (so it made no sense to have it). The command only makes
sense when you want to force build when running `breeze` or
`breeze start-airflow` command.

However commands to build cache in CI still had this command used
and it caused the builds to fail after merging #35768 when the
option has been removed (it was not detected there, because
cache steps only run in main build)
ephraimbuddy pushed a commit that referenced this pull request Nov 23, 2023
When building hte image, breeze converts some simple parameters
passed as breeze command (with autocompletion and explanation)
into much longer and more complex set of build args that are passed
to `docker build` command. The way how passing hte args worked so far
is that it was pretty implicit:

* **kwargs were used to ingest `click` flags
* parameters found as empty/None were filtered out from these
* Build*Params dataclass was created out of such kwargs dict
* argumenst from dataclass (with some customization) were
  converted to --build-arg (CAPITALIZED_PROPERTY_NAME)

This had a lot of implicitness and it was not easy to understand
whether the parameters passed were correct and how they passed
through this chain.

This change makes all the build arg much more explicit - without
kwargs and dictionary. Each CI/PROD build param has now a method
where it explicitly converts arguments into build-args - including
specifying which of those are optional (where you can actually
filter out Empty and None values) and which are required (where
an actual value is expected).

This PR also cleans up the click flags sequence and their
presence as well as the output of help command (they were grouped
with more related parameters)
ephraimbuddy pushed a commit that referenced this pull request Nov 23, 2023
The `--force-build` command has not been used for a long time
in the `ci-image build` command for quite some time because the
sheer fact that you run the command means that you want to run
the build (so it made no sense to have it). The command only makes
sense when you want to force build when running `breeze` or
`breeze start-airflow` command.

However commands to build cache in CI still had this command used
and it caused the builds to fail after merging #35768 when the
option has been removed (it was not detected there, because
cache steps only run in main build)
ephraimbuddy pushed a commit that referenced this pull request Nov 26, 2023
When building hte image, breeze converts some simple parameters
passed as breeze command (with autocompletion and explanation)
into much longer and more complex set of build args that are passed
to `docker build` command. The way how passing hte args worked so far
is that it was pretty implicit:

* **kwargs were used to ingest `click` flags
* parameters found as empty/None were filtered out from these
* Build*Params dataclass was created out of such kwargs dict
* argumenst from dataclass (with some customization) were
  converted to --build-arg (CAPITALIZED_PROPERTY_NAME)

This had a lot of implicitness and it was not easy to understand
whether the parameters passed were correct and how they passed
through this chain.

This change makes all the build arg much more explicit - without
kwargs and dictionary. Each CI/PROD build param has now a method
where it explicitly converts arguments into build-args - including
specifying which of those are optional (where you can actually
filter out Empty and None values) and which are required (where
an actual value is expected).

This PR also cleans up the click flags sequence and their
presence as well as the output of help command (they were grouped
with more related parameters)
ephraimbuddy pushed a commit that referenced this pull request Nov 26, 2023
The `--force-build` command has not been used for a long time
in the `ci-image build` command for quite some time because the
sheer fact that you run the command means that you want to run
the build (so it made no sense to have it). The command only makes
sense when you want to force build when running `breeze` or
`breeze start-airflow` command.

However commands to build cache in CI still had this command used
and it caused the builds to fail after merging #35768 when the
option has been removed (it was not detected there, because
cache steps only run in main build)
@Taragolis Taragolis deleted the explicit_build_params branch December 27, 2023 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants