potiuk edited a comment on pull request #21956: URL: https://github.com/apache/airflow/pull/21956#issuecomment-1068953380
> @potiuk Could you tell me why this is done and why there is OR operator? > > https://github.com/apache/airflow/blob/df6058c862a910a99fbb86858502d9d93fdbe1e5/scripts/ci/libraries/_build_images.sh#L298 It literally means: "run 'create' if inspect' returns error". ``` docker_v buildx inspect airflow_cache || docker_v buildx create --name airflow_cache ``` It works in the way that it fill tries to run the left side `docker_v buildx inspect airflow_cache` and only if it returns an error, it executes the right side: `docker_v buildx create --name airflow_cache`. This is often used shorthand for: ``` if "left side" !=0 then "right side". ``` It's based on the fact that "or" stops being evaluated when the left side is `0` because anything "or" with 0 is 0. Similarly this: ``` docker_v buildx inspect airflow_cache && docker_v buildx create --name airflow_cache ``` would work the opposite way: ``` if "left_side" == "0" then "right side". ``` -- 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]
