diff --git a/tasks/github_tasks.py b/tasks/github_tasks.py index 11070f6002c64f..50f24f3ff96a84 100644 --- a/tasks/github_tasks.py +++ b/tasks/github_tasks.py @@ -13,6 +13,29 @@ from .utils import DEFAULT_BRANCH, load_release_versions +def _trigger_macos_workflow(ctx, release_version, destination, retry_download, retry_interval, **kwargs): + env = load_release_versions(ctx, release_version) + github_action_ref = env["MACOS_BUILD_VERSION"] + + run = trigger_macos_workflow( + github_action_ref=github_action_ref, + release_version=release_version, + **kwargs, + ) + + workflow_conclusion, workflow_url = follow_workflow_run(run) + + if workflow_conclusion == "failure": + print_failed_jobs_logs(run) + + print_workflow_conclusion(workflow_conclusion, workflow_url) + + download_with_retry(download_artifacts, run, destination, retry_download, retry_interval) + + if workflow_conclusion != "success": + raise Exit(code=1) + + @task def trigger_macos_build( ctx, @@ -25,14 +48,14 @@ def trigger_macos_build( retry_download=3, retry_interval=10, ): - env = load_release_versions(ctx, release_version) - github_action_ref = env["MACOS_BUILD_VERSION"] - - run = trigger_macos_workflow( + _trigger_macos_workflow( + ctx, + release_version, + destination, + retry_download, + retry_interval, workflow_name="macos.yaml", - github_action_ref=github_action_ref, datadog_agent_ref=datadog_agent_ref, - release_version=release_version, major_version=major_version, python_runtimes=python_runtimes, # Send pipeline id and bucket branch so that the package version @@ -42,18 +65,6 @@ def trigger_macos_build( version_cache_file_content=version_cache, ) - workflow_conclusion, workflow_url = follow_workflow_run(run) - - if workflow_conclusion == "failure": - print_failed_jobs_logs(run) - - print_workflow_conclusion(workflow_conclusion, workflow_url) - - download_with_retry(download_artifacts, run, destination, retry_download, retry_interval) - - if workflow_conclusion != "success": - raise Exit(code=1) - @task def trigger_macos_test( @@ -66,29 +77,18 @@ def trigger_macos_test( retry_download=3, retry_interval=10, ): - env = load_release_versions(ctx, release_version) - github_action_ref = env["MACOS_BUILD_VERSION"] - - run = trigger_macos_workflow( + _trigger_macos_workflow( + ctx, + release_version, + destination, + retry_download, + retry_interval, workflow_name="test.yaml", - github_action_ref=github_action_ref, datadog_agent_ref=datadog_agent_ref, python_runtimes=python_runtimes, version_cache_file_content=version_cache, ) - workflow_conclusion, workflow_url = follow_workflow_run(run) - - if workflow_conclusion == "failure": - print_failed_jobs_logs(run) - - print_workflow_conclusion(workflow_conclusion, workflow_url) - - download_with_retry(download_artifacts, run, destination, retry_download, retry_interval) - - if workflow_conclusion != "success": - raise Exit(code=1) - @task def lint_codeowner(_):