summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rwxr-xr-xci/build_scripts/build_for_amd64.sh1
-rwxr-xr-xci/build_scripts/build_for_arm.sh1
-rwxr-xr-xci/ci_smoke_test_az.sh5
-rwxr-xr-xci/ci_smoke_test_c8y.sh28
-rwxr-xr-xci/configure_bridge.sh28
-rwxr-xr-xci/installation_scripts/clean_up_rpi.sh5
-rwxr-xr-xci/installation_scripts/install_for_amd64.sh3
-rwxr-xr-xci/installation_scripts/install_for_arm.sh3
-rwxr-xr-xci/package_list.sh41
-rwxr-xr-xci/report/build.sh1
-rwxr-xr-xci/report/build_local.sh1
11 files changed, 72 insertions, 45 deletions
diff --git a/ci/build_scripts/build_for_amd64.sh b/ci/build_scripts/build_for_amd64.sh
index 0100c4de..80e940a7 100755
--- a/ci/build_scripts/build_for_amd64.sh
+++ b/ci/build_scripts/build_for_amd64.sh
@@ -6,6 +6,7 @@ set -euo pipefail
cargo install cargo-deb --version 1.38.1
# Load the package list as $RELEASE_PACKAGES and $TEST_PACKAGES
+# shellcheck disable=SC1091
source ./ci/package_list.sh
# Build release debian packages
diff --git a/ci/build_scripts/build_for_arm.sh b/ci/build_scripts/build_for_arm.sh
index c43e0d7b..deb2857c 100755
--- a/ci/build_scripts/build_for_arm.sh
+++ b/ci/build_scripts/build_for_arm.sh
@@ -14,6 +14,7 @@ sudo apt update
sudo apt-get --assume-yes install binutils-arm-linux-gnueabihf binutils-aarch64-linux-gnu
# Load the release package list as $RELEASE_PACKAGES and $TEST_PACKAGES
+# shellcheck disable=SC1091
source ./ci/package_list.sh
# Cross build release for target
diff --git a/ci/ci_smoke_test_az.sh b/ci/ci_smoke_test_az.sh
index e6cf5c00..b28fd57a 100755
--- a/ci/ci_smoke_test_az.sh
+++ b/ci/ci_smoke_test_az.sh
@@ -19,14 +19,15 @@ set -e
# Read device thumbprint from command line
THUMB=$(sudo tedge cert show | grep Thumb | cut -c13-)
-echo "DEVICE Thumbprint is " $THUMB
+echo "DEVICE Thumbprint is $THUMB"
python3 -m venv ~/env-eventhub
+# shellcheck disable=SC1090
source ~/env-eventhub/bin/activate
pip install azure-eventhub
-./ci/az_upload_device_cert.py -d $C8YDEVICE -t $THUMB -u $IOTHUBNAME -s iothubowner
+./ci/az_upload_device_cert.py -d "$C8YDEVICE" -t "$THUMB" -u "$IOTHUBNAME" -s iothubowner
sudo tedge connect az
diff --git a/ci/ci_smoke_test_c8y.sh b/ci/ci_smoke_test_c8y.sh
index f77d23f0..3aa8516a 100755
--- a/ci/ci_smoke_test_c8y.sh
+++ b/ci/ci_smoke_test_c8y.sh
@@ -22,49 +22,49 @@
appendtofile() {
STRING=$1
FILE=$2
- if grep "$STRING" $FILE; then
+ if grep "$STRING" "$FILE"; then
echo 'line already there'
else
- echo $STRING >>$FILE
+ echo "$STRING" >>"$FILE"
fi
}
-if [ -z $C8YDEVICE ]; then
+if [ -z "$C8YDEVICE" ]; then
echo "Error: Please supply your device name as environment variable C8YDEVICE"
exit 1
else
echo "Your device: HIDDEN"
fi
-if [ -z $C8YUSERNAME ]; then
+if [ -z "$C8YUSERNAME" ]; then
echo "Error: Please supply your user name as environment variable C8YUSERNAME"
exit 1
else
echo "Your user name: HIDDEN"
fi
-if [ -z $C8YTENANT ]; then
+if [ -z "$C8YTENANT" ]; then
echo "Error: Please supply your tenant ID as environment variable C8YTENANT"
exit 1
else
echo "Your tenant ID: HIDDEN"
fi
-if [ -z $C8YPASS ]; then
+if [ -z "$C8YPASS" ]; then
echo "Error: Please supply your Cumulocity password environment variable C8YPASS"
exit 1
else
echo "Your password: HIDDEN"
fi
-if [ -z $EXAMPLEDIR ]; then
+if [ -z "$EXAMPLEDIR" ]; then
echo "Error: Please supply the path to the sawtooth_publisher as EXAMPLEDIR"
exit 1
else
echo "Your exampledir: $EXAMPLEDIR"
fi
-if [ -z $TEBASEDIR ]; then
+if [ -z "$TEBASEDIR" ]; then
echo "Error: Please supply the path to the sawtooth_publisher as TEBASEDIR"
exit 1
else
@@ -75,12 +75,14 @@ fi
PATH=$PATH:/usr/sbin
python3 -m venv ~/env-c8y-api
+# shellcheck disable=SC1090
source ~/env-c8y-api/bin/activate
pip3 install c8y-api retry-decorator
-export C8YDEVICEID=$(python3 ./ci/find_device_id.py --tenant $C8YTENANT --user $C8YUSERNAME --device $C8YDEVICE --url $C8YURL)
+C8YDEVICEID=$(python3 ./ci/find_device_id.py --tenant "$C8YTENANT" --user "$C8YUSERNAME" --device "$C8YDEVICE" --url "$C8YURL")
+export C8YDEVICEID
# after calling the script, the ID should be a numeric value
-if [[ $C8YDEVICEID =~ ^[0-9]+$ ]]; then
+if [[ "$C8YDEVICEID" =~ ^[0-9]+$ ]]; then
echo "Your device ID: $C8YDEVICEID"
else
echo "Error: Please supply your Cumulocity device ID name as environment variable C8YDEVICEID ($C8YDEVICEID)"
@@ -95,7 +97,7 @@ echo "Start smoke tests"
# Publish some values
for val in 20 30 20 30; do
- tedge mqtt pub c8y/s/us 211,$val
+ tedge mqtt pub c8y/s/us "211,$val"
sleep 0.1
done
@@ -103,13 +105,13 @@ done
sleep 12
# Uses SmartREST for publishing
-./ci/roundtrip_local_to_c8y.py -m REST -pub $EXAMPLEDIR -u $C8YUSERNAME -t $C8YTENANT -id $C8YDEVICEID
+./ci/roundtrip_local_to_c8y.py -m REST -pub "$EXAMPLEDIR" -u "$C8YUSERNAME" -t "$C8YTENANT" -id "$C8YDEVICEID"
# Wait some seconds until our 10 seconds window is empty again
sleep 12
# Uses thin-edge JSON for publishing
-./ci/roundtrip_local_to_c8y.py -m JSON -pub $EXAMPLEDIR -u $C8YUSERNAME -t $C8YTENANT -id $C8YDEVICEID
+./ci/roundtrip_local_to_c8y.py -m JSON -pub "$EXAMPLEDIR" -u "$C8YUSERNAME" -t "$C8YTENANT" -id "$C8YDEVICEID"
echo "Disonnect again"
sudo tedge disconnect c8y
diff --git a/ci/configure_bridge.sh b/ci/configure_bridge.sh
index 4099efd9..cba16a3e 100755
--- a/ci/configure_bridge.sh
+++ b/ci/configure_bridge.sh
@@ -1,5 +1,14 @@
#!/bin/bash
+for variable in C8YURL C8YUSERNAME C8YPASSWORD C8YDEVICE C8YTENANT C8YDEVICEID;
+do
+ declare -n var_ref=$variable
+ if [ -z "${var_ref}" ]; then
+ echo "$variable not set"
+ exit 1
+ fi
+done
+
echo "Disconnect old bridge"
# Disconnect - may fail if not there
@@ -11,19 +20,20 @@ set -e
echo "Configuring Bridge"
-URL=$(echo $C8YURL | cut -c 9- - )
+URL=$(echo "$C8YURL" | cut -c 9- - )
sudo tedge cert remove
-sudo tedge cert create --device-id=$C8YDEVICE
+# shellcheck disable=SC2153
+sudo tedge cert create --device-id="$C8YDEVICE"
sudo tedge cert show
-sudo tedge config set c8y.url $URL
+sudo tedge config set c8y.url "$URL"
sudo tedge config set c8y.root.cert.path /etc/ssl/certs
-sudo tedge config set az.url $IOTHUBNAME.azure-devices.net
+sudo tedge config set az.url "$IOTHUBNAME.azure-devices.net"
sudo tedge config set az.root.cert.path /etc/ssl/certs/Baltimore_CyberTrust_Root.pem
@@ -31,17 +41,18 @@ sudo tedge config list
# Note: This will always upload a new certificate. From time to time
# we should delete the old ones in c8y
-sudo -E tedge cert upload c8y --user $C8YUSERNAME
+sudo -E tedge cert upload c8y --user "$C8YUSERNAME"
cat /etc/mosquitto/mosquitto.conf
python3 -m venv ~/env-c8y-api
+# shellcheck disable=SC1090
source ~/env-c8y-api/bin/activate
pip3 install c8y-api retry-decorator
# Delete the device (ignore error)
set +e
-python3 ./ci/delete_current_device_c8y.py --tenant $C8YTENANT --user $C8YUSERNAME --device $C8YDEVICE --url $C8YURL
+python3 ./ci/delete_current_device_c8y.py --tenant "$C8YTENANT" --user "$C8YUSERNAME" --device "$C8YDEVICE" --url "$C8YURL"
set -e
# Give Cumolocity time to process the cert deletion
@@ -56,9 +67,10 @@ sleep 2
# Retrieve the Cumulocity device ID
-export C8YDEVICEID=$(python3 ./ci/find_device_id.py --tenant $C8YTENANT --user $C8YUSERNAME --device $C8YDEVICE --url $C8YURL)
+C8YDEVICEID=$(python3 ./ci/find_device_id.py --tenant "$C8YTENANT" --user "$C8YUSERNAME" --device "$C8YDEVICE" --url "$C8YURL")
+export C8YDEVICEID
-echo "The new device ID is: " $C8YDEVICEID
+echo "The new device ID is: " "$C8YDEVICEID"
deactivate
diff --git a/ci/installation_scripts/clean_up_rpi.sh b/ci/installation_scripts/clean_up_rpi.sh
index f82cf74a..eb250591 100755
--- a/ci/installation_scripts/clean_up_rpi.sh
+++ b/ci/installation_scripts/clean_up_rpi.sh
@@ -7,8 +7,9 @@ sudo tedge disconnect az
sudo systemctl stop apama
# Load the release package list as $RELEASE_PACKAGES
+# shellcheck disable=SC1091
source ./ci/package_list.sh
# Purge packages
-sudo apt --assume-yes purge $(echo "${RELEASE_PACKAGES[*]}")
-sudo DEBIAN_FRONTEND=noninteractive apt --assume-yes purge $(echo "${EXTERNAL_ARM_PACKAGES[*]}")
+sudo apt --assume-yes purge "${RELEASE_PACKAGES[*]}"
+sudo DEBIAN_FRONTEND=noninteractive apt --assume-yes purge "${EXTERNAL_ARM_PACKAGES[*]}"
diff --git a/ci/installation_scripts/install_for_amd64.sh b/ci/installation_scripts/install_for_amd64.sh
index 32071868..fe6d9bd5 100755
--- a/ci/installation_scripts/install_for_amd64.sh
+++ b/ci/installation_scripts/install_for_amd64.sh
@@ -5,10 +5,11 @@ set -euo pipefail
PKG_DIR=$1
# Load the package list as $EXTERNAL_AMD64_PACKAGES and $RELEASE_PACKAGES
+# shellcheck disable=SC1091
source ./ci/package_list.sh
# Install pre-required packages
-sudo apt-get --assume-yes install $(echo "${EXTERNAL_AMD64_PACKAGES[*]}")
+sudo apt-get --assume-yes install "${EXTERNAL_AMD64_PACKAGES[*]}"
# Install thin-edge packages
for PACKAGE in "${RELEASE_PACKAGES[@]}"
diff --git a/ci/installation_scripts/install_for_arm.sh b/ci/installation_scripts/install_for_arm.sh
index 5d495ea2..45fcd04d 100755
--- a/ci/installation_scripts/install_for_arm.sh
+++ b/ci/installation_scripts/install_for_arm.sh
@@ -5,10 +5,11 @@ set -euo pipefail
PKG_DIR=$1
# Load the package list as $EXTERNAL_ARM_PACKAGES, $RELEASE_PACKAGES
+# shellcheck disable=SC1091
source ./ci/package_list.sh
# Install pre-required packages
-sudo apt-get --assume-yes install $(echo "${EXTERNAL_ARM_PACKAGES[*]}")
+sudo apt-get --assume-yes install "${EXTERNAL_ARM_PACKAGES[*]}"
# Install thin-edge packages
for PACKAGE in "${RELEASE_PACKAGES[@]}"
diff --git a/ci/package_list.sh b/ci/package_list.sh
index 205b6132..0decfc0d 100755
--- a/ci/package_list.sh
+++ b/ci/package_list.sh
@@ -2,31 +2,36 @@
# Note: Must be in the expected installation order
RELEASE_PACKAGES=(
-tedge
-tedge_mapper
-tedge_agent
-tedge_watchdog
-tedge_apt_plugin
-tedge_apama_plugin
-c8y_log_plugin
-c8y_configuration_plugin
+ tedge
+ tedge_mapper
+ tedge_agent
+ tedge_watchdog
+ tedge_apt_plugin
+ tedge_apama_plugin
+ c8y_log_plugin
+ c8y_configuration_plugin
)
+export RELEASE_PACKAGES
TEST_PACKAGES=(
-sawtooth_publisher
-tedge_dummy_plugin
+ sawtooth_publisher
+ tedge_dummy_plugin
)
+export TEST_PACKAGES
EXTERNAL_ARM_PACKAGES=(
-mosquitto-clients
-mosquitto
-libmosquitto1
-collectd-core
-collectd
+ mosquitto-clients
+ mosquitto
+ libmosquitto1
+ collectd-core
+ collectd
)
+export EXTERNAL_ARM_PACKAGES
EXTERNAL_AMD64_PACKAGES=(
-mosquitto
-libmosquitto1
-collectd-core
+ mosquitto
+ libmosquitto1
+ collectd-core
)
+export EXTERNAL_AMD64_PACKAGES
+
diff --git a/ci/report/build.sh b/ci/report/build.sh
index aca5531b..69872670 100755
--- a/ci/report/build.sh
+++ b/ci/report/build.sh
@@ -5,6 +5,7 @@
set -e
python3 -m venv ~/env-builder
+# shellcheck disable=SC1090
source ~/env-builder/bin/activate
pip3 install junitparser
pip3 install junit2html
diff --git a/ci/report/build_local.sh b/ci/report/build_local.sh
index 2af08917..01f75975 100755
--- a/ci/report/build_local.sh
+++ b/ci/report/build_local.sh
@@ -5,6 +5,7 @@
set -e
python3 -m venv ~/env-builder
+# shellcheck disable=SC1090
source ~/env-builder/bin/activate
pip3 install junitparser
pip3 install junit2html