Skip to content

Commit

Permalink
[azdev] Upgrade linter to the public azdev mentioned at hotfix PR Azu…
Browse files Browse the repository at this point in the history
…re#1075 (Azure#1082)

* [azdev] Upgrade linter to the public azdev mentioned at hotfix PR Azure#1075

* Optimize readability
  • Loading branch information
Jianhui Harold authored and Zim Kalinowski committed Nov 18, 2019
1 parent ce8b000 commit 27d4ef5
Showing 1 changed file with 56 additions and 21 deletions.
77 changes: 56 additions & 21 deletions scripts/ci/verify_modified_index.sh
Original file line number Diff line number Diff line change
@@ -1,47 +1,82 @@
#!/usr/bin/env bash
set -ex
set -e


log_section_title()
{
printf "\n\n"
echo "********************************************************************************************"
echo "* ${1}"
echo "********************************************************************************************"
printf "\n"
}


# Install CLI
log_section_title "Cloning azure-cli ..."

# Install CLI & Dev Tools
echo "Installing azure-cli-dev-tools and azure-cli..."
git clone --single-branch -b dev https://github.com/Azure/azure-cli.git ../azure-cli


# Install azdev
log_section_title "Installing azure-cli-dev-tools ..."

pip install azdev
azdev setup -c ../azure-cli

echo "Installed."


log_section_title "Running az --version"

az --version
set +x

# check for index updates

# Check for index updates
log_section_title "Checking modified extensions ..."

modified_extensions=$(python ./scripts/ci/index_changes.py)
echo "Found the following modified extension entries:"
echo "$modified_extensions"

# run linter on each modified extension entry
while read line; do
if [ -z "$line" ]; then
if [ -z "${modified_extensions}" ]; then
echo "No modified extension needs to be verify."
else
echo "Found the following modified extension entries:"

while read -r line
do
arr=(${line})
printf "[ %-30s ] %-s\n" "${arr[0]}" "${arr[1]}"
done <<< "${modified_extensions}"
fi


# Run linter on each modified extension entry
while read -r line; do
if [ -z "${line}" ]; then
continue
fi

part_array=($line)
ext=${part_array[0]}
source=${part_array[1]}
echo
echo "New index entries detected for extension:" $ext
echo "Adding latest entry from source:" $source

az extension add -s $source -y
log_section_title "Verifying new entries detected for extension: [ ${ext} ]"

echo "Adding latest extension from: [ ${source} ]"

az extension add -s "${source}" -y

# TODO migrate to public azdev
echo "Load all commands..."
# echo "Load all commands..."
# azdev verify load-all

# TODO migrate to public azdev
echo "Running linter..."
# azdev cli-lint --ci --extensions $ext
echo "Running linter on extension: [ ${ext} ] ..."
azdev linter --include-whl-extensions "${ext}"

az extension remove -n $ext
az extension remove -n "${ext}"

echo $ext "extension has been removed."
echo "extension: [ ${ext} ] has been removed."
done <<< "$modified_extensions"

echo "OK. Completed Verification of Modified Extensions."

log_section_title "OK. Verification of Modified Extensions Completed."

0 comments on commit 27d4ef5

Please sign in to comment.