Skip to content

Commit 9a7baaa

Browse files
committed
🧠 Add ARM64 information in playground run menu preview and prevent example to be executed if no support #6429
1 parent 8b6d281 commit 9a7baaa

File tree

3 files changed

+100
-2
lines changed

3 files changed

+100
-2
lines changed

scripts/cli/playground

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8315,6 +8315,47 @@ function open_file_with_editor() {
83158315
fi
83168316
}
83178317

8318+
function arm64_support() {
8319+
8320+
test_file=$(playground state get run.test_file)
8321+
8322+
if [ ! -f $test_file ]
8323+
then
8324+
8325+
return
8326+
fi
8327+
8328+
set +e
8329+
if [ "$(uname -m)" = "arm64" ]
8330+
then
8331+
base_folder=$(basename $(dirname $(dirname $test_file)))
8332+
base_test=$(basename $(dirname $test_file))
8333+
if [ "$base_folder" == "reproduction-models" ]
8334+
then
8335+
base_test=${base_test#*-}
8336+
fi
8337+
8338+
grep "${base_test}" ${root_folder}/scripts/arm64-support-none.txt > /dev/null
8339+
if [ $? = 0 ]
8340+
then
8341+
echo "❌🖥️ this example is not working with ARM64 !"
8342+
echo "❌🖥️ it is highly recommended to use 'playground ec2 command' to run the example on ubuntu ec2 instance"
8343+
echo "❌🖥️ you can also use gitpod"
8344+
return
8345+
fi
8346+
8347+
grep "${base_test}" ${root_folder}/scripts/arm64-support-with-emulation.txt > /dev/null
8348+
if [ $? = 0 ]
8349+
then
8350+
echo "☑️🖥️ this example is working with ARM64 but requires emulation"
8351+
return
8352+
fi
8353+
8354+
echo "✅🖥️ this example should work natively with ARM64"
8355+
fi
8356+
set -e
8357+
}
8358+
83188359
# src/lib/colors.sh
83198360
print_in_color() {
83208361
local color="$1"
@@ -10424,6 +10465,7 @@ function bootstrap_ccloud_environment () {
1042410465
export WARMUP_TIME=15
1042510466
export QUIET=true
1042610467

10468+
log "💡 if you notice that the playground is using unexpected ccloud details, use <playground cleanup-cloud-details> to remove all caching and re-launch the example"
1042710469
check_if_continue
1042810470
else
1042910471
#
@@ -10446,6 +10488,8 @@ function bootstrap_ccloud_environment () {
1044610488
log "🌤 CLUSTER_CLOUD is set with $CLUSTER_CLOUD"
1044710489
log "🗺 CLUSTER_REGION is set with $CLUSTER_REGION"
1044810490

10491+
log "💡 if you notice that the playground is using unexpected ccloud details, use <playground cleanup-cloud-details> to remove all caching and re-launch the example"
10492+
1044910493
for row in $(confluent kafka cluster list --output json | jq -r '.[] | @base64'); do
1045010494
_jq() {
1045110495
echo ${row} | base64 -d | jq -r ${1}
@@ -15380,7 +15424,14 @@ playground_run_command() {
1538015424
IFS=$'\n' flag_string="${array_flag_list[*]}"
1538115425
IFS=$oldifs
1538215426

15383-
preview="${ccloud_preview}\n${missing_env}\n🚀 number of examples ran so far: $(get_cli_metric nb_runs)\n\n⛳ flag list:\n$flag_string\n"
15427+
arm64_support=$(arm64_support)
15428+
15429+
if [[ "$arm64_support" == *"❌"* ]]
15430+
then
15431+
unset 'options[0]'
15432+
options[1]="❌🖥️ this example is not working with ARM64 !"
15433+
fi
15434+
preview="${ccloud_preview}\n${missing_env}\n${arm64_support}\n🚀 number of examples ran so far: $(get_cli_metric nb_runs)\n\n⛳ flag list:\n$flag_string\n"
1538415435
res=$(printf '%s\n' "${options[@]}" | fzf --multi --margin=1%,1%,1%,1% $fzf_option_rounded --info=inline --cycle --prompt="🚀" --header="select option(s) for $example (use tab to select more than one)" --color="bg:-1,bg+:-1,info:#BDBB72,border:#FFFFFF,spinner:0,hl:#beb665,fg:#00f7f7,header:#5CC9F5,fg+:#beb665,pointer:#E12672,marker:#5CC9F5,prompt:#98BEDE" $fzf_option_wrap $fzf_option_pointer --preview "echo -e \"$preview\"")
1538515436

1538615437
if [[ $res == *"$MENU_LETS_GO"* ]]

scripts/cli/src/commands/run.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,14 @@ then
944944
IFS=$'\n' flag_string="${array_flag_list[*]}"
945945
IFS=$oldifs
946946

947-
preview="${ccloud_preview}\n${missing_env}\n🚀 number of examples ran so far: $(get_cli_metric nb_runs)\n\n⛳ flag list:\n$flag_string\n"
947+
arm64_support=$(arm64_support)
948+
949+
if [[ "$arm64_support" == *""* ]]
950+
then
951+
unset 'options[0]'
952+
options[1]="❌🖥️ this example is not working with ARM64 !"
953+
fi
954+
preview="${ccloud_preview}\n${missing_env}\n${arm64_support}\n🚀 number of examples ran so far: $(get_cli_metric nb_runs)\n\n⛳ flag list:\n$flag_string\n"
948955
res=$(printf '%s\n' "${options[@]}" | fzf --multi --margin=1%,1%,1%,1% $fzf_option_rounded --info=inline --cycle --prompt="🚀" --header="select option(s) for $example (use tab to select more than one)" --color="bg:-1,bg+:-1,info:#BDBB72,border:#FFFFFF,spinner:0,hl:#beb665,fg:#00f7f7,header:#5CC9F5,fg+:#beb665,pointer:#E12672,marker:#5CC9F5,prompt:#98BEDE" $fzf_option_wrap $fzf_option_pointer --preview "echo -e \"$preview\"")
949956

950957
if [[ $res == *"$MENU_LETS_GO"* ]]

scripts/cli/src/lib/cli_function.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,4 +1644,44 @@ function open_file_with_editor() {
16441644
logerror "❌ editor \"$editor\" is not installed - you can change editor by using \"playground config set editor <editor>\""
16451645
exit 1
16461646
fi
1647+
}
1648+
1649+
function arm64_support() {
1650+
1651+
test_file=$(playground state get run.test_file)
1652+
1653+
if [ ! -f $test_file ]
1654+
then
1655+
return
1656+
fi
1657+
1658+
set +e
1659+
if [ "$(uname -m)" = "arm64" ]
1660+
then
1661+
base_folder=$(basename $(dirname $(dirname $test_file)))
1662+
base_test=$(basename $(dirname $test_file))
1663+
if [ "$base_folder" == "reproduction-models" ]
1664+
then
1665+
base_test=${base_test#*-}
1666+
fi
1667+
1668+
grep "${base_test}" ${root_folder}/scripts/arm64-support-none.txt > /dev/null
1669+
if [ $? = 0 ]
1670+
then
1671+
echo "❌🖥️ this example is not working with ARM64 !"
1672+
echo "❌🖥️ it is highly recommended to use 'playground ec2 command' to run the example on ubuntu ec2 instance"
1673+
echo "❌🖥️ you can also use gitpod"
1674+
return
1675+
fi
1676+
1677+
grep "${base_test}" ${root_folder}/scripts/arm64-support-with-emulation.txt > /dev/null
1678+
if [ $? = 0 ]
1679+
then
1680+
echo "☑️🖥️ this example is working with ARM64 but requires emulation"
1681+
return
1682+
fi
1683+
1684+
echo "✅🖥️ this example should work natively with ARM64"
1685+
fi
1686+
set -e
16471687
}

0 commit comments

Comments
 (0)