Add extension using new source instead of currently publicly available one. (#284)

* run linter on latest new index entry

* fix

* add logic for empty line
This commit is contained in:
Willie Xu 2018-09-06 14:09:54 -07:00 коммит произвёл GitHub
Родитель b619cd2e06
Коммит 5288001d27
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 25 добавлений и 10 удалений

Просмотреть файл

@ -5,7 +5,7 @@
import json
import subprocess
from pkg_resources import parse_version
public_index = json.loads(subprocess.check_output('az extension list-available -d', shell=True))
@ -13,5 +13,13 @@ with open('./src/index.json', 'r') as myfile:
curr_index = json.loads(myfile.read()).get("extensions")
for extension in curr_index:
if curr_index[extension] != public_index.get(extension):
print(extension)
new_entries = [entry for entry in curr_index[extension] if entry not in public_index.get(extension, [])]
if not new_entries:
continue # no change in index for extension or entries were deleted
# new_entry = []
# for entry in curr_index[extension]:
# if entry not in public_index.get(extension, []):
# new_sources.append(entry['downloadUrl'])
latest_new_entry = max(new_entries, key=lambda c: parse_version(c['metadata']['version']))
print('{} {}'.format(extension, latest_new_entry['downloadUrl']))

Просмотреть файл

@ -11,18 +11,25 @@ set +x
# check for index updates
modified_extensions=$(python ./scripts/ci/index_changes.py)
echo "Found the following modified extensions:"
echo "Found the following modified extension entries:"
echo "$modified_extensions"
# run linter on each modified extension
for ext in $modified_extensions; do
# run linter on each modified extension entry
while read line; do
if [ -z "$line" ]; then
continue
fi
part_array=($line)
ext=${part_array[0]}
source=${part_array[1]}
echo
echo "Adding extension:" $ext
az extension add -n $ext
echo "Running linter on extension:" $ext
echo "New index entries detected for extension:" $ext
echo "Adding latest entry from source:" $source
az extension add -s $source -y
echo "Running linter"
azdev cli-lint --ci --extensions $ext
az extension remove -n $ext
echo $ext "extension has been removed."
done
done <<< "$modified_extensions"
echo "OK. Completed Linting"