potiuk commented on code in PR #27829: URL: https://github.com/apache/airflow/pull/27829#discussion_r1068772776
########## dev/breeze/src/airflow_breeze/commands/release_command.py: ########## @@ -0,0 +1,284 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import os + +import click + +from airflow_breeze.utils.common_options import option_answer +from airflow_breeze.utils.confirm import confirm_action +from airflow_breeze.utils.console import console_print +from airflow_breeze.utils.path_utils import AIRFLOW_SOURCES_ROOT +from airflow_breeze.utils.run_utils import run_command + +CI = os.environ.get("CI") + + +def clone_asf_repo(working_dir): + if confirm_action("Clone ASF repo?"): + run_command(["rm", "-rf", f"{working_dir}/asf-dist"]) + run_command( + ["svn", "checkout", "--depth=immediates", "https://dist.apache.org/repos/dist", "asf-dist"] + ) + dev_dir = f"{working_dir}/asf-dist/dev/airflow" + release_dir = f"{working_dir}/asf-dist/release/airflow" + run_command(["svn", "update", "--set-depth", "infinity", dev_dir]) + run_command(["svn", "update", "--set-depth", "infinity", release_dir]) + + +def create_version_dir(version): + if CI: + console_print("Skipping creation of version dir in CI") + return + if confirm_action(f"Create SVN version directory for {version}?"): + run_command(["svn", "mkdir", f"{version}"]) + console_print(f"{version} directory created") + + +def copy_artifacts_to_svn(rc, svn_dev_repo): + if CI: Review Comment: You might be surprised how different SVN vs Git is and it's sometimes not obvious: https://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.copy.html You will find out that depending on the parameter FORMAT it's either: * scheduling for chaning or * commiting the change or * complete server side copy All while running the same `svn cp`. If anything, I'd err on the side of caution and not do any svn operation. in CI. ########## dev/breeze/src/airflow_breeze/commands/release_command.py: ########## @@ -0,0 +1,284 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import os + +import click + +from airflow_breeze.utils.common_options import option_answer +from airflow_breeze.utils.confirm import confirm_action +from airflow_breeze.utils.console import console_print +from airflow_breeze.utils.path_utils import AIRFLOW_SOURCES_ROOT +from airflow_breeze.utils.run_utils import run_command + +CI = os.environ.get("CI") + + +def clone_asf_repo(working_dir): + if confirm_action("Clone ASF repo?"): + run_command(["rm", "-rf", f"{working_dir}/asf-dist"]) + run_command( + ["svn", "checkout", "--depth=immediates", "https://dist.apache.org/repos/dist", "asf-dist"] + ) + dev_dir = f"{working_dir}/asf-dist/dev/airflow" + release_dir = f"{working_dir}/asf-dist/release/airflow" + run_command(["svn", "update", "--set-depth", "infinity", dev_dir]) + run_command(["svn", "update", "--set-depth", "infinity", release_dir]) + + +def create_version_dir(version): + if CI: + console_print("Skipping creation of version dir in CI") + return + if confirm_action(f"Create SVN version directory for {version}?"): + run_command(["svn", "mkdir", f"{version}"]) + console_print(f"{version} directory created") + + +def copy_artifacts_to_svn(rc, svn_dev_repo): + if CI: Review Comment: You might be surprised how different SVN vs Git is and it's sometimes not obvious: https://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.copy.html You will find out that depending on the parameter FORMAT it's either: * scheduling for changing or * commiting the change or * complete server side copy All while running the same `svn cp`. If anything, I'd err on the side of caution and not do any svn operation. in CI. -- 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]
