Fix E2E pipeline and increment the version (#17)

* Add parameters to script call

* fix e2e yml and some output

* fix source paths

* fix source paths

* line endings to Unix

* add unit test output + remove setup step for unit test pipeline

* Test local files

* Add copyrights

* Remove empty unit test files from yml

* Fix psot install validation bug

* Fix e2e cd location

* Quote angle brackets

* Allow for changes to propagate

* Set test result correctly on success

* Publish logs as artifacts

* Address PR feedback

* Remove log publishing

* Fix unit test source

* Fix unit test source

* Ubuntu 20.04 is not supported by this script
This commit is contained in:
Mariana Mihova 2021-05-18 20:55:37 -07:00 коммит произвёл GitHub
Родитель 769d4903cf
Коммит 033bb4d6b4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
20 изменённых файлов: 250 добавлений и 205 удалений

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

@ -63,7 +63,7 @@ function download_bash_script() {
} }
# script # script
printf "Running azure-iot-edge-installer.sh\n" > /dev/stdout printf "Welcome to azure-iot-edge-installer\n" > /dev/stdout
# if helper scripts dont exist, fetch via wget # if helper scripts dont exist, fetch via wget
if [ -d "iot-edge-installer" ]; if [ -d "iot-edge-installer" ];
@ -102,7 +102,7 @@ if [[ ${#@} > 0 && ${#parsed_cmds[*]} == 0 ]];
then then
array=("$*") array=("$*")
echo Unknown argument "${array[*]}" echo Unknown argument "${array[*]}"
echo Usage echo "Usage: sudo ./azure-iot-edge-installer.sh -s <IDScope> -r <RegistrationID> -k <Symmetric Key>"
exit 1 exit 1
fi fi
@ -111,7 +111,7 @@ then
echo Missing argument echo Missing argument
echo defined: "'"${!parsed_cmds[@]}"'" echo defined: "'"${!parsed_cmds[@]}"'"
echo given: "'"${parsed_cmds[@]}"'" echo given: "'"${parsed_cmds[@]}"'"
echo Usage echo "Usage: sudo ./azure-iot-edge-installer.sh -s <IDScope> -r <RegistrationID> -k <Symmetric Key>"
exit 1 exit 1
fi fi

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

@ -44,9 +44,9 @@ function validate_post_install() {
"aziot-certd" "aziot-certd"
"aziot-tpmd") "aziot-tpmd")
for i in "${iotedge_services[@]}" for service_name in "${iotedge_services[@]}"
do do
is_service_running ${iotedge_services[$i]} "$status" is_service_running $service_name "$status"
done done
log_info "Post install validation completed." log_info "Post install validation completed."

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

@ -1,4 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
###################################### ######################################
# test-devicestate # test-devicestate
# #
@ -127,10 +131,14 @@ scope_id=$(jq -r '.idScope' <<< "$creds")
primary_key=$(jq -r '.symmetricKey.primaryKey' <<< "$creds") primary_key=$(jq -r '.symmetricKey.primaryKey' <<< "$creds")
echo Run the Azure IoT Edge Installer echo Run the Azure IoT Edge Installer
wget https://github.com/Azure/iot-edge-config/releases/latest/download/azure-iot-edge-installer.sh \ #wget -O azure-iot-edge-installer.sh https://github.com/Azure/iot-edge-config/releases/latest/download/azure-iot-edge-installer.sh \
&& chmod +x azure-iot-edge-installer.sh \ cd ./../../src
&& ./azure-iot-edge-installer.sh \ chmod +x azure-iot-edge-installer.sh
&& rm -rf azure-iot-edge-installer.sh sudo LOCAL_E2E=1 ./azure-iot-edge-installer.sh --scope-id "$scope_id" --registration-id "$device_id" --symmetric-key "$primary_key"
rm -rf azure-iot-edge-installer.sh
# give 2 mins for changes to propagate to central app
sleep 120
# device state should be provisioned after running the script # device state should be provisioned after running the script
out=$(curl -X GET -H "Authorization:$apiToken" https://${centralapp_name}.azureiotcentral.com/api/preview/devices/${device_id}) out=$(curl -X GET -H "Authorization:$apiToken" https://${centralapp_name}.azureiotcentral.com/api/preview/devices/${device_id})
@ -143,10 +151,10 @@ then
echo "Error: Device must be provisioned. Exit."; echo "Error: Device must be provisioned. Exit.";
else else
echo "Device is provisioned as expected. Success."; echo "Device is provisioned as expected. Success.";
$test_result=0 # success test_result=0 # success
fi; fi;
# Clean up # Clean up
cleanup "$armToken" "$apiToken" "$device_id" "$token_id" "$rg" "$centralapp_name" cleanup "$armToken" "$apiToken" "$device_id" "$token_id" "$rg" "$centralapp_name"
echo test_result: $test_result
exit $test_result exit $test_result

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

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
###################################### ######################################
# perf_tests # perf_tests
# #

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

@ -1,5 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse import argparse
import sys import sys

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

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
if command -v tput &>/dev/null && tty -s; then if command -v tput &>/dev/null && tty -s; then
RED=$(tput setaf 1) RED=$(tput setaf 1)
GREEN=$(tput setaf 2) GREEN=$(tput setaf 2)

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

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
###################################### ######################################
# track_duration # track_duration
# #

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

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# import utils.sh # import utils.sh
source ../../src/utils.sh source ../../src/utils.sh

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

@ -1,2 +0,0 @@
#script
echo "Running test-install-container-management.sh"

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

@ -1,2 +0,0 @@
#script to install edge runtime 1.2
echo "Running test-install-edge-runtime.sh"

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

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
exec 3>&1 exec 3>&1
# bring in the utils library # bring in the utils library

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

@ -1,7 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source src/validate-post-install.sh # Copyright (c) Microsoft Corporation.
source tests/test_utils.sh # Licensed under the MIT License.
source ../../src/utils.sh
source ../../src/validate-post-install.sh
source ../test_utils.sh
test_service_running() { test_service_running() {
is_service_running "servicenameA" "servicenameA Running" is_service_running "servicenameA" "servicenameA Running"
@ -28,6 +32,11 @@ test_service_casesensitive() {
assert_eq 0 $? assert_eq 0 $?
} }
test_service_casesensitive() {
is_service_running "servicenameA" "servicenameA ruNNing"
assert_eq 0 $?
}
# run tests # run tests
test_service_running test_service_running
test_service_ready test_service_ready

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

@ -1,7 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source src/validate-tier1-os.sh # Copyright (c) Microsoft Corporation.
source tests/test_utils.sh # Licensed under the MIT License.
source ../../src/utils.sh
source ../../src/validate-tier1-os.sh
source ../test_utils.sh
test_ubuntu1804() { test_ubuntu1804() {
ID="ubuntu" ID="ubuntu"

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

@ -1,46 +1,49 @@
# Starter pipeline # Copyright (c) Microsoft Corporation.
# Start with a minimal pipeline that you can customize to build and deploy your code. # Licensed under the MIT License.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml # Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
trigger: # Add steps that build, run tests, deploy, and more:
- main # https://aka.ms/yaml
stages: trigger:
- stage: E2ETest - main
displayName: E2E Tests
jobs: stages:
- job: SetupScript - stage: E2ETest
steps: displayName: E2E Tests
- script: | jobs:
sudo apt update - job: SetupScript
sudo apt install jq steps:
displayName: 'Install jq' - script: |
- task: AzureCLI@2 sudo apt update
inputs: sudo apt install jq
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config' displayName: 'Install jq'
scriptType: 'bash' - task: AzureCLI@2
scriptLocation: 'inlineScript' inputs:
inlineScript: | azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
az upgrade scriptType: 'bash'
az extension add --name azure-iot scriptLocation: 'inlineScript'
az --version inlineScript: |
az account set -s $(AzureSubscriptionId) az upgrade
displayName: 'Set Azure resources' az extension add --name azure-iot
az --version
- job: LinuxE2ETests az account set -s $(AzureSubscriptionId)
pool: displayName: 'Set Azure resources'
vmImage: ubuntu-18.04
steps: - job: LinuxE2ETests
- template: continuous-e2e.yml pool:
dependsOn: SetupScript vmImage: ubuntu-18.04
condition: succeeded() steps:
- template: continuous-e2e.yml
- job: RaspberryPiE2ETests dependsOn: SetupScript
pool: condition: succeeded()
vmImage: ubuntu-latest
steps: - job: RaspberryPiE2ETests
- template: continuous-e2e.yml pool:
dependsOn: SetupScript vmImage: ubuntu-18.04
condition: succeeded() steps:
- template: continuous-e2e.yml
dependsOn: SetupScript
condition: succeeded()

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

@ -1,46 +1,49 @@
# Starter pipeline # Copyright (c) Microsoft Corporation.
# Start with a minimal pipeline that you can customize to build and deploy your code. # Licensed under the MIT License.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml # Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
trigger: # Add steps that build, run tests, deploy, and more:
- main # https://aka.ms/yaml
stages: trigger:
- stage: PERFTests - main
displayName: Performance Tests
jobs: stages:
- job: SetupScript - stage: PERFTests
steps: displayName: Performance Tests
- script: | jobs:
sudo apt update - job: SetupScript
sudo apt install jq steps:
displayName: 'Install jq' - script: |
- task: AzureCLI@2 sudo apt update
inputs: sudo apt install jq
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config' displayName: 'Install jq'
scriptType: 'bash' - task: AzureCLI@2
scriptLocation: 'inlineScript' inputs:
inlineScript: | azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
az config set extension.use_dynamic_install=yes_without_prompt scriptType: 'bash'
az extension add --name azure-iot scriptLocation: 'inlineScript'
az --version inlineScript: |
az account set -s $(AzureSubscriptionId) az config set extension.use_dynamic_install=yes_without_prompt
displayName: 'Set Azure resources' az extension add --name azure-iot
az --version
- job: LinuxPerfTests az account set -s $(AzureSubscriptionId)
pool: displayName: 'Set Azure resources'
vmImage: ubuntu-18.04
steps: - job: LinuxPerfTests
- template: continuous-perf.yml pool:
dependsOn: SetupScript vmImage: ubuntu-18.04
condition: succeeded() steps:
- template: continuous-perf.yml
- job: RaspberryPiPerfTests dependsOn: SetupScript
pool: condition: succeeded()
vmImage: ubuntu-latest
steps: - job: RaspberryPiPerfTests
- template: continuous-perf.yml pool:
dependsOn: SetupScript vmImage: ubuntu-latest
condition: succeeded() steps:
- template: continuous-perf.yml
dependsOn: SetupScript
condition: succeeded()

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

@ -1,53 +1,51 @@
# Starter pipeline # Copyright (c) Microsoft Corporation.
# Start with a minimal pipeline that you can customize to build and deploy your code. # Licensed under the MIT License.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml # Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
trigger: # Add steps that build, run tests, deploy, and more:
- main # https://aka.ms/yaml
stages: trigger:
- stage: UnitTest - main
displayName: Unit Tests
jobs: stages:
- job: SetupScript - stage: UnitTest
steps: displayName: Unit Tests
- script: echo Hello, world! jobs:
displayName: 'Run a one-line script' - job: LinuxUnitTests
pool:
- job: LinuxUnitTests vmImage: ubuntu-18.04
pool: steps:
vmImage: ubuntu-18.04 - template: linux/continuous-linux.yml
steps:
- template: linux/continuous-linux.yml - job: RaspberryPiUnitTests
pool:
- job: RaspberryPiUnitTests vmImage: ubuntu-latest
pool: steps:
vmImage: ubuntu-latest - template: raspi/continuous-raspi.yml
steps:
- template: raspi/continuous-raspi.yml - job: GithubRelease
dependsOn:
- job: GithubRelease - LinuxUnitTests
dependsOn: - RaspberryPiUnitTests
- LinuxUnitTests condition: and(succeeded('LinuxUnitTests'), succeeded('RaspberryPiUnitTests'))
- RaspberryPiUnitTests steps:
condition: and(succeeded('LinuxUnitTests'), succeeded('RaspberryPiUnitTests')) - script: |
steps: mkdir dest
- script: | cp src/*.sh dest/
mkdir dest displayName: Create dest/ directory
cp src/*.sh dest/ - task: GitHubRelease@1
displayName: Create dest/ directory displayName: 'GitHub release (create) RC'
- task: GitHubRelease@1 inputs:
displayName: 'GitHub release (create) RC' gitHubConnection: 'github.com_cindydeng1998'
inputs: tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$'
gitHubConnection: 'github.com_cindydeng1998' assets: 'dest/*.sh'
tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$' isDraft: true
assets: 'dest/*.sh' - task: GitHubRelease@1
isDraft: true displayName: 'GitHub release (create)'
- task: GitHubRelease@1 inputs:
displayName: 'GitHub release (create)' gitHubConnection: 'github.com_cindydeng1998'
inputs: tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+$'
gitHubConnection: 'github.com_cindydeng1998' assets: 'dest/*.sh'
tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+$'
assets: 'dest/*.sh'
isDraft: true isDraft: true

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

@ -1,12 +1,14 @@
steps: # Copyright (c) Microsoft Corporation.
- task: AzureCLI@2 # Licensed under the MIT License.
inputs:
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config' steps:
scriptType: 'bash' - task: AzureCLI@2
scriptLocation: 'inlineScript' inputs:
inlineScript: | azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
cd tests/e2e-tests scriptType: 'bash'
chmod +x test-devicestate.sh scriptLocation: 'inlineScript'
./test-devicestate.sh $(AzureSubscriptionId) inlineScript: |
displayName: 'Run All E2E Tests' cd tests/e2e-tests
chmod +x test-devicestate.sh
./test-devicestate.sh $(AzureSubscriptionId)
displayName: 'Run All E2E Tests'

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

@ -1,25 +1,28 @@
steps: # Copyright (c) Microsoft Corporation.
- task: UsePythonVersion@0 # Licensed under the MIT License.
displayName: "Use Python 3.8"
inputs: steps:
versionSpec: 3.8 - task: UsePythonVersion@0
displayName: "Use Python 3.8"
- task: AzureCLI@2 inputs:
displayName: 'Run All Performance Tests' versionSpec: 3.8
inputs:
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config' - task: AzureCLI@2
scriptType: 'bash' displayName: 'Run All Performance Tests'
scriptLocation: 'inlineScript' inputs:
inlineScript: | azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
cd tests scriptType: 'bash'
python3 --version scriptLocation: 'inlineScript'
pip3 --version inlineScript: |
pip3 install -r requirements.txt cd tests
chmod +x ./track_duration.sh python3 --version
chmod +x ./perf_tests.sh pip3 --version
chmod +x ./e2e-tests/test-devicestate.sh pip3 install -r requirements.txt
az config set extension.use_dynamic_install=yes_without_prompt chmod +x ./track_duration.sh
az extension add --name azure-iot chmod +x ./perf_tests.sh
az --version chmod +x ./e2e-tests/test-devicestate.sh
az account set -s $(AzureSubscriptionId) az config set extension.use_dynamic_install=yes_without_prompt
az extension add --name azure-iot
az --version
az account set -s $(AzureSubscriptionId)
./perf_tests.sh $(NumberOfRuns) ./perf_tests.sh $(NumberOfRuns)

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

@ -1,12 +1,13 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
steps: steps:
- script: echo Hello Linux! - script: echo Hello Linux!
displayName: 'Echo Hello Linux' displayName: 'Echo Hello Linux'
- script: | - script: |
cd tests/unit-tests cd tests/unit-tests
chmod +x ./*.sh chmod +x ./*.sh
./test-install-container-management.sh
./test-install-edge-runtime.sh
./test-validate-post-install.sh ./test-validate-post-install.sh
./test-validate-tier1-os.sh ./test-validate-tier1-os.sh
./test-cmd-parser.sh ./test-cmd-parser.sh

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

@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
steps: steps:
- script: echo Hello Raspi! - script: echo Hello Raspi!
displayName: 'Echo Hello Raspi!' displayName: 'Echo Hello Raspi!'
@ -5,11 +8,8 @@ steps:
- script: | - script: |
cd tests/unit-tests cd tests/unit-tests
chmod +x ./*.sh chmod +x ./*.sh
./test-install-container-management.sh
./test-install-edge-runtime.sh
./test-validate-post-install.sh ./test-validate-post-install.sh
./test-validate-tier1-os.sh ./test-validate-tier1-os.sh
./test-cmd-parser.sh ./test-cmd-parser.sh
./test-logger.sh ./test-logger.sh
displayName: 'Run All Raspberry Pi Unit Tests' displayName: 'Run All Raspberry Pi Unit Tests'