-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathbuild_ext_cmd_tree.sh
43 lines (35 loc) · 1.32 KB
/
build_ext_cmd_tree.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
changed_content=$(git --no-pager diff --diff-filter=ACMRT HEAD~$AZURE_EXTENSION_COMMIT_NUM -- src/index.json)
if [[ -z "$changed_content" ]]; then
echo "index.json not modified. End task."
exit 0
fi
pip install azure-cli-core azure-cli requests
pip install azure-storage-blob==1.5.0
echo "Listing Available Extensions:"
az extension list-available -otable
# turn off telemetry as it crowds output
export AZURE_CORE_COLLECT_TELEMETRY=False
# use index.json in master branch
export AZURE_EXTENSION_INDEX_URL=https://raw.githubusercontent.com/Azure/azure-cli-extensions/master/src/index.json
output=$(az extension list-available --query [].name -otsv)
# azure-cli-ml is replaced by ml
# TODO: azure-batch-cli-extensions is not compatible with latest batch SDK.
blocklist=("azure-cli-ml" "azure-batch-cli-extensions")
rm -f ~/.azure/extCmdTreeToUpload.json
filter_exts=""
for ext in $output; do
ext=${ext%$'\r'} # Remove a trailing newline when running on Windows.
if [[ " ${blocklist[@]} " =~ " ${ext} " ]]; then
continue
fi
filter_exts="${filter_exts} ${ext}"
echo "Adding extension:" $ext
az extension add --upgrade -n $ext
if [ $? != 0 ]
then
echo "Failed to load:" $ext
exit 1
fi
done
python $(cd $(dirname $0); pwd)/update_ext_cmd_tree.py $filter_exts