diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ba737fd07cc..98e563b8392 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -525,6 +525,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..c5e7af35878 --- /dev/null +++ b/scripts/ci/test_extensions_dependency.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +python3 -m venv env +source env/bin/activate +pip install --upgrade pip +source ./scripts/install_full.sh + +cp -r env/lib lib_backup + +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) + +ignore_list='attestation cloud-service functionapp serial-console' + +exit_code=0 +for ext in $output; do + echo + + echo "Verifying extension:" $ext + 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 + # 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 -ar --delete "lib_backup/" "env/lib" + source env/bin/activate + +done + + +exit $exit_code