Skip to content

Commit 069db62

Browse files
authored
Arm backend: Avoid progress bars in CI. (pytorch#21976)
Add a general ```detect_ci.sh``` script for re-use. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani Signed-off-by: Erik Lundell <erik.lundell@arm.com>
1 parent e4b18fa commit 069db62

4 files changed

Lines changed: 81 additions & 3 deletions

File tree

‎.ci/scripts/detect_ci.sh‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
# Copyright 2026 Arm Limited and/or its affiliates.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
#
7+
# Usage:
8+
# EXECUTORCH_CI=$(.ci/scripts/detect_ci.sh)
9+
#
10+
# Test whether any supported CI was detected:
11+
# [[ -n "${EXECUTORCH_CI}" ]]
12+
#
13+
# Test for a specific CI provider:
14+
# [[ "${EXECUTORCH_CI}" == "JENKINS" ]]
15+
# [[ "${EXECUTORCH_CI}" == "GITHUB" ]]
16+
#
17+
# Test for CI debug mode:
18+
# [[ -n "$(.ci/scripts/detect_ci.sh --and-debug)" ]]
19+
#
20+
# Test for CI but not debug mode:
21+
# [[ -n "$(.ci/scripts/detect_ci.sh --and-not-debug)" ]]
22+
23+
filter="${1:-}"
24+
if [[ "${#}" -gt 1 ]]; then
25+
exit 0
26+
fi
27+
28+
ci_provider=""
29+
debug_env=""
30+
31+
if [[ "${GITHUB_ACTIONS:-}" == "true" ]]; then
32+
ci_provider="GITHUB"
33+
debug_env="${GITHUB_DEBUG:-}"
34+
elif [[ -n "${JENKINS_URL:-}" ||
35+
-n "${JENKINS_HOME:-}" ||
36+
-n "${JENKINS_SERVER_COOKIE:-}" ||
37+
-n "${HUDSON_URL:-}" ||
38+
-n "${HUDSON_HOME:-}" ||
39+
"${BUILD_TAG:-}" == jenkins-* ]]; then
40+
ci_provider="JENKINS"
41+
# Jenkins and other pipelines do not have a standard debug-mode variable.
42+
# Pipelines that need debug-aware behavior should set this manually.
43+
debug_env="${EXECUTORCH_CI_DEBUG:-}"
44+
elif [[ -n "${CI:-}" ]]; then
45+
ci_provider="UNKNOWN_CI"
46+
# Jenkins and other pipelines do not have a standard debug-mode variable.
47+
# Pipelines that need debug-aware behavior should set this manually.
48+
debug_env="${EXECUTORCH_CI_DEBUG:-}"
49+
else
50+
exit 0
51+
fi
52+
53+
debug_enabled=false
54+
if [[ "${debug_env}" == "1" || "${debug_env}" == "true" || "${debug_env}" == "TRUE" ]]; then
55+
debug_enabled=true
56+
fi
57+
58+
case "${filter}" in
59+
"")
60+
;;
61+
--and-debug)
62+
[[ "${debug_enabled}" == "true" ]] || exit 0
63+
;;
64+
--and-not-debug)
65+
[[ "${debug_enabled}" != "true" ]] || exit 0
66+
;;
67+
*)
68+
exit 0
69+
;;
70+
esac
71+
72+
echo "${ci_provider}"
73+
exit 0

‎backends/arm/scripts/utils.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function download_with_retry() {
9393
for attempt in $(seq 1 ${max_attempts}); do
9494
rm -f "${output}"
9595
if curl --fail --retry 3 --retry-delay 5 --retry-connrefused --retry-all-errors \
96-
-L --output "${output}" "${url}" \
96+
"${ARM_SETUP_CURL_PROGRESS_ARGS[@]}" -L --output "${output}" "${url}" \
9797
&& verify_md5 "${expected_md5}" "${output}"; then
9898
return 0
9999
fi

‎backends/arm/scripts/vulkan_utils.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function download_and_extract_vulkan_sdk_linux() {
5353

5454
if [[ ! -e "${vulkan_sdk_tar_file}" ]]; then
5555
log_step "vulkan" "Downloading Vulkan SDK (${vulkan_sdk_version})"
56-
curl -L --output "${vulkan_sdk_tar_file}" "${vulkan_sdk_url}"
56+
curl "${ARM_SETUP_CURL_PROGRESS_ARGS[@]}" -L --output "${vulkan_sdk_tar_file}" "${vulkan_sdk_url}"
5757
echo "${vulkan_sdk_sha256} ${vulkan_sdk_tar_file}" | sha256sum -c - || exit 1
5858
rm -fr ${vulkan_sdk_base_dir}
5959
fi
@@ -67,7 +67,7 @@ function install_vulkan_sdk_macos() {
6767

6868
if [[ ! -e "${vulkan_sdk_zip_file}" ]]; then
6969
log_step "vulkan" "Downloading Vulkan SDK (${vulkan_sdk_version}) for macOS"
70-
curl -L --output "${vulkan_sdk_zip_file}" "${vulkan_sdk_url}"
70+
curl "${ARM_SETUP_CURL_PROGRESS_ARGS[@]}" -L --output "${vulkan_sdk_zip_file}" "${vulkan_sdk_url}"
7171
echo "${vulkan_sdk_sha256} ${vulkan_sdk_zip_file}" | shasum -a 256 -c - || exit 1
7272
rm -fr ${vulkan_sdk_base_dir}
7373
fi

‎examples/arm/setup.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ function create_setup_path(){
311311
if [[ $is_script_sourced -eq 0 ]]; then
312312
set -e
313313

314+
if [[ -n "$("${et_dir}/.ci/scripts/detect_ci.sh" --and-not-debug)" ]]; then
315+
ARM_SETUP_CURL_PROGRESS_ARGS=(--no-progress-meter)
316+
export PIP_PROGRESS_BAR=off
317+
fi
318+
314319
check_options "$@"
315320

316321
if [[ "${#target_toolchains[@]}" -eq 0 ]]; then

0 commit comments

Comments
 (0)