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:
Родитель
769d4903cf
Коммит
033bb4d6b4
|
@ -63,7 +63,7 @@ function download_bash_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 [ -d "iot-edge-installer" ];
|
||||
|
@ -102,7 +102,7 @@ if [[ ${#@} > 0 && ${#parsed_cmds[*]} == 0 ]];
|
|||
then
|
||||
array=("$*")
|
||||
echo Unknown argument "${array[*]}"
|
||||
echo Usage
|
||||
echo "Usage: sudo ./azure-iot-edge-installer.sh -s <IDScope> -r <RegistrationID> -k <Symmetric Key>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -111,7 +111,7 @@ then
|
|||
echo Missing argument
|
||||
echo defined: "'"${!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
|
||||
fi
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ function validate_post_install() {
|
|||
"aziot-certd"
|
||||
"aziot-tpmd")
|
||||
|
||||
for i in "${iotedge_services[@]}"
|
||||
for service_name in "${iotedge_services[@]}"
|
||||
do
|
||||
is_service_running ${iotedge_services[$i]} "$status"
|
||||
is_service_running $service_name "$status"
|
||||
done
|
||||
|
||||
log_info "Post install validation completed."
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
######################################
|
||||
# test-devicestate
|
||||
#
|
||||
|
@ -127,10 +131,14 @@ scope_id=$(jq -r '.idScope' <<< "$creds")
|
|||
primary_key=$(jq -r '.symmetricKey.primaryKey' <<< "$creds")
|
||||
|
||||
echo Run the Azure IoT Edge Installer
|
||||
wget https://github.com/Azure/iot-edge-config/releases/latest/download/azure-iot-edge-installer.sh \
|
||||
&& chmod +x azure-iot-edge-installer.sh \
|
||||
&& ./azure-iot-edge-installer.sh \
|
||||
&& rm -rf 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 \
|
||||
cd ./../../src
|
||||
chmod +x 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
|
||||
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.";
|
||||
else
|
||||
echo "Device is provisioned as expected. Success.";
|
||||
$test_result=0 # success
|
||||
test_result=0 # success
|
||||
fi;
|
||||
|
||||
# Clean up
|
||||
cleanup "$armToken" "$apiToken" "$device_id" "$token_id" "$rg" "$centralapp_name"
|
||||
echo test_result: $test_result
|
||||
|
||||
exit $test_result
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
######################################
|
||||
# perf_tests
|
||||
#
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
if command -v tput &>/dev/null && tty -s; then
|
||||
RED=$(tput setaf 1)
|
||||
GREEN=$(tput setaf 2)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
######################################
|
||||
# track_duration
|
||||
#
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# import 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
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
exec 3>&1
|
||||
|
||||
# bring in the utils library
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source src/validate-post-install.sh
|
||||
source tests/test_utils.sh
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
source ../../src/utils.sh
|
||||
source ../../src/validate-post-install.sh
|
||||
source ../test_utils.sh
|
||||
|
||||
test_service_running() {
|
||||
is_service_running "servicenameA" "servicenameA Running"
|
||||
|
@ -28,6 +32,11 @@ test_service_casesensitive() {
|
|||
assert_eq 0 $?
|
||||
}
|
||||
|
||||
test_service_casesensitive() {
|
||||
is_service_running "servicenameA" "servicenameA ruNNing"
|
||||
assert_eq 0 $?
|
||||
}
|
||||
|
||||
# run tests
|
||||
test_service_running
|
||||
test_service_ready
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source src/validate-tier1-os.sh
|
||||
source tests/test_utils.sh
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
source ../../src/utils.sh
|
||||
source ../../src/validate-tier1-os.sh
|
||||
source ../test_utils.sh
|
||||
|
||||
test_ubuntu1804() {
|
||||
ID="ubuntu"
|
||||
|
|
|
@ -1,46 +1,49 @@
|
|||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
stages:
|
||||
- stage: E2ETest
|
||||
displayName: E2E Tests
|
||||
jobs:
|
||||
- job: SetupScript
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt update
|
||||
sudo apt install jq
|
||||
displayName: 'Install jq'
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
az upgrade
|
||||
az extension add --name azure-iot
|
||||
az --version
|
||||
az account set -s $(AzureSubscriptionId)
|
||||
displayName: 'Set Azure resources'
|
||||
|
||||
- job: LinuxE2ETests
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: continuous-e2e.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
- job: RaspberryPiE2ETests
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- template: continuous-e2e.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
stages:
|
||||
- stage: E2ETest
|
||||
displayName: E2E Tests
|
||||
jobs:
|
||||
- job: SetupScript
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt update
|
||||
sudo apt install jq
|
||||
displayName: 'Install jq'
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
az upgrade
|
||||
az extension add --name azure-iot
|
||||
az --version
|
||||
az account set -s $(AzureSubscriptionId)
|
||||
displayName: 'Set Azure resources'
|
||||
|
||||
- job: LinuxE2ETests
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: continuous-e2e.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
- job: RaspberryPiE2ETests
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: continuous-e2e.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
|
|
|
@ -1,46 +1,49 @@
|
|||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
stages:
|
||||
- stage: PERFTests
|
||||
displayName: Performance Tests
|
||||
jobs:
|
||||
- job: SetupScript
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt update
|
||||
sudo apt install jq
|
||||
displayName: 'Install jq'
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
az config set extension.use_dynamic_install=yes_without_prompt
|
||||
az extension add --name azure-iot
|
||||
az --version
|
||||
az account set -s $(AzureSubscriptionId)
|
||||
displayName: 'Set Azure resources'
|
||||
|
||||
- job: LinuxPerfTests
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: continuous-perf.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
- job: RaspberryPiPerfTests
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- template: continuous-perf.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
stages:
|
||||
- stage: PERFTests
|
||||
displayName: Performance Tests
|
||||
jobs:
|
||||
- job: SetupScript
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt update
|
||||
sudo apt install jq
|
||||
displayName: 'Install jq'
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
az config set extension.use_dynamic_install=yes_without_prompt
|
||||
az extension add --name azure-iot
|
||||
az --version
|
||||
az account set -s $(AzureSubscriptionId)
|
||||
displayName: 'Set Azure resources'
|
||||
|
||||
- job: LinuxPerfTests
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: continuous-perf.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
- job: RaspberryPiPerfTests
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- template: continuous-perf.yml
|
||||
dependsOn: SetupScript
|
||||
condition: succeeded()
|
||||
|
||||
|
|
|
@ -1,53 +1,51 @@
|
|||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
stages:
|
||||
- stage: UnitTest
|
||||
displayName: Unit Tests
|
||||
jobs:
|
||||
- job: SetupScript
|
||||
steps:
|
||||
- script: echo Hello, world!
|
||||
displayName: 'Run a one-line script'
|
||||
|
||||
- job: LinuxUnitTests
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: linux/continuous-linux.yml
|
||||
|
||||
- job: RaspberryPiUnitTests
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- template: raspi/continuous-raspi.yml
|
||||
|
||||
- job: GithubRelease
|
||||
dependsOn:
|
||||
- LinuxUnitTests
|
||||
- RaspberryPiUnitTests
|
||||
condition: and(succeeded('LinuxUnitTests'), succeeded('RaspberryPiUnitTests'))
|
||||
steps:
|
||||
- script: |
|
||||
mkdir dest
|
||||
cp src/*.sh dest/
|
||||
displayName: Create dest/ directory
|
||||
- task: GitHubRelease@1
|
||||
displayName: 'GitHub release (create) RC'
|
||||
inputs:
|
||||
gitHubConnection: 'github.com_cindydeng1998'
|
||||
tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$'
|
||||
assets: 'dest/*.sh'
|
||||
isDraft: true
|
||||
- task: GitHubRelease@1
|
||||
displayName: 'GitHub release (create)'
|
||||
inputs:
|
||||
gitHubConnection: 'github.com_cindydeng1998'
|
||||
tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+$'
|
||||
assets: 'dest/*.sh'
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
stages:
|
||||
- stage: UnitTest
|
||||
displayName: Unit Tests
|
||||
jobs:
|
||||
- job: LinuxUnitTests
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: linux/continuous-linux.yml
|
||||
|
||||
- job: RaspberryPiUnitTests
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- template: raspi/continuous-raspi.yml
|
||||
|
||||
- job: GithubRelease
|
||||
dependsOn:
|
||||
- LinuxUnitTests
|
||||
- RaspberryPiUnitTests
|
||||
condition: and(succeeded('LinuxUnitTests'), succeeded('RaspberryPiUnitTests'))
|
||||
steps:
|
||||
- script: |
|
||||
mkdir dest
|
||||
cp src/*.sh dest/
|
||||
displayName: Create dest/ directory
|
||||
- task: GitHubRelease@1
|
||||
displayName: 'GitHub release (create) RC'
|
||||
inputs:
|
||||
gitHubConnection: 'github.com_cindydeng1998'
|
||||
tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$'
|
||||
assets: 'dest/*.sh'
|
||||
isDraft: true
|
||||
- task: GitHubRelease@1
|
||||
displayName: 'GitHub release (create)'
|
||||
inputs:
|
||||
gitHubConnection: 'github.com_cindydeng1998'
|
||||
tagPattern: '^v?[0-9]+\.[0-9]+\.[0-9]+$'
|
||||
assets: 'dest/*.sh'
|
||||
isDraft: true
|
|
@ -1,12 +1,14 @@
|
|||
steps:
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
cd tests/e2e-tests
|
||||
chmod +x test-devicestate.sh
|
||||
./test-devicestate.sh $(AzureSubscriptionId)
|
||||
displayName: 'Run All E2E Tests'
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
cd tests/e2e-tests
|
||||
chmod +x test-devicestate.sh
|
||||
./test-devicestate.sh $(AzureSubscriptionId)
|
||||
displayName: 'Run All E2E Tests'
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
displayName: "Use Python 3.8"
|
||||
inputs:
|
||||
versionSpec: 3.8
|
||||
|
||||
- task: AzureCLI@2
|
||||
displayName: 'Run All Performance Tests'
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
cd tests
|
||||
python3 --version
|
||||
pip3 --version
|
||||
pip3 install -r requirements.txt
|
||||
chmod +x ./track_duration.sh
|
||||
chmod +x ./perf_tests.sh
|
||||
chmod +x ./e2e-tests/test-devicestate.sh
|
||||
az config set extension.use_dynamic_install=yes_without_prompt
|
||||
az extension add --name azure-iot
|
||||
az --version
|
||||
az account set -s $(AzureSubscriptionId)
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
displayName: "Use Python 3.8"
|
||||
inputs:
|
||||
versionSpec: 3.8
|
||||
|
||||
- task: AzureCLI@2
|
||||
displayName: 'Run All Performance Tests'
|
||||
inputs:
|
||||
azureSubscription: 'Connection to Pipeline resources for IoT Edge Config'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
cd tests
|
||||
python3 --version
|
||||
pip3 --version
|
||||
pip3 install -r requirements.txt
|
||||
chmod +x ./track_duration.sh
|
||||
chmod +x ./perf_tests.sh
|
||||
chmod +x ./e2e-tests/test-devicestate.sh
|
||||
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)
|
|
@ -1,12 +1,13 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
steps:
|
||||
- script: echo Hello Linux!
|
||||
displayName: 'Echo Hello Linux'
|
||||
|
||||
- script: |
|
||||
cd tests/unit-tests
|
||||
chmod +x ./*.sh
|
||||
./test-install-container-management.sh
|
||||
./test-install-edge-runtime.sh
|
||||
chmod +x ./*.sh
|
||||
./test-validate-post-install.sh
|
||||
./test-validate-tier1-os.sh
|
||||
./test-cmd-parser.sh
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
steps:
|
||||
- script: echo Hello Raspi!
|
||||
displayName: 'Echo Hello Raspi!'
|
||||
|
@ -5,11 +8,8 @@ steps:
|
|||
- script: |
|
||||
cd tests/unit-tests
|
||||
chmod +x ./*.sh
|
||||
./test-install-container-management.sh
|
||||
./test-install-edge-runtime.sh
|
||||
./test-validate-post-install.sh
|
||||
./test-validate-tier1-os.sh
|
||||
./test-cmd-parser.sh
|
||||
./test-logger.sh
|
||||
displayName: 'Run All Raspberry Pi Unit Tests'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче