potiuk commented on a change in pull request #19756: URL: https://github.com/apache/airflow/pull/19756#discussion_r756856362
########## File path: CONTRIBUTORS_QUICK_START.rst ########## @@ -1818,3 +1818,192 @@ describes how to do it. .. raw:: html </details> + + +Setup and develop using Gitpod online workspaces +################################################ + +.. raw:: html + + <details> + <summary>Setup and develop using Gitpod online workspaces</summary> + + + +Setup Airflow with Breeze +------------------------- + + +Forking and cloning Project +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Goto |airflow_github| and fork the project. + + .. |airflow_github| raw:: html + + <a href="https://github.com/apache/airflow/" target="_blank">https://github.com/apache/airflow/</a> + + .. raw:: html + + <div align="center" style="padding-bottom:10px"> + <img src="images/quick_start/airflow_fork.png" + alt="Forking Apache Airflow project"> + </div> + +2. Goto your github account's fork of airflow click on ``Code`` and copy the clone link. + + .. raw:: html + + <div align="center" style="padding-bottom:10px"> + <img src="images/quick_start/airflow_clone.png" + alt="Cloning github fork of Apache airflow"> + </div> + +3. Add goto https://gitpod.io/#<copied-url> as shown. + + .. raw:: html + + <div align="center" style="padding-bottom:10px"> + <img src="images/quick_start/airflow_gitpod_url.png" + alt="Open personal airflow clone with Gitpod"> + </div> + +Setting up Breeze +~~~~~~~~~~~~~~~~~ + +1. Breeze is already initialized in one of the terminals in Gitpod + +2. Once the breeze environment is initialized, create airflow tables and users from the breeze CLI. ``airflow db reset`` + is required to execute at least once for Airflow Breeze to get the database/tables created. + +.. code-block:: bash + + root@b76fcb399bb6:/opt/airflow# airflow db reset + root@b76fcb399bb6:/opt/airflow# airflow users create --role Admin --username admin --password admin \ + --email [email protected] --firstname foo --lastname bar + + +3. Closing Breeze environment. After successfully finishing above command will leave you in container, + type ``exit`` to exit the container + +.. code-block:: bash + + root@b76fcb399bb6:/opt/airflow# + root@b76fcb399bb6:/opt/airflow# exit + +.. code-block:: bash + + $ ./breeze stop + + +Installing airflow with breeze. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Gitpod default image have all the required packages installed. + +1. Add following line to ~/.bashrc in order to call breeze command from anywhere. + +.. code-block:: bash + + export PATH=${PATH}:"/home/${USER}/Projects/airflow" + source ~/.bashrc + + +Starting development +-------------------- + + +Creating a branch +~~~~~~~~~~~~~~~~~ + +1. Click on the branch symbol in the status bar + + .. raw:: html + + <div align="center" style="padding-bottom:10px"> + <img src="images/quick_start/vscode_creating_branch_1.png" + alt="Creating a new branch"> + </div> + +2. Give a name to a branch and checkout + + .. raw:: html + + <div align="center" style="padding-bottom:10px"> + <img src="images/quick_start/vscode_creating_branch_2.png" + alt="Giving a name to a branch"> + </div> + + + +Testing +~~~~~~~ + +All Tests are inside ./tests directory. + +- Running Unit tests inside Breeze environment. + + Just run ``pytest filepath+filename`` to run the tests. + +.. code-block:: bash + + root@4a2143c17426:/opt/airflow# pytest tests/utils/test_session.py + ======================================= test session starts ======================================= + platform linux -- Python 3.7.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/local/bin/python + cachedir: .pytest_cache + rootdir: /opt/airflow, configfile: pytest.ini + plugins: anyio-3.3.4, flaky-3.7.0, asyncio-0.16.0, cov-3.0.0, forked-1.3.0, httpx-0.15.0, instafail-0.4.2, rerunfailures-9.1.1, timeouts-1.2.1, xdist-2.4.0, requests-mock-1.9.3 + setup timeout: 0.0s, execution timeout: 0.0s, teardown timeout: 0.0s + collected 4 items + + tests/utils/test_session.py::TestSession::test_raised_provide_session PASSED [ 25%] + tests/utils/test_session.py::TestSession::test_provide_session_without_args_and_kwargs PASSED [ 50%] + tests/utils/test_session.py::TestSession::test_provide_session_with_args PASSED [ 75%] + tests/utils/test_session.py::TestSession::test_provide_session_with_kwargs PASSED [100%] + +====================================== 4 passed, 11 warnings in 33.14s ====================================== + +- Running All the test with Breeze by specifying required python version, backend, backend version + +.. code-block:: bash + + $ breeze --backend mysql --mysql-version 5.7 --python 3.8 --db-reset --test-type All tests + + +- Running specific test in container using shell scripts. Testing in container scripts are located in + ``./scripts/in_container`` directory. + +.. code-block:: bash + + root@4a2143c17426:/opt/airflow# ls ./scripts/in_container/ + _in_container_script_init.sh quarantine_issue_header.md run_mypy.sh + _in_container_utils.sh run_anything.sh run_prepare_airflow_packages.sh + airflow_ci.cfg run_ci_tests.sh run_prepare_provider_documentation.sh + bin run_docs_build.sh run_prepare_provider_packages.sh + check_environment.sh run_extract_tests.sh run_resource_check.sh + check_junitxml_result.py run_fix_ownership.sh run_system_tests.sh + configure_environment.sh run_flake8.sh run_tmux_welcome.sh + entrypoint_ci.sh run_generate_constraints.sh stop_tmux_airflow.sh + entrypoint_exec.sh run_init_script.sh update_quarantined_test_status.py + prod run_install_and_test_provider_packages.sh + + root@df8927308887:/opt/airflow# ./scripts/in_container/run_docs_build.sh + +- Running specific type of test + + - Types of tests + + - Running specific type of test + + .. code-block:: bash + + $ breeze --backend mysql --mysql-version 5.7 --python 3.8 --db-reset --test-type Core Review comment: Yeah - fixed ports unfortunately :(. I think it might be a good idea to run `breeze stop` beore starting a new instance. It will also make sure that all the DB volumes are cleared and databased will be "fresh like a daisy". You can also actually start `breeze` always with `--db-reset` switch - this will make sure that every time you initialize gitpod environment the database will be recreated. This is a nice feature - especially if you plan switch back/forth between branches and the environment will be preserved. -- 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]
