From 71f3f327dbdb1907ff531fe3c49f00fabb2cdb1f Mon Sep 17 00:00:00 2001 From: Ryan K Date: Tue, 28 Sep 2021 17:55:08 -0700 Subject: [PATCH] Pipeline updates (#437) Pipeline improvements * Added python versioning parameters to nightly pipeline * Added test enable/disable switches to nightly pipeline * Added windows MSI test environment to nightly pipeline * Modified nightly parameter defaults * Remove azure subscription parameter - use 'AzureServiceConnection' value from variable group * Remove azure-cli edge tests * Parameterize variable group in create-release pipeline --- .azure-devops/create-release.yml | 14 ++-- .azure-devops/nightly.yml | 68 ++++++++++++++----- .../templates/install-azure-cli-edge.yml | 3 - .../templates/install-azure-cli-msi.yml | 10 +++ .azure-devops/templates/nightly-tests.yml | 24 +++++-- .../templates/run-tests-parallel.yml | 4 +- .../templates/setup-dev-test-env.yml | 10 +-- 7 files changed, 91 insertions(+), 42 deletions(-) delete mode 100644 .azure-devops/templates/install-azure-cli-edge.yml create mode 100644 .azure-devops/templates/install-azure-cli-msi.yml diff --git a/.azure-devops/create-release.yml b/.azure-devops/create-release.yml index 267b42f83..fbf7d9904 100644 --- a/.azure-devops/create-release.yml +++ b/.azure-devops/create-release.yml @@ -3,6 +3,9 @@ pr: none trigger: none parameters: +- name: variableGroup + type: string + default: 'aziotcli_test_primary' - name: vmImage type: string default: 'ubuntu-18.04' @@ -31,9 +34,9 @@ parameters: - name: 'testHub' type: boolean default: true -- name: azureSubscription - type: string - default: 'AzIoTCLIService' + +variables: + - group: ${{ parameters.variableGroup }} stages: - stage: 'build' @@ -93,7 +96,6 @@ stages: parameters: path: 'azext_iot/tests/central' name: 'iot-central' - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testADT' @@ -104,7 +106,6 @@ stages: parameters: path: 'azext_iot/tests/digitaltwins' name: 'azure-digitaltwins' - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testDPS' @@ -115,7 +116,6 @@ stages: parameters: path: 'azext_iot/tests/dps' name: 'device-provisioning-service' - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testHub_job_1' @@ -126,7 +126,6 @@ stages: parameters: path: 'azext_iot/tests/iothub/configurations azext_iot/tests/iothub/core azext_iot/tests/iothub/jobs' name: 'iot-hub-1' - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testHub_job_2' @@ -137,7 +136,6 @@ stages: parameters: path: 'azext_iot/tests/iothub/devices azext_iot/tests/iothub/messaging azext_iot/tests/iothub/modules' name: 'iot-hub-2' - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'unitTests' diff --git a/.azure-devops/nightly.yml b/.azure-devops/nightly.yml index b0adc019f..cd3a40046 100644 --- a/.azure-devops/nightly.yml +++ b/.azure-devops/nightly.yml @@ -1,15 +1,11 @@ -# Run nightly at midnight. +# Run nightly at midnight (Pacific). schedules: -- cron: "0 0 * * *" +- cron: "0 7 * * *" displayName: Nightly Integration Build branches: include: - dev -variables: - pythonVersion: '3.6.x' - architecture: 'x64' - parameters: - name: vmImage type: string @@ -17,6 +13,35 @@ parameters: values: - 'ubuntu-18.04' - 'ubuntu-latest' +- name: pythonVersion + type: string + default: '3.8.x' + values: + - '3.6.x' + - '3.8.x' + - '3.9.x' +- name: architecture + type: string + default: 'x64' +- name: 'testCentral' + type: boolean + default: true +- name: 'testADT' + type: boolean + default: true +- name: 'testDPS' + type: boolean + default: true +- name: 'testHub' + type: boolean + default: true + +variables: + - group: aziotcli_test_nightly + - name: pythonVersion + value: ${{ parameters.pythonVersion }} + - name: architecture + value: ${{ parameters.architecture }} stages: - stage: 'build' @@ -62,31 +87,39 @@ stages: - template: templates/install-and-record-version.yml - - stage: 'test_edge' - displayName: 'Run all tests with edge CLI' + - stage: 'test_min' + displayName: 'Run all tests with min CLI' pool: vmImage: ${{ parameters.vmImage }} dependsOn: build jobs: - template: templates/nightly-tests.yml parameters: - azureCLIVersion: edge + azureCLIVersion: min pythonVersion: $(pythonVersion) - - - stage: 'test_min' - displayName: 'Run all tests with min CLI' + testADT: ${{ parameters.testADT }} + testCentral: ${{ parameters.testCentral }} + testDPS: ${{ parameters.testDPS }} + testHub: ${{ parameters.testHub }} + + - stage: 'test_msi' + displayName: 'Run all tests against Windows MSI install' pool: - vmImage: ${{ parameters.vmImage }} - dependsOn: test_edge + vmImage: 'vs2017-win2016' + dependsOn: test_min jobs: - template: templates/nightly-tests.yml parameters: - azureCLIVersion: min + azureCLIVersion: msi pythonVersion: $(pythonVersion) + testADT: ${{ parameters.testADT }} + testCentral: ${{ parameters.testCentral }} + testDPS: ${{ parameters.testDPS }} + testHub: ${{ parameters.testHub }} - stage: 'kpi' displayName: 'Build KPIs' - dependsOn: [build, test_edge, test_min] + dependsOn: [build, test_min, test_msi] jobs: - job: 'calculateCodeCoverage' displayName: 'Calculate distributed code coverage' @@ -94,5 +127,4 @@ stages: - template: templates/calculate-code-coverage.yml parameters: pythonVersion: $(pythonVersion) - architecture: $(architecture) - + architecture: $(architecture) \ No newline at end of file diff --git a/.azure-devops/templates/install-azure-cli-edge.yml b/.azure-devops/templates/install-azure-cli-edge.yml deleted file mode 100644 index fa61d5baf..000000000 --- a/.azure-devops/templates/install-azure-cli-edge.yml +++ /dev/null @@ -1,3 +0,0 @@ -steps: - - script: 'pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge' - displayName: 'Install Azure CLI edge' diff --git a/.azure-devops/templates/install-azure-cli-msi.yml b/.azure-devops/templates/install-azure-cli-msi.yml new file mode 100644 index 000000000..2ac397dee --- /dev/null +++ b/.azure-devops/templates/install-azure-cli-msi.yml @@ -0,0 +1,10 @@ +steps: + - script: choco install azure-cli + displayName: 'Install released azure-cli from MSI' + - task: PowerShell@2 + displayName: 'Set Windows MSI Python Executable PATH' + inputs: + targetType: 'inline' + script: | + echo "##vso[task.prependPath]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2" + echo "##vso[task.prependPath]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Scripts" \ No newline at end of file diff --git a/.azure-devops/templates/nightly-tests.yml b/.azure-devops/templates/nightly-tests.yml index bd278a153..c01c3c47e 100644 --- a/.azure-devops/templates/nightly-tests.yml +++ b/.azure-devops/templates/nightly-tests.yml @@ -11,58 +11,71 @@ parameters: values: - min - released - - edge + - msi - name: azureSubscription type: string default: 'az_cli_nightly_conn' +- name: 'testCentral' + type: boolean + default: true +- name: 'testADT' + type: boolean + default: true +- name: 'testDPS' + type: boolean + default: true +- name: 'testHub' + type: boolean + default: true jobs: - job: 'testCentral' displayName: 'Test IoT Central' + condition: eq('${{ parameters.testCentral }}', true) steps: - template: run-tests-parallel.yml parameters: path: 'azext_iot/tests/central' name: 'iot-central' azureCLIVersion: ${{ parameters.azureCLIVersion }} - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testADT' displayName: 'Test Azure DigitalTwins' + condition: eq('${{ parameters.testADT }}', true) steps: - template: run-tests-parallel.yml parameters: path: 'azext_iot/tests/digitaltwins' name: 'azure-digitaltwins' azureCLIVersion: ${{ parameters.azureCLIVersion }} - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testDPS' displayName: 'Test DPS' + condition: eq('${{ parameters.testDPS }}', true) steps: - template: run-tests-parallel.yml parameters: path: 'azext_iot/tests/dps' name: 'device-provisioning-service' azureCLIVersion: ${{ parameters.azureCLIVersion }} - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testHub_job_1' displayName: 'Test IoT Hub - config, core and jobs' + condition: eq('${{ parameters.testHub }}', true) steps: - template: run-tests-parallel.yml parameters: path: 'azext_iot/tests/iothub/configurations azext_iot/tests/iothub/core azext_iot/tests/iothub/jobs' name: 'iot-hub-1' azureCLIVersion: ${{ parameters.azureCLIVersion }} - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'testHub_job_2' + condition: eq('${{ parameters.testHub }}', true) displayName: 'Test IoT Hub - devices, messaging and modules' steps: - template: run-tests-parallel.yml @@ -70,7 +83,6 @@ jobs: path: 'azext_iot/tests/iothub/devices azext_iot/tests/iothub/messaging azext_iot/tests/iothub/modules' name: 'iot-hub-2' azureCLIVersion: ${{ parameters.azureCLIVersion }} - azureSubscription: ${{ parameters.azureSubscription }} pythonVersion: ${{ parameters.pythonVersion }} - job: 'unitTests' diff --git a/.azure-devops/templates/run-tests-parallel.yml b/.azure-devops/templates/run-tests-parallel.yml index 3c13dc84a..80710cd40 100644 --- a/.azure-devops/templates/run-tests-parallel.yml +++ b/.azure-devops/templates/run-tests-parallel.yml @@ -17,7 +17,7 @@ parameters: values: - min - released - - edge + - msi - name: path type: string default: 'azext_iot/tests' @@ -76,7 +76,7 @@ steps: continueOnError: true displayName: '${{ parameters.name }} integration tests' inputs: - azureSubscription: ${{ parameters.azureSubscription }} + azureSubscription: $(AzureServiceConnection) scriptType: bash scriptLocation: inlineScript ${{ if containsValue(parameters.serial_execution_dirs, parameters.path) }}: diff --git a/.azure-devops/templates/setup-dev-test-env.yml b/.azure-devops/templates/setup-dev-test-env.yml index dd4a0d6b8..71d19ba99 100644 --- a/.azure-devops/templates/setup-dev-test-env.yml +++ b/.azure-devops/templates/setup-dev-test-env.yml @@ -11,7 +11,7 @@ parameters: values: - min - released - - edge + - msi steps: - task: UsePythonVersion@0 @@ -25,13 +25,13 @@ steps: - ${{ if eq(parameters.azureCLIVersion, 'released') }}: - template: install-azure-cli-released.yml - - ${{ if eq(parameters.azureCLIVersion, 'edge') }}: - - template: install-azure-cli-edge.yml - - - template: download-install-local-azure-test-sdk.yml + - ${{ if eq(parameters.azureCLIVersion, 'msi') }}: + - template: install-azure-cli-msi.yml - template: setup-ci-machine.yml + - template: download-install-local-azure-test-sdk.yml + - template: download-install-local-azure-iot-cli-extension.yml - template: set-pythonpath.yml