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:
Родитель
b619cd2e06
Коммит
5288001d27
|
@ -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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче