@@ -41,7 +41,8 @@ function setup_default_breeze_variables() {
4141 export BREEZE=true
4242 # Maximum screen width to print the lines spanning the whole terminal width
4343 export MAX_SCREEN_WIDTH=100
44-
44+ # By default we build CI images but when we specify `--production-image` we switch to production image
45+ export PRODUCTION_IMAGE=" false"
4546 # Directory where all CI scripts are located
4647 export SCRIPTS_CI_DIR=" ${AIRFLOW_SOURCES} /scripts/ci"
4748
@@ -88,26 +89,27 @@ function setup_default_breeze_variables() {
8889
8990 # Name of the script is kept in this variable
9091 CMDNAME=" $( basename -- " $0 " ) "
92+ export CMDNAME
9193
9294 # Update short and long options in the breeze-complete script
9395 # This way autocomplete will work automatically with all options available
9496 # shellcheck source=breeze-complete
9597 . " ${AIRFLOW_SOURCES} /breeze-complete"
9698
9799 # By default we mount local Airflow sources
98- MOUNT_LOCAL_SOURCES=" true"
100+ export MOUNT_LOCAL_SOURCES=" true"
99101
100102 # By default we mount files folder
101- MOUNT_FILES=" true"
103+ export MOUNT_FILES=" true"
102104
103105 # Holds last sub-command used - this is used by --help flag to print help for the command entered
104- LAST_SUBCOMMAND=" "
106+ export LAST_SUBCOMMAND=" "
105107
106108 # Determines if help should be run (set to true by --help flag)
107- RUN_HELP=" false"
109+ export RUN_HELP=" false"
108110
109111 # Holds docker compose command if the `docker-compose` command is used.
110- DOCKER_COMPOSE_COMMAND=" "
112+ export DOCKER_COMPOSE_COMMAND=" "
111113
112114 # If set to true, the docker images are rebuilt locally. By default we assume we do not need to
113115 # rebuild the image but if we find we do, this variable will be set to "true"
@@ -120,9 +122,6 @@ function setup_default_breeze_variables() {
120122 # Do not enable Kind Kubernetes cluster by default
121123 export ENABLE_KIND_CLUSTER=" false"
122124
123- # By default we do not push images. This can be overridden by -u flag.
124- export PUSH_IMAGES=${PUSH_IMAGES:= " false" }
125-
126125 # Forward common host credentials to docker (gcloud, aws etc.).
127126 export FORWARD_CREDENTIALS=" false"
128127
@@ -554,7 +553,7 @@ function prepare_command_files() {
554553 " \"\$ {@}\" " " ${COMPOSE_PROD_FILE} " " ${AIRFLOW_PROD_IMAGE} "
555554}
556555
557- # Prints detailed help for all commands and flgas . Used to generate documentation added to BREEZE.rst
556+ # Prints detailed help for all commands and flags . Used to generate documentation added to BREEZE.rst
558557# automatically.
559558function do_help_all() {
560559 echo
@@ -786,17 +785,29 @@ function parse_arguments() {
786785 echo
787786 export USE_GITHUB_REGISTRY=" true"
788787 shift ;;
789- -G |--github-organisation )
788+ -g |--github-repository )
790789 echo
791- echo " GitHub organisation "
790+ echo " GitHub repository: ${2} "
792791 echo
793- export GITHUB_ORGANISATION=" ${2} "
792+ echo " Using github registry."
793+ echo
794+ export GITHUB_REPOSITORY=" ${2} "
795+ export USE_GITHUB_REGISTRY=" true"
794796 shift 2;;
795- -g |--github-repo )
797+ -s |--github-image-id )
796798 echo
797- echo " GitHub repository "
799+ echo " GitHub image id: ${2} } "
798800 echo
799- export GITHUB_REPOSITORY=" ${2} "
801+ echo " Force pulling the image, using github registry and skip mounting local sources."
802+ echo " This is in order to get the exact same version as used in CI environment for SHA/RUN_ID!."
803+ echo
804+ export FORCE_PULL_IMAGES=" true"
805+ export USE_GITHUB_REGISTRY=" true"
806+ export GITHUB_REGISTRY_PULL_IMAGE_TAG=" ${2} "
807+ export GITHUB_REGISTRY_PUSH_IMAGE_TAG=" ${2} "
808+ export CHECK_IMAGE_FOR_REBUILD=" false"
809+ export MOUNT_LOCAL_SOURCES=" false"
810+ export SKIP_CHECK_REMOTE_IMAGE=" true"
800811 shift 2;;
801812 -S|--version-suffix-for-pypi)
802813 if [[ ${VERSION_SUFFIX_FOR_SVN} != " " ]]; then
@@ -1111,6 +1122,22 @@ ${CMDNAME} shell [FLAGS] [-- <EXTRA_ARGS>]
11111122 especially useful to pass bash options, for example -c to execute command:
11121123
11131124 '${CMDNAME} shell -- -c \" ls -la\" '
1125+ '${CMDNAME} -- -c \" ls -la\" '
1126+
1127+ For DockerHub pull --dockerhub-user and --dockerhub-repo flags can be used to specify
1128+ the repository to pull from. For GitHub repository, the --github-repository
1129+ flag can be used for the same purpose. You can also use
1130+ --github-image-id <COMMIT_SHA>|<RUN_ID> in case you want to pull the image
1131+ with specific COMMIT_SHA tag or RUN_ID.
1132+
1133+ '${CMDNAME} shell \\
1134+ --github-image-id 9a621eaa394c0a0a336f8e1b31b35eff4e4ee86e' - pull/use image with SHA
1135+ '${CMDNAME} \\
1136+ --github-image-id 9a621eaa394c0a0a336f8e1b31b35eff4e4ee86e' - pull/use image with SHA
1137+ '${CMDNAME} shell \\
1138+ --github-image-id 209845560' - pull/use image with RUN_ID
1139+ '${CMDNAME} \\
1140+ --github-image-id 209845560' - pull/use image with RUN_ID
11141141
11151142Flags:
11161143$( flag_footer)
@@ -1147,6 +1174,12 @@ ${CMDNAME} build-image [FLAGS]
11471174
11481175 You can also pass '--production-image' flag to build production image rather than CI image.
11491176
1177+ For DockerHub pull --dockerhub-user and --dockerhub-repo flags can be used to specify
1178+ the repository to pull from. For GitHub repository, the --github-repository
1179+ flag can be used for the same purpose. You can also use
1180+ --github-image-id <COMMIT_SHA>|<RUN_ID> in case you want to pull the image with
1181+ specific COMMIT_SHA tag or RUN_ID.
1182+
11501183Flags:
11511184$( flag_airflow_variants)
11521185$( flag_choose_different_airflow_version)
@@ -1295,8 +1328,11 @@ ${CMDNAME} push_image [FLAGS]
12951328 or to the GitHub registry (if --github-registry flag is used).
12961329
12971330 For DockerHub pushes --dockerhub-user and --dockerhub-repo flags can be used to specify
1298- the repository to push to. For GitHub repository --github-organisation and --github-repo
1299- flags can be used for the same purpose.
1331+ the repository to push to. For GitHub repository, the --github-repository
1332+ flag can be used for the same purpose. You can also add
1333+ --github-image-id <COMMIT_SHA>|<RUN_ID> in case you want to push image with specific
1334+ SHA tag or run id. In case you specify --github-repository or --github-image-id, you
1335+ do not need to specify --github-registry flag.
13001336
13011337 You can also add --production-image flag to switch to production image (default is CI one)
13021338
@@ -1306,7 +1342,12 @@ ${CMDNAME} push_image [FLAGS]
13061342 '${CMDNAME} push-image --dockerhub-user user' to push to your private registry or
13071343 '${CMDNAME} push-image --production-image' - to push production image or
13081344 '${CMDNAME} push-image --github-registry' - to push to GitHub image registry or
1309- '${CMDNAME} push-image --github-registry --github-organisation org' - for other organisation
1345+ '${CMDNAME} push-image \\
1346+ --github-repository user/airflow' - to push to your user's fork
1347+ '${CMDNAME} push-image \\
1348+ --github-image-id 9a621eaa394c0a0a336f8e1b31b35eff4e4ee86e' - to push with COMMIT_SHA
1349+ '${CMDNAME} push-image \\
1350+ --github-image-id 209845560' - to push with RUN_ID
13101351
13111352Flags:
13121353$( flag_pull_push_docker_images)
@@ -1319,7 +1360,7 @@ ${CMDNAME} kind-cluster [FLAGS] OPERATION
13191360
13201361 Manages host-side Kind Kubernetes cluster that is used to run Kubernetes integration tests.
13211362 It allows to start/stop/restart/status the Kind Kubernetes cluster and deploy Airflow to it.
1322- This enables you to run tests inside the breeze environment with latest airflow images loaded .
1363+ This enables you to run tests inside the breeze environment with latest airflow images.
13231364 Note that in case of deploying airflow, the first step is to rebuild the image and loading it
13241365 to the cluster so you can also pass appropriate build image flags that will influence
13251366 rebuilding the production image. Operation is one of:
@@ -1523,7 +1564,7 @@ ${FORMATTED_MYSQL_VERSIONS}
15231564"
15241565}
15251566
1526- # Prints production image flgas
1567+ # Prints production image flags
15271568function flag_production_image() {
15281569 echo "
15291570-I, --production-image
@@ -1737,14 +1778,25 @@ function flag_pull_push_docker_images() {
17371778
17381779-c, --github-registry
17391780 If GitHub registry is enabled, pulls and pushes are done from the GitHub registry not
1740- DockerHub. You need to be logged in to the registry in order to be able to pull/push from it
1781+ DockerHub. You need to be logged in to the registry in order to be able to pull/push from
17411782 and you need to be committer to push to Apache Airflow' GitHub registry.
17421783
1743- -G, --github-organisation
1744- GitHub organisation used to pull, push images when cache is used. Default: ${_BREEZE_DEFAULT_GITHUB_ORGANISATION:= } .
1784+ -g, --github-repository
1785+ GitHub repository used to pull, push images when cache is used.
1786+ Default: ${_BREEZE_DEFAULT_GITHUB_REPOSITORY:= } .
1787+
1788+ If you use this flag, automatically --github-registry flag is enabled.
1789+
1790+ -s, --github-image-id <COMMIT_SHA>|<RUN_ID>
1791+ <RUN_ID> or <COMMIT_SHA> of the image. Images in GitHub registry are stored with those
1792+ to be able to easily find the image for particular CI runs. Once you know the
1793+ <RUN_ID> or <COMMIT_SHA>, you can specify it in github-image-id flag and Breeze will
1794+ automatically pull and use that image so that you can easily reproduce a problem
1795+ that occurred in CI.
1796+
1797+ If you use this flag, automatically --github-registry is enabled.
17451798
1746- -g, --github-repo
1747- GitHub repository used to pull, push images when cache is used. Default: ${_BREEZE_DEFAULT_GITHUB_REPO:= } .
1799+ Default: ${_BREEZE_DEFAULT_GITHUB_IMAGE_ID:= } .
17481800
17491801"
17501802}
0 commit comments