This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 0edc3dd  Introducing flags to skip example dags and default 
connections (#11099)
0edc3dd is described below

commit 0edc3dd57953da5c66a4b45d49c1426cc0295f9e
Author: mucio <[email protected]>
AuthorDate: Wed Sep 23 14:56:29 2020 +0200

    Introducing flags to skip example dags and default connections (#11099)
---
 BREEZE.rst                              | 10 +++++++++
 breeze                                  | 36 ++++++++++++++++++++++++++++++---
 breeze-complete                         |  2 ++
 scripts/ci/docker-compose/base.yml      |  2 ++
 scripts/ci/libraries/_initialization.sh | 15 ++++++++++++++
 5 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/BREEZE.rst b/BREEZE.rst
index 4e24154..f3ba54a 100644
--- a/BREEZE.rst
+++ b/BREEZE.rst
@@ -1962,6 +1962,16 @@ This is the current syntax for  `./breeze <./breeze>`_:
           init.sh. It will be executed after the environment is configured and 
started (in case
           --start-airflow is used).
 
+  --skip-example-dags
+          Airflow example dags will not be included.
+
+  --skip-default-connections
+          Airflow Default Connections will not be created.
+
+  -T, --skip-tutorial-objects
+          Default Connections and sample dags will not be created. Use this to 
have a clean
+          Airflow without tutorial objects.
+
   
****************************************************************************************************
    Kind kubernetes and Kubernetes tests configuration(optional)
 
diff --git a/breeze b/breeze
index 90624f6..cc098fc 100755
--- a/breeze
+++ b/breeze
@@ -68,6 +68,8 @@ export EXTRA_STATIC_CHECK_OPTIONS
 #    FORCE_BUILD_IMAGES
 #    PRODUCTION_IMAGE
 #    PYTHON_MAJOR_MINOR_VERSION
+#    AIRFLOW__CORE__LOAD_EXAMPLES
+#    AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS
 #
 # Global variables:
 #
@@ -114,9 +116,6 @@ function breeze::setup_default_breeze_constants() {
     # If set to true, the database will be reset at entry. Works for Postgres 
and MySQL
     export DB_RESET="false"
 
-    # If set to true, the database will be initialized, a user created and 
webserver and scheduler started
-    export START_AIRFLOW="false"
-
     # If it set is set to specified version, then the source version of Airflow
     # is removed and the specified version of Airflow is installed from PyPi
     export INSTALL_AIRFLOW_VERSION=""
@@ -1006,6 +1005,27 @@ function breeze::parse_arguments() {
             echo
             shift 2
             ;;
+        --skip-example-dags)
+            export AIRFLOW__CORE__LOAD_EXAMPLES="False"
+            echo "Airflow sample dags will be skipped"
+            echo
+            shift
+            ;;
+        --skip-default-connections)
+            export AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS="False"
+            echo "Airflow default connections will be skipped"
+            echo
+            shift
+            ;;
+        -T | --skip-tutorial-objects)
+            export AIRFLOW__CORE__LOAD_EXAMPLES="False"
+            export AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS="False"
+            echo "Airflow sample dags will be skipped"
+            echo
+            echo "Airflow default connections will be skipped"
+            echo
+            shift
+            ;;
         -S | --version-suffix-for-pypi)
             if [[ -n ${VERSION_SUFFIX_FOR_SVN=} ]]; then
                 echo
@@ -1977,6 +1997,16 @@ ${FORMATTED_INTEGRATIONS}
         init.sh. It will be executed after the environment is configured and 
started (in case
         --start-airflow is used).
 
+--skip-example-dags
+        Airflow example dags will not be included.
+
+--skip-default-connections
+        Airflow Default Connections will not be created.
+
+-T, --skip-tutorial-objects
+        Default Connections and sample dags will not be created. Use this to 
have a clean
+        Airflow without tutorial objects.
+
 "
 }
 
diff --git a/breeze-complete b/breeze-complete
index ea973d6..5f895d6 100644
--- a/breeze-complete
+++ b/breeze-complete
@@ -135,6 +135,7 @@ F P I E: C r
 L U X
 D: R: c g: s:
 S: N:
+T
 "
 
 _breeze_long_options="
@@ -142,6 +143,7 @@ help python: backend: integration:
 kubernetes-mode: kubernetes-version: helm-version: kind-version:
 skip-mounting-local-sources install-airflow-version: 
install-airflow-reference: db-reset
 verbose assume-yes assume-no assume-quit forward-credentials start-airflow 
init-script:
+skip-example-dags skip-default-connections skip-tutorial-objects
 force-build-images force-pull-images production-image extras: 
force-clean-images skip-rebuild-check
 build-cache-local build-cache-pulled build-cache-disabled
 dockerhub-user: dockerhub-repo: github-registry github-repository: 
github-image-id:
diff --git a/scripts/ci/docker-compose/base.yml 
b/scripts/ci/docker-compose/base.yml
index 4ef6219..c94eaab 100644
--- a/scripts/ci/docker-compose/base.yml
+++ b/scripts/ci/docker-compose/base.yml
@@ -60,6 +60,8 @@ services:
       - HOST_OS
       - PYTHONDONTWRITEBYTECODE
       - INIT_SCRIPT_FILE
+      - AIRFLOW__CORE__LOAD_EXAMPLES
+      - AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS
     volumes:
       # Pass docker to inside of the container so that Kind and Moto tests can 
use it.
       - /var/run/docker.sock:/var/run/docker.sock
diff --git a/scripts/ci/libraries/_initialization.sh 
b/scripts/ci/libraries/_initialization.sh
index a98ef96..4ddf303 100644
--- a/scripts/ci/libraries/_initialization.sh
+++ b/scripts/ci/libraries/_initialization.sh
@@ -415,6 +415,8 @@ function initialization::initialize_common_environment() {
     initialization::initialize_kubernetes_variables
     initialization::initialize_git_variables
     initialization::initialize_github_variables
+    initialization::intialize_airflow_variables
+
 }
 
 function initialization::set_default_python_version_if_empty() {
@@ -512,6 +514,8 @@ Detected CI build environment:
 Initialization variables:
 
     INIT_SCRIPT_FILE: ${INIT_SCRIPT_FILE}
+    AIRFLOW__CORE__LOAD_EXAMPLES: ${AIRFLOW__CORE__LOAD_EXAMPLES}
+    AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS: 
${AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS}
 
 EOF
 
@@ -667,6 +671,9 @@ function initialization::make_constants_read_only() {
     readonly BUILT_CI_IMAGE_FLAG_FILE
     readonly INIT_SCRIPT_FILE
 
+    readonly AIRFLOW__CORE__LOAD_EXAMPLES
+    readonly AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS
+
 }
 
 
@@ -689,3 +696,11 @@ function initialization::ga_output() {
     echo "::set-output name=${1}::${2}"
     echo "${1}=${2}"
 }
+
+function initialization::intialize_airflow_variables(){
+    # If set to true, the database will be initialized, a user created and 
webserver and scheduler started
+    export START_AIRFLOW="False"
+
+    export AIRFLOW__CORE__LOAD_EXAMPLES="True"
+    export AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS="True"
+}

Reply via email to