From 38e1c01370d88e8dc898380a68ae501ac93e0ff6 Mon Sep 17 00:00:00 2001 From: Hang Lei Date: Thu, 3 Nov 2022 15:52:08 +0800 Subject: [PATCH 1/3] Init --- azure-pipelines.yml | 19 +++++++++++++ scripts/ci/test_extensions_dependency.sh | 35 ++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 scripts/ci/test_extensions_dependency.sh diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c1db8d1077f..3acbbb91062 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -474,6 +474,25 @@ jobs: - bash: ./scripts/ci/test_extensions.sh displayName: 'Load extensions' +- job: TestExtensionsDependency + displayName: Test Extensions Dependency + condition: succeeded() + timeoutInMinutes: 40 + + pool: + name: ${{ variables.ubuntu_pool }} + strategy: + matrix: + Python310: + python.version: '3.10' + steps: + - task: UsePythonVersion@0 + displayName: 'Use Python $(python.version)' + inputs: + versionSpec: '$(python.version)' + - bash: ./scripts/ci/test_extensions_dependency.sh + displayName: 'Install extensions' + - job: BuildHomebrewFormula displayName: Build Homebrew Formula diff --git a/scripts/ci/test_extensions_dependency.sh b/scripts/ci/test_extensions_dependency.sh new file mode 100755 index 00000000000..06db9354fe1 --- /dev/null +++ b/scripts/ci/test_extensions_dependency.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +pwd +python3 -m venv env +source env/bin/activate +pip install --upgrade pip +source /scripts/install_full.sh + +echo "Listing Available Extensions:" +az extension list-available -otable + +# turn off telemetry as it crowds output +export AZURE_CLI_DIAGNOSTICS_TELEMETRY= + +output=$(az extension list-available --query [].name -otsv) + +exit_code=0 +for ext in $output; do + echo + # Use regex to detect if $ext is in $ignore_list + + echo "Verifying extension:" $ext + url=$(python -c 'from azure.cli.core.extension._resolve import resolve_from_index;print(resolve_from_index("$ext")[0])') + curl -O $url + pip install *.whl --dry-run + if [ $? != 0 ] + then + exit_code=1 + echo "Failed to install:" $ext + fi + rm *.whl + +done + + +exit $exit_code From b8c3d688c5311d482d93493f7a67aa9d2607ba57 Mon Sep 17 00:00:00 2001 From: Hang Lei Date: Mon, 7 Nov 2022 10:16:42 +0800 Subject: [PATCH 2/3] Minor fix --- scripts/ci/test_extensions_dependency.sh | 29 +++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/scripts/ci/test_extensions_dependency.sh b/scripts/ci/test_extensions_dependency.sh index 06db9354fe1..4617980cf78 100755 --- a/scripts/ci/test_extensions_dependency.sh +++ b/scripts/ci/test_extensions_dependency.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash -pwd python3 -m venv env source env/bin/activate pip install --upgrade pip -source /scripts/install_full.sh +source ./scripts/install_full.sh + +cp -r env/lib lib_backup echo "Listing Available Extensions:" az extension list-available -otable @@ -13,21 +14,33 @@ export AZURE_CLI_DIAGNOSTICS_TELEMETRY= output=$(az extension list-available --query [].name -otsv) +ignore_list='attestation cloud-service functionapp serial-console' + exit_code=0 for ext in $output; do echo - # Use regex to detect if $ext is in $ignore_list echo "Verifying extension:" $ext - url=$(python -c 'from azure.cli.core.extension._resolve import resolve_from_index;print(resolve_from_index("$ext")[0])') - curl -O $url - pip install *.whl --dry-run + url=$(python -c "from azure.cli.core.extension._resolve import resolve_from_index;print(resolve_from_index('$ext')[0])") + echo Download $url + curl -sOL $url + pip install *.whl + # pip still install new package even if conflict occurs, use pip check to verify + pip check if [ $? != 0 ] then - exit_code=1 - echo "Failed to install:" $ext + echo "Dependency conflict detected:" $ext + # Use regex to detect if $ext is in $ignore_list + if [[ $ignore_list =~ $ext ]]; then + echo "Ignore extension: $ext" + else + exit_code=1 + fi fi rm *.whl + deactivate + rsync -au --delete "lib_backup/" "env/lib" + source env/bin/activate done From c732da3d1ce57bf35723ad7b4bac25f7ac69baaf Mon Sep 17 00:00:00 2001 From: Hang Lei Date: Mon, 20 Feb 2023 17:03:42 +0800 Subject: [PATCH 3/3] Minor fix --- scripts/ci/test_extensions_dependency.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/test_extensions_dependency.sh b/scripts/ci/test_extensions_dependency.sh index 4617980cf78..c5e7af35878 100755 --- a/scripts/ci/test_extensions_dependency.sh +++ b/scripts/ci/test_extensions_dependency.sh @@ -29,17 +29,17 @@ for ext in $output; do pip check if [ $? != 0 ] then - echo "Dependency conflict detected:" $ext # Use regex to detect if $ext is in $ignore_list if [[ $ignore_list =~ $ext ]]; then echo "Ignore extension: $ext" else + echo "Dependency conflict detected:" $ext exit_code=1 fi fi rm *.whl deactivate - rsync -au --delete "lib_backup/" "env/lib" + rsync -ar --delete "lib_backup/" "env/lib" source env/bin/activate done