Merge branch 'main' into user/hshami/event_hub_feed
This commit is contained in:
Коммит
a3194366d2
|
@ -1,4 +1,4 @@
|
|||
# Azure IoT Edge configuration tool
|
||||
# Azure IoT Edge configuration tool [![Build Status](https://dev.azure.com/mseng/VSIoT/_apis/build/status/Azure%20IoT%20Edge/iotedgehubdev?branchName=master)](https://dev.azure.com/Azure-IoT-DDE-EdgeExperience/IoTEdgeConfig/_build?definitionId=28&branchName=main)
|
||||
|
||||
Azure IoT Edge configuration tool (the Tool) is a command-line tool that installs and configures Azure IoT Edge on a device. The Tool greatly simplifies the configuration of IoT Edge by automating several steps into single command.
|
||||
|
||||
|
|
|
@ -3,15 +3,18 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# Record start time, this value is used for calculating execution time
|
||||
start=`date +%s`
|
||||
|
||||
if [[ $EUID -ne 0 ]];
|
||||
then
|
||||
echo "ERROR: $0 requires elevated privileges.. "
|
||||
echo "$(echo -en "\e[31m")ERROR: $(echo -en "\e[00m")$0 requires elevated privileges.. "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION_TAG="v0.0.1"
|
||||
|
||||
# where am i
|
||||
# where am I
|
||||
TOPDIR=$(dirname $0)
|
||||
|
||||
######################################
|
||||
|
@ -32,28 +35,28 @@ function download_bash_script() {
|
|||
local url_text=https://github.com/Azure/iot-edge-config/releases/download/${VERSION_TAG}/$file_name
|
||||
local tmp_file=$(echo `mktemp -u`)
|
||||
|
||||
printf "attempting to download '%s'.\n" $file_name > /dev/stdout
|
||||
printf "attempting to download '%s'.\n" $file_name
|
||||
|
||||
# attempt to download to a temporary file.
|
||||
# use 'sudo LOCAL_E2E=1 ./azure-iot-edge-installer.sh {}' to validate local source...
|
||||
if [ "$LOCAL_E2E" == "1" ];
|
||||
then
|
||||
printf "Testing local file '%s'\n" "../$TOPDIR/$file_name" > /dev/stdout
|
||||
printf "Testing local file '%s'\n" "../$TOPDIR/$file_name"
|
||||
cp ../$TOPDIR/$file_name .
|
||||
else
|
||||
printf "wget '%s' -q -O '%s'\n" $url_text $tmp_file > /dev/stdout
|
||||
printf "wget '%s' -q -O '%s'\n" $url_text $tmp_file
|
||||
wget $url_text -q -O $tmp_file
|
||||
|
||||
# validate request
|
||||
exit_code=$?
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
printf "ERROR: Failed to download '%s'; error: %d\n" $file_name $exit_code > /dev/stdout
|
||||
printf "ERROR: Failed to download '%s'; error: %d\n" $file_name $exit_code
|
||||
|
||||
rm $tmp_file
|
||||
exit $exit_code
|
||||
else
|
||||
printf "downloaded '%s'\n" $file_name > /dev/stdout
|
||||
printf "downloaded '%s'\n" $file_name
|
||||
|
||||
mv -f $tmp_file $file_name
|
||||
chmod +x $file_name
|
||||
|
@ -63,47 +66,60 @@ function download_bash_script() {
|
|||
}
|
||||
|
||||
# script
|
||||
printf "Running azure-iot-edge-installer.sh\n" > /dev/stdout
|
||||
printf "Welcome to azure-iot-edge-installer\n"
|
||||
printf "\n%s\n" "-------------------------"
|
||||
printf "Telemetry\n"
|
||||
printf "%s\n" "---------"
|
||||
printf "The azure-iot-edge-installer collects usage data in order to improve your experience.\n"
|
||||
printf "The data is anonymous and does not include commandline argument values.\n"
|
||||
printf "The data is collected by Microsoft.\n"
|
||||
printf "You can change your telemetry settings by adding -nt or --telemetry-opt-out to the command line.\n"
|
||||
printf "\n"
|
||||
|
||||
# if helper scripts dont exist, fetch via wget
|
||||
if [ -d "iot-edge-installer" ];
|
||||
then
|
||||
printf "Directory iot-edge-installer already exists.\n" > /dev/stdout
|
||||
printf "Directory iot-edge-installer already exists.\n"
|
||||
else
|
||||
printf "Preparing install directory.\n" > /dev/stdout
|
||||
printf "Preparing install directory.\n"
|
||||
mkdir iot-edge-installer
|
||||
fi
|
||||
|
||||
cd iot-edge-installer
|
||||
|
||||
printf "Downloading helper files to temporary directory ./iot-edge-installer\n" > /dev/stdout
|
||||
printf "Downloading helper files to temporary directory ./iot-edge-installer\n"
|
||||
download_bash_script validate-tier1-os.sh
|
||||
download_bash_script install-container-management.sh
|
||||
download_bash_script install-edge-runtime.sh
|
||||
download_bash_script validate-post-install.sh
|
||||
download_bash_script utils.sh
|
||||
printf "Downloaded helper files to temporary directory ./iot-edge-installer\n" > /dev/stdout
|
||||
printf "Downloaded helper files to temporary directory ./iot-edge-installer\n"
|
||||
|
||||
# import utils
|
||||
source utils.sh
|
||||
log_init
|
||||
handlers_init
|
||||
|
||||
# add flag:variable_name dictionary entries
|
||||
add_option_args "TELEMETRY_OPT_OUT" -nt --telemetry-opt-out
|
||||
add_option_args "VERBOSE_LOGGING" -v --verbose
|
||||
add_option_args "SCOPE_ID" -s --scope-id
|
||||
add_option_args "REGISTRATION_ID" -r --registration-id
|
||||
add_option_args "SYMMETRIC_KEY" -k --symmetric-key
|
||||
add_option_args "CORRELATION_VECTOR" -cv --correlation-vector
|
||||
|
||||
# parse command line inputs and fetch output from parser
|
||||
declare -A parsed_cmds="$(cmd_parser $@)"
|
||||
|
||||
set_opt_out_selection ${parsed_cmds["TELEMETRY_OPT_OUT"]} $parsed_cmds["CORRELATION_VECTOR"]
|
||||
|
||||
# validate that all arguments are acceptable / known
|
||||
if [[ ${#@} > 0 && ${#parsed_cmds[*]} == 0 ]];
|
||||
then
|
||||
array=("$*")
|
||||
echo Unknown argument "${array[*]}"
|
||||
echo Usage
|
||||
exit 1
|
||||
echo "Usage: sudo ./azure-iot-edge-installer.sh -s <IDScope> -r <RegistrationID> -k <Symmetric Key>"
|
||||
exit ${EXIT_CODES[1]}
|
||||
fi
|
||||
|
||||
if [[ "${parsed_cmds["SCOPE_ID"]}" == "" || "${parsed_cmds["REGISTRATION_ID"]}" == "" || "${parsed_cmds["SYMMETRIC_KEY"]}" == "" ]];
|
||||
|
@ -111,37 +127,30 @@ then
|
|||
echo Missing argument
|
||||
echo defined: "'"${!parsed_cmds[@]}"'"
|
||||
echo given: "'"${parsed_cmds[@]}"'"
|
||||
echo Usage
|
||||
exit 1
|
||||
echo "Usage: sudo ./azure-iot-edge-installer.sh -s <IDScope> -r <RegistrationID> -k <Symmetric Key>"
|
||||
exit ${EXIT_CODES[2]}
|
||||
fi
|
||||
|
||||
# check if current OS is Tier 1
|
||||
source /etc/os-release
|
||||
source validate-tier1-os.sh
|
||||
is_os_tier1
|
||||
if [ "$?" != "0" ];
|
||||
then
|
||||
log_error "This OS is not supported. Please visit this link for more information https://docs.microsoft.com/en-us/azure/iot-edge/support?view=iotedge-2020-11#tier-1."
|
||||
else
|
||||
# run scripts in order, can take parsed input from above
|
||||
platform=$(get_platform)
|
||||
prepare_apt $platform
|
||||
|
||||
source install-container-management.sh
|
||||
install_container_management
|
||||
|
||||
source install-edge-runtime.sh
|
||||
install_edge_runtime ${parsed_cmds["SCOPE_ID"]} ${parsed_cmds["REGISTRATION_ID"]} ${parsed_cmds["SYMMETRIC_KEY"]}
|
||||
|
||||
source validate-post-install.sh
|
||||
validate_post_install
|
||||
exit ${EXIT_CODES[3]}
|
||||
fi
|
||||
|
||||
# cleanup, always
|
||||
cd ..
|
||||
if [ -d "iot-edge-installer" ]
|
||||
then
|
||||
log_info "Removing temporary directory files for iot-edge-installer."
|
||||
rm -rf iot-edge-installer
|
||||
log_info "Removed temporary directory files for iot-edge-installer."
|
||||
fi
|
||||
# run scripts in order, can take parsed input from above
|
||||
platform=$(get_platform)
|
||||
prepare_apt $platform
|
||||
|
||||
source install-container-management.sh
|
||||
install_container_management
|
||||
|
||||
source install-edge-runtime.sh
|
||||
install_edge_runtime ${parsed_cmds["SCOPE_ID"]} ${parsed_cmds["REGISTRATION_ID"]} ${parsed_cmds["SYMMETRIC_KEY"]}
|
||||
|
||||
source validate-post-install.sh
|
||||
validate_post_install
|
||||
|
||||
exit ${EXIT_CODES[0]}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# OUTPUTS:
|
||||
# Write output to stdout
|
||||
# RETURN:
|
||||
#
|
||||
# updates the global variable OK_TO_CONTINUE in case of failure to false.
|
||||
######################################
|
||||
|
||||
install_container_management() {
|
||||
|
@ -20,8 +20,16 @@ install_container_management() {
|
|||
then
|
||||
log_info "docker command is already available."
|
||||
else
|
||||
log_info "Running install-container-management.sh"
|
||||
log_info "Installing moby-engine container management"
|
||||
|
||||
apt install moby-engine -y
|
||||
apt-get install moby-engine -y 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT &
|
||||
long_running_command $!
|
||||
exit_code=$?
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
log_info "moby-engine installation failed with code: %d" $exit_code
|
||||
exit ${EXIT_CODES[8]}
|
||||
fi
|
||||
log_info "Installed moby-engine container management"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
######################################
|
||||
# install_edge_runtime
|
||||
#
|
||||
# installs Azure IoT Edge Runtime 1.2
|
||||
# generates the edge's configuration file from template and
|
||||
# fills in the DPS provisioning section from provided parameters
|
||||
# - installs Azure IoT Edge Runtime 1.2
|
||||
# - generates the edge's configuration file from template and
|
||||
# fills in the DPS provisioning section from provided parameters
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# SCOPE_ID
|
||||
|
@ -19,36 +19,49 @@
|
|||
# OUTPUTS:
|
||||
# Write output to stdout
|
||||
# RETURN:
|
||||
#
|
||||
# updates the global variable OK_TO_CONTINUE in case of success to true.
|
||||
######################################
|
||||
|
||||
|
||||
function install_edge_runtime() {
|
||||
if [[ $# != 3 || "$1" == "" || "$2" == "" || "$3" == "" ]];
|
||||
then
|
||||
log_error "Scope ID, Registration ID, and the Symmetric Key are required"
|
||||
return
|
||||
exit ${EXIT_CODES[2]}
|
||||
fi
|
||||
|
||||
if [ -x "$(command -v iotedge)" ];
|
||||
then
|
||||
log_error "Edge runtime is already available."
|
||||
return
|
||||
else
|
||||
log_info "install_edge_runtime..."
|
||||
exit ${EXIT_CODES[9]}
|
||||
fi
|
||||
|
||||
apt-get install aziot-edge -y
|
||||
|
||||
log_info "Installing edge runtime..."
|
||||
|
||||
apt-get install aziot-edge -y 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT &
|
||||
long_running_command $!
|
||||
exit_code=$?
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
log_info "aziot-edged installation failed with exit code: %d" $exit_code
|
||||
exit ${EXIT_CODES[10]}
|
||||
fi
|
||||
log_info "Installed edge runtime..."
|
||||
|
||||
# create .toml from template
|
||||
log_info "create .toml from template."
|
||||
cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml
|
||||
log_info "Create instanance configuration .toml from template."
|
||||
cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml &>/dev/null
|
||||
exit_code=$?
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
log_info "'cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml' returned %d" $exit_code
|
||||
exit ${EXIT_CODES[11]}
|
||||
fi
|
||||
|
||||
local SCOPE_ID=$1
|
||||
local REGISTRATION_ID=$2
|
||||
local SYMMETRIC_KEY=$3
|
||||
|
||||
log_info "set '%s'; '%s'; '%s'" $SCOPE_ID $REGISTRATION_ID $SYMMETRIC_KEY
|
||||
log_info "Set DPS provisioning parameters."
|
||||
sed -i '/## DPS provisioning with symmetric key/,/## DPS provisioning with X.509 certificate/c\
|
||||
## DPS provisioning with symmetric key\
|
||||
[provisioning]\
|
||||
|
@ -65,8 +78,20 @@ symmetric_key = { value = \"'$SYMMETRIC_KEY'\" }
|
|||
# symmetric_key = { uri = "pkcs11:slot-id=0;object=device%20id?pin-value=1234" } # PKCS#11 URI\
|
||||
\
|
||||
## DPS provisioning with X.509 certificate\
|
||||
' /etc/aziot/config.toml
|
||||
' /etc/aziot/config.toml 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT
|
||||
|
||||
exit_code=$?
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
log_info "'sed ....'" $exit_code
|
||||
exit ${EXIT_CODES[12]}
|
||||
fi
|
||||
|
||||
log_info "Apply settings - this will restart the edge"
|
||||
iotedge config apply
|
||||
iotedge config apply 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT
|
||||
exit_code=$?
|
||||
if [[ $exit_code == 0 ]];
|
||||
then
|
||||
log_info "IotEdge has been configured successfully"
|
||||
fi
|
||||
}
|
||||
|
|
347
src/utils.sh
347
src/utils.sh
|
@ -6,6 +6,77 @@
|
|||
# create flag:variable_name dictionary
|
||||
declare -A flag_to_variable_dict
|
||||
|
||||
# output color indicators
|
||||
RED=$(echo -en "\e[31m")
|
||||
GREEN=$(echo -en "\e[32m")
|
||||
MAGENTA=$(echo -en "\e[35m")
|
||||
DEFAULT=$(echo -en "\e[00m")
|
||||
BOLD=$(echo -en "\e[01m")
|
||||
BLINK=$(echo -en "\e[5m")
|
||||
|
||||
# OPT_IN - set to true if the user opts in for sending telemetry information to us.
|
||||
OPT_IN=false
|
||||
|
||||
# EXIT_CODES - an array of intigers indicating an exit status
|
||||
declare -a EXIT_CODES=(0 # success
|
||||
1 # invalid argument is given at the command line
|
||||
2 # a required argument is missing
|
||||
3 # os is not supported
|
||||
4 # step 1 of apt-get failed
|
||||
5 # step 2 of apt-get failed
|
||||
6 # step 3 of apt-get failed
|
||||
7 # step 4 of apt-get failed
|
||||
8 # failed to install moby-engine
|
||||
9 # a version of edge-runtime is already installed
|
||||
10 # step 1 of installing edge-runtime failed
|
||||
11 # step 2 of installing edge-runtime failed
|
||||
12 # step 3 of installing edge-runtime failed
|
||||
13 # step 4 of installing edge-runtime failed
|
||||
14 # ctrl-c or kill
|
||||
)
|
||||
|
||||
CORRELATION_VECTOR=""
|
||||
|
||||
######################################
|
||||
# set_opt_out_selection
|
||||
#
|
||||
# records the user's choice of opting out of telemetry
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# does_the_user_NOT_consent_to_sending_telemetry
|
||||
#
|
||||
# OUTPUTS:
|
||||
# Write output to stdout
|
||||
# RETURN:
|
||||
#
|
||||
######################################
|
||||
|
||||
function set_opt_out_selection() {
|
||||
if [ $1 == true ];
|
||||
then
|
||||
OPT_IN=false
|
||||
log_info "The user has opted out of sending usage telemetry."
|
||||
else
|
||||
OPT_IN=true
|
||||
log_info "The user has opted in for sending usage telemetry."
|
||||
fi
|
||||
|
||||
# handle correlation vector
|
||||
if [ -z $2 ];
|
||||
then
|
||||
CORRELATION_VECTOR=$(generate_uuid)
|
||||
else
|
||||
CORRELATION_VECTOR=$2
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function get_opt_in_selection() {
|
||||
echo "$OPT_IN"
|
||||
}
|
||||
|
||||
export -f set_opt_out_selection get_opt_in_selection
|
||||
|
||||
######################################
|
||||
# add_option_args
|
||||
#
|
||||
|
@ -49,6 +120,20 @@ function clear_option_args() {
|
|||
flag_to_variable_dict=()
|
||||
}
|
||||
|
||||
######################################
|
||||
# cmd_parser
|
||||
#
|
||||
# populates a dictionary of arguments and values from
|
||||
# a given command line
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# command line
|
||||
# OUTPUTS:
|
||||
#
|
||||
# RETURN:
|
||||
# dictionary
|
||||
######################################
|
||||
|
||||
function cmd_parser() {
|
||||
# create flag:variable_name dictionary and initialize to empty string
|
||||
declare -A parsed_cmd
|
||||
|
@ -120,10 +205,15 @@ log() {
|
|||
then
|
||||
printf "$LP$FS\n" $@ >> "$OUTPUT_FILE"
|
||||
fi
|
||||
printf "$LP$FS\n" $@ > /dev/stdout
|
||||
printf "$LP$FS\n" $@
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
function announce_my_log_file() {
|
||||
printf '\n------\n%s%s%s%s%s\n------\n\n' "$GREEN" "$BOLD" "$BLINK" "$1 '$2'" "$DEFAULT"
|
||||
}
|
||||
|
||||
#
|
||||
# logger
|
||||
log_init() {
|
||||
|
@ -136,7 +226,13 @@ log_init() {
|
|||
OUTPUT_FILE=$TD"/"$(echo ${BASE_NAME%.*})-$(echo `date '+%Y-%m-%d'`).log
|
||||
touch $OUTPUT_FILE
|
||||
|
||||
echo "All logs will be appended to this file '"$OUTPUT_FILE"'"
|
||||
announce_my_log_file "All logs will be appended to file" $OUTPUT_FILE
|
||||
|
||||
STDOUT_REDIRECT=$TD"/"$(echo ${BASE_NAME%.*})-$(echo `date '+%Y-%m-%d'`).out
|
||||
echo "-----------------------------------" `date '+%H:%M:%S.%N'` "-----------------------------------" >> $STDOUT_REDIRECT
|
||||
|
||||
STDERR_REDIRECT=$TD"/"$(echo ${BASE_NAME%.*})-$(echo `date '+%Y-%m-%d'`).err
|
||||
echo "-----------------------------------" `date '+%H:%M:%S.%N'` "-----------------------------------" >> $STDERR_REDIRECT
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -159,7 +255,7 @@ log_debug() {
|
|||
log "DEBUG" "$@"
|
||||
}
|
||||
|
||||
export -f log_init log_error log_info log_warn log_debug
|
||||
export -f announce_my_log_file log_init log_error log_info log_warn log_debug
|
||||
|
||||
######################################
|
||||
# prepare_apt
|
||||
|
@ -177,25 +273,256 @@ export -f log_init log_error log_info log_warn log_debug
|
|||
function prepare_apt() {
|
||||
if [ $# != 1 ];
|
||||
then
|
||||
exit 1
|
||||
exit ${EXIT_CODES[2]}
|
||||
else
|
||||
local platform=$1
|
||||
if [[ "$platform" == "" ]];
|
||||
then
|
||||
log_error "Unsupported platform."
|
||||
exit 2
|
||||
exit ${EXIT_CODES[3]}
|
||||
else
|
||||
sources="https://packages.microsoft.com/config/"$platform"/multiarch/prod.list"
|
||||
|
||||
# sources list
|
||||
log_info "Adding'%s' to repository lists." $sources
|
||||
wget $sources -q -O /etc/apt/sources.list.d/microsoft-prod.list
|
||||
log_info "Adding'%s' to package sources lists." $sources
|
||||
wget $sources -q -O /etc/apt/sources.list.d/microsoft-prod.list 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT
|
||||
local exit_code=$?
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
log_error "prepare_apt() step 1 failed with error: %d" exit_code
|
||||
exit ${EXIT_CODES[4]}
|
||||
fi
|
||||
log_info "Added'%s' to package sources lists." $sources
|
||||
|
||||
# the key
|
||||
wget https://packages.microsoft.com/keys/microsoft.asc -q -O /dev/stdout | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg
|
||||
log_info "Downloading key"
|
||||
local tmp_file=$(echo `mktemp -u`)
|
||||
wget https://packages.microsoft.com/keys/microsoft.asc -q -O $tmp_file 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT
|
||||
exit_code=$?
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
log_error "prepare_apt() step 2 failed with error %d" exit_code
|
||||
rm -f /etc/apt/sources.list.d/microsoft-prod.list &> /dev/null
|
||||
exit ${EXIT_CODES[5]}
|
||||
fi
|
||||
|
||||
# unpack the key
|
||||
local gpg_file=/etc/apt/trusted.gpg.d/microsoft.gpg
|
||||
if [[ -f $gpg_file ]];
|
||||
then
|
||||
rm -f $gpg_file &> /dev/null
|
||||
fi
|
||||
gpg --dearmor --output $gpg_file $tmp_file
|
||||
exit_code=$?
|
||||
|
||||
rm -f $tmp_file &> /dev/null
|
||||
|
||||
if [[ $exit_code != 0 ]];
|
||||
then
|
||||
log_error "prepare_apt() step 2 failed with error %d" $exit_code
|
||||
rm -f /etc/apt/sources.list.d/microsoft-prod.list &> /dev/null
|
||||
exit ${EXIT_CODES[6]}
|
||||
fi
|
||||
log_info "Downloaded key"
|
||||
|
||||
# update
|
||||
apt update
|
||||
log_info "update - Retrieve new lists of packages"
|
||||
apt-get update 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT &
|
||||
long_running_command $!
|
||||
exit_code=$?
|
||||
log_info "update step completed with exit code: %d" $exit_code
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
BG_PROCESS_ACTIVE=false
|
||||
BG_PROCESS_ID=-1
|
||||
######################################
|
||||
# long_running_process
|
||||
#
|
||||
# while a long-running process executes, shows 'busy' waiting feedback
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# the ID of a bg process
|
||||
#
|
||||
# OUTPUTS:
|
||||
# RETURN:
|
||||
#
|
||||
######################################
|
||||
|
||||
function long_running_command() {
|
||||
if [[ $# == 1 ]];
|
||||
then
|
||||
BG_PROCESS_ID=$1
|
||||
BG_PROCESS_ACTIVE=true
|
||||
|
||||
while [ $BG_PROCESS_ACTIVE == true ];
|
||||
do
|
||||
for next_symbol in '-' '\\' '|' '/';
|
||||
do
|
||||
echo -en "$next_symbol\b"
|
||||
sleep 0.15
|
||||
local MYPS=$(ps -a | awk '/'$BG_PROCESS_ID'/ {print $1}')
|
||||
if [ "$MYPS" == "" ];
|
||||
then
|
||||
BG_PROCESS_ID=-1
|
||||
BG_PROCESS_ACTIVE=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo -en " \b"
|
||||
fi
|
||||
}
|
||||
|
||||
######################################
|
||||
# handle_ctrl_c
|
||||
#
|
||||
# will be called when 'ctrl-c' or kill-9 is issued by the user.
|
||||
# if a bg process has been launched, wait for it to finish.
|
||||
#
|
||||
# ARGUMENTS:
|
||||
#
|
||||
# OUTPUTS:
|
||||
#
|
||||
# RETURN:
|
||||
#
|
||||
######################################
|
||||
|
||||
function handle_ctrl_c() {
|
||||
log_info "ctrl C\n"
|
||||
if [[ "$BG_PROCESS_ID" != "-1" ]];
|
||||
then
|
||||
while kill -0 $BG_PROCESS_ID &> /dev/null;
|
||||
do
|
||||
wait $BG_PROCESS_ID;
|
||||
done
|
||||
|
||||
BG_PROCESS_ACTIVE=false
|
||||
BG_PROCESS_ID=-1
|
||||
fi
|
||||
|
||||
exit ${EXIT_CODES[14]}
|
||||
}
|
||||
|
||||
######################################
|
||||
# handle_exit
|
||||
#
|
||||
# will report telemetry if user has opted in
|
||||
# will be called whenever an exit is encountered
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# exit code
|
||||
#
|
||||
# OUTPUTS:
|
||||
# RETURN:
|
||||
#
|
||||
######################################
|
||||
|
||||
function handle_exit() {
|
||||
local e_code=$?
|
||||
log_info "Exit %d" $e_code
|
||||
|
||||
local end=`date +%s`
|
||||
runtime=$((end-start))
|
||||
log_info "Runtime duration %d" $runtime
|
||||
|
||||
send_appinsight_event_telemetry $e_code $runtime
|
||||
|
||||
# cleanup, always
|
||||
cd ..
|
||||
if [ -d "iot-edge-installer" ]
|
||||
then
|
||||
log_info "Removing temporary directory files for iot-edge-installer."
|
||||
rm -rf iot-edge-installer
|
||||
log_info "Removed temporary directory files for iot-edge-installer."
|
||||
fi
|
||||
|
||||
announce_my_log_file "All logs were appended to" $OUTPUT_FILE
|
||||
}
|
||||
|
||||
######################################
|
||||
# handlers_init
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# initialize handlers
|
||||
#
|
||||
# OUTPUTS:
|
||||
# RETURN:
|
||||
#
|
||||
######################################
|
||||
|
||||
function handlers_init() {
|
||||
trap handle_ctrl_c SIGINT
|
||||
trap handle_exit EXIT
|
||||
}
|
||||
|
||||
export -f handlers_init
|
||||
|
||||
######################################
|
||||
# generate_uuid
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# generate UUIDs
|
||||
#
|
||||
# OUTPUTS: UUID
|
||||
# RETURN:
|
||||
#
|
||||
######################################
|
||||
|
||||
source /etc/os-release
|
||||
function generate_uuid() {
|
||||
case $ID in
|
||||
ubuntu)
|
||||
uuidgen
|
||||
;;
|
||||
|
||||
raspbian)
|
||||
uuid
|
||||
;;
|
||||
|
||||
*)
|
||||
log_error "OS is not Tier 1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Constants
|
||||
InstrumentationKey="d403f627-57b8-4fb0-8001-c51b7466682d"
|
||||
IngestionEndpoint="https://dc.services.visualstudio.com/v2/track"
|
||||
EventName="Azure-IoT-Edge-Installer-Summary"
|
||||
DeviceUniqueID="xinzedPC"
|
||||
SchemaVersion="1.0"
|
||||
|
||||
######################################
|
||||
# send_appinsight_event_telemetry
|
||||
#
|
||||
# Send Application Insights event as a REST POST request with JSON body containing telemetry
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# CustomProperties: "status":[EXIT_CODE]
|
||||
# CustomMeasurements: "duration":
|
||||
#
|
||||
# OUTPUTS:
|
||||
# Write output to stdout
|
||||
# RETURN:
|
||||
#
|
||||
######################################
|
||||
|
||||
function send_appinsight_event_telemetry ()
|
||||
{
|
||||
local customPropertiesObj='"status":'$1''
|
||||
local customMeasurementsObj='"duration":'$2''
|
||||
|
||||
# validate that the user has opted in for telemetry collection
|
||||
local optin=$(get_opt_in_selection)
|
||||
if [[ $optin == true ]];
|
||||
then
|
||||
log_info "Ready to send telemetry to AppInsights endpoint with wget"
|
||||
local CurrentTime=$(echo `date --utc '+%Y-%m-%dT%H:%M:%S.%N'`)
|
||||
|
||||
wget --header='Content-Type: application/json' --header='Accept-Charset: UTF-8' --post-data '{"name":"Microsoft.ApplicationInsights.'$InstrumentationKey'.Event","time": "'$CurrentTime'","iKey": "'$InstrumentationKey'","tags":{"ai.cloud.roleInstance": "'$DeviceUniqueID'"},"data":{"baseType": "EventData","baseData": {"ver": "'$SchemaVersion'","name": "'$EventName'","cv": "'$CORRELATION_VECTOR'","properties":{'$customPropertiesObj'},"measurements":{'$customMeasurementsObj'}}}}' $IngestionEndpoint 2>>$STDERR_REDIRECT 1>>$STDOUT_REDIRECT
|
||||
|
||||
log_info "Finished sending telemetry to AppInsights endpoint with wget"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
# RETURN:
|
||||
# 0 if service is running, 1 otherwise
|
||||
######################################
|
||||
source utils.sh
|
||||
|
||||
function is_service_running() {
|
||||
local service_name=${1,,}
|
||||
|
@ -30,8 +29,9 @@ function is_service_running() {
|
|||
log_error "sudo iotedge check"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "'%s' is running." $service_name
|
||||
return 0
|
||||
return 0
|
||||
}
|
||||
|
||||
function validate_post_install() {
|
||||
|
@ -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
|
||||
#
|
||||
|
@ -16,6 +19,8 @@ subscription=$(az account show | awk '/"id/ { print substr($2,2,36) }')
|
|||
|
||||
# for each test ...
|
||||
echo ./track_duration.sh -c $1 -t ./e2e-tests/test-devicestate.sh $subscription
|
||||
./track_duration.sh -c $1 -t ./e2e-tests/test-devicestate.sh $subscription
|
||||
cd e2e-tests
|
||||
../track_duration.sh -v -c $1 -t ./test-devicestate.sh $subscription
|
||||
cd ..
|
||||
|
||||
exit 0
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,26 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if command -v tput &>/dev/null && tty -s; then
|
||||
RED=$(tput setaf 1)
|
||||
GREEN=$(tput setaf 2)
|
||||
MAGENTA=$(tput setaf 5)
|
||||
NORMAL=$(tput sgr0)
|
||||
BOLD=$(tput bold)
|
||||
else
|
||||
RED=$(echo -en "\e[31m")
|
||||
GREEN=$(echo -en "\e[32m")
|
||||
MAGENTA=$(echo -en "\e[35m")
|
||||
NORMAL=$(echo -en "\e[00m")
|
||||
BOLD=$(echo -en "\e[01m")
|
||||
fi
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
#
|
||||
error_output() {
|
||||
printf "%b\n" "${RED:-}Error: $1${NORMAL:-}" >&2
|
||||
printf "%b\n" "${RED:-}Error: $1${DEFAULT:-}" >&2
|
||||
}
|
||||
|
||||
output() {
|
||||
printf "%b\n" "${BOLD:-}${NORMAL:-} $1" >&2
|
||||
printf "%b\n" "${BOLD:-}${DEFAULT:-} $1" >&2
|
||||
}
|
||||
|
||||
verbose_output() {
|
||||
|
@ -49,6 +38,20 @@ assert_eq() {
|
|||
fi
|
||||
}
|
||||
|
||||
assert_not_eq() {
|
||||
local expected=$1; shift
|
||||
local actual=$1; shift
|
||||
|
||||
NR_TOTALS=$(bc <<< $NR_TOTALS+1)
|
||||
if [ "$expected" != "$actual" ];
|
||||
then
|
||||
NR_PASSING=$(bc <<< $NR_PASSING+1)
|
||||
else
|
||||
NR_FAILING=$(bc <<< $NR_FAILING+1)
|
||||
error_output "expected: $expected; actual: $actual"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_file() {
|
||||
local file_name=$1; shift
|
||||
|
||||
|
@ -71,4 +74,4 @@ show_test_totals() {
|
|||
printf "\n\n"
|
||||
}
|
||||
|
||||
export -f assert_eq assert_file show_test_totals
|
||||
export -f assert_eq assert_not_eq assert_file show_test_totals
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
######################################
|
||||
# track_duration
|
||||
#
|
||||
|
@ -23,7 +26,8 @@ set -e
|
|||
exec 3>&1
|
||||
|
||||
# bring in the library
|
||||
source test_utils.sh
|
||||
MY_LOCATION=$(dirname $0)
|
||||
source ${MY_LOCATION}/test_utils.sh
|
||||
|
||||
#
|
||||
verbose=false
|
||||
|
@ -98,7 +102,7 @@ do
|
|||
runs[$curr-1]=$(bc <<< $end-$start)
|
||||
total=$(bc <<< $total+${runs[$curr-1]})
|
||||
verbose_output "run $curr took $(bc <<< $end-$start) seconds"
|
||||
python3 send_one_message_to_iot_hub_device.py "$IH_CONN_STR" "{\"OSName\": \"$os_name\", \"Kernel\": \"$os_kernel\", \"TestName\": \"$test_name\", \"TimeStamp\": \"$time_stamp\", \"Duration\": ${runs[$iter]}}"
|
||||
python3 ${MY_LOCATION}/send_one_message_to_iot_hub_device.py "$IH_CONN_STR" "{\"OSName\": \"$os_name\", \"Kernel\": \"$os_kernel\", \"TestName\": \"$test_name\", \"TimeStamp\": \"$time_stamp\", \"Duration\": ${runs[$iter]}}"
|
||||
done
|
||||
|
||||
verbose_output ""
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
exec 3>&1
|
||||
|
||||
# bring in the utils library
|
||||
source ../../src/utils.sh
|
||||
source ../test_utils.sh
|
||||
|
||||
function test_flag_on() {
|
||||
set_opt_out_selection true
|
||||
assert_eq $(get_opt_in_selection) false
|
||||
}
|
||||
|
||||
function test_flag_off() {
|
||||
set_opt_out_selection false
|
||||
assert_eq $(get_opt_in_selection) true
|
||||
}
|
||||
|
||||
test_flag_on
|
||||
test_flag_off
|
||||
show_test_totals
|
|
@ -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,9 +32,16 @@ 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
|
||||
test_service_not_running
|
||||
test_service_missing
|
||||
test_service_casesensitive
|
||||
test_service_casesensitive
|
||||
|
||||
show_test_totals
|
||||
|
|
|
@ -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"
|
||||
|
@ -27,4 +31,6 @@ test_tier2() {
|
|||
# run tests
|
||||
test_ubuntu1804
|
||||
test_raspbian
|
||||
test_tier2
|
||||
test_tier2
|
||||
|
||||
show_test_totals
|
||||
|
|
|
@ -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,14 +1,16 @@
|
|||
# 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
|
||||
./test-logger.sh
|
||||
./test-telemetry-flag.sh
|
||||
displayName: 'Run All Linux Unit Tests'
|
||||
|
|
|
@ -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,9 @@ 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
|
||||
./test-telemetry-flag.sh
|
||||
displayName: 'Run All Raspberry Pi Unit Tests'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче