From acd47eb6f15b30a988758bcce56a9464d4d51178 Mon Sep 17 00:00:00 2001 From: vdelendik Date: Tue, 21 Nov 2023 16:34:03 +0300 Subject: [PATCH 01/16] #268: bump up to mcloud-device:2.6.1 --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index ea8dfbb..9672c71 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ --- DEVICE_IMAGE: public.ecr.aws/zebrunner/mcloud-device -DEVICE_VERSION: 2.6 +DEVICE_VERSION: 2.6.1 APPIUM_IMAGE: public.ecr.aws/zebrunner/appium APPIUM_VERSION: 2.0.7 From 88de30e5cc51ecfef30c577ab2ae3763201d871e Mon Sep 17 00:00:00 2001 From: vdelendik Date: Tue, 21 Nov 2023 16:34:42 +0300 Subject: [PATCH 02/16] #269: bump up to appium:2.0.9 --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 9672c71..deab50f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,7 +3,7 @@ DEVICE_IMAGE: public.ecr.aws/zebrunner/mcloud-device DEVICE_VERSION: 2.6.1 APPIUM_IMAGE: public.ecr.aws/zebrunner/appium -APPIUM_VERSION: 2.0.7 +APPIUM_VERSION: 2.0.9 UPLOADER_IMAGE: public.ecr.aws/zebrunner/uploader UPLOADER_VERSION: 3.4 From c2c7922b44aa1f852c88bbf86da94d1e8f204a67 Mon Sep 17 00:00:00 2001 From: vdelendik Date: Tue, 21 Nov 2023 16:40:42 +0300 Subject: [PATCH 03/16] #267: added APPIUM_APP_* settings for appium containers --- roles/devices/templates/zebrunner-farm | 8 ++++++++ roles/mac-devices/templates/zebrunner-farm | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index a21872a..f4894be 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -114,6 +114,10 @@ function create_containers () { -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ -e APPIUM_HOST=${device_name}-appium \ + -e APPIUM_APP_SIZE_DISABLE=false \ + -e APPIUM_APP_FETCH_RETRIES=2 \ + -e APPIUM_MAX_LOCK_FILE_LIFETIME=180 \ + -e APPIUM_APP_WAITING_TIMEOUT=90 \ -e SELENIUM_HOST={{ SELENIUM_HUB_HOST }} -e SELENIUM_PORT={{ SELENIUM_HUB_PORT }} \ -e DEFAULT_CAPABILITIES=true \ -e DEVICE_NAME="${device_name}" -e DEVICE_UDID="$STF_DEVICE_UDID" \ @@ -198,6 +202,10 @@ function create_containers () { -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ -e APPIUM_HOST=${device_name}-appium \ + -e APPIUM_APP_SIZE_DISABLE=false \ + -e APPIUM_APP_FETCH_RETRIES=2 \ + -e APPIUM_MAX_LOCK_FILE_LIFETIME=180 \ + -e APPIUM_APP_WAITING_TIMEOUT=90 \ -e SELENIUM_HOST={{ SELENIUM_HUB_HOST }} -e SELENIUM_PORT={{ SELENIUM_HUB_PORT }} \ -e DEFAULT_CAPABILITIES=true \ -e DEVICE_NAME="${device_name}" -e DEVICE_UDID="${udid}" \ diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 3cb8867..41cd723 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -179,6 +179,10 @@ function create_containers () { -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ -e APPIUM_HOST=${device_name}-appium \ + -e APPIUM_APP_SIZE_DISABLE=false \ + -e APPIUM_APP_FETCH_RETRIES=2 \ + -e APPIUM_MAX_LOCK_FILE_LIFETIME=180 \ + -e APPIUM_APP_WAITING_TIMEOUT=90 \ -e SELENIUM_HOST={{ SELENIUM_HUB_HOST }} -e SELENIUM_PORT={{ SELENIUM_HUB_PORT }} \ -e DEFAULT_CAPABILITIES=true \ -e DEVICE_NAME="${device_name}" -e DEVICE_UDID="${udid}" \ From 56e94061e1b55ce3d9ae4806fba8f90ba9f46d8e Mon Sep 17 00:00:00 2001 From: vdelendik Date: Tue, 21 Nov 2023 16:55:12 +0300 Subject: [PATCH 04/16] #267: declared APPIUM_APP params in better way for managing via defaults/main.yml --- defaults/main.yml | 9 +++++++++ roles/devices/templates/zebrunner-farm | 16 ++++++++-------- roles/mac-devices/templates/zebrunner-farm | 8 ++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index deab50f..388061a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,3 +7,12 @@ APPIUM_VERSION: 2.0.9 UPLOADER_IMAGE: public.ecr.aws/zebrunner/uploader UPLOADER_VERSION: 3.4 + +# Put true to disable app size check using local appium storage +APPIUM_APP_SIZE_DISABLE: false + +# Optomized app verifications for AppCenter and AWS S3 storages +APPIUM_APP_FETCH_RETRIES: 2 +APPIUM_MAX_LOCK_FILE_LIFETIME: 180 +APPIUM_APP_WAITING_TIMEOUT: 90 + diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index f4894be..3bd87c2 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -114,10 +114,10 @@ function create_containers () { -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ -e APPIUM_HOST=${device_name}-appium \ - -e APPIUM_APP_SIZE_DISABLE=false \ - -e APPIUM_APP_FETCH_RETRIES=2 \ - -e APPIUM_MAX_LOCK_FILE_LIFETIME=180 \ - -e APPIUM_APP_WAITING_TIMEOUT=90 \ + -e APPIUM_APP_SIZE_DISABLE={{ APPIUM_APP_SIZE_DISABLE }} \ + -e APPIUM_APP_FETCH_RETRIES={{ APPIUM_APP_FETCH_RETRIES }} \ + -e APPIUM_MAX_LOCK_FILE_LIFETIME={{ APPIUM_MAX_LOCK_FILE_LIFETIME }} \ + -e APPIUM_APP_WAITING_TIMEOUT={{ APPIUM_APP_WAITING_TIMEOUT }} \ -e SELENIUM_HOST={{ SELENIUM_HUB_HOST }} -e SELENIUM_PORT={{ SELENIUM_HUB_PORT }} \ -e DEFAULT_CAPABILITIES=true \ -e DEVICE_NAME="${device_name}" -e DEVICE_UDID="$STF_DEVICE_UDID" \ @@ -202,10 +202,10 @@ function create_containers () { -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ -e APPIUM_HOST=${device_name}-appium \ - -e APPIUM_APP_SIZE_DISABLE=false \ - -e APPIUM_APP_FETCH_RETRIES=2 \ - -e APPIUM_MAX_LOCK_FILE_LIFETIME=180 \ - -e APPIUM_APP_WAITING_TIMEOUT=90 \ + -e APPIUM_APP_SIZE_DISABLE={{ APPIUM_APP_SIZE_DISABLE }} \ + -e APPIUM_APP_FETCH_RETRIES={{ APPIUM_APP_FETCH_RETRIES }} \ + -e APPIUM_MAX_LOCK_FILE_LIFETIME={{ APPIUM_MAX_LOCK_FILE_LIFETIME }} \ + -e APPIUM_APP_WAITING_TIMEOUT={{ APPIUM_APP_WAITING_TIMEOUT }} \ -e SELENIUM_HOST={{ SELENIUM_HUB_HOST }} -e SELENIUM_PORT={{ SELENIUM_HUB_PORT }} \ -e DEFAULT_CAPABILITIES=true \ -e DEVICE_NAME="${device_name}" -e DEVICE_UDID="${udid}" \ diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 41cd723..b618f1e 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -179,10 +179,10 @@ function create_containers () { -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ -e APPIUM_HOST=${device_name}-appium \ - -e APPIUM_APP_SIZE_DISABLE=false \ - -e APPIUM_APP_FETCH_RETRIES=2 \ - -e APPIUM_MAX_LOCK_FILE_LIFETIME=180 \ - -e APPIUM_APP_WAITING_TIMEOUT=90 \ + -e APPIUM_APP_SIZE_DISABLE={{ APPIUM_APP_SIZE_DISABLE }} \ + -e APPIUM_APP_FETCH_RETRIES={{ APPIUM_APP_FETCH_RETRIES }} \ + -e APPIUM_MAX_LOCK_FILE_LIFETIME={{ APPIUM_MAX_LOCK_FILE_LIFETIME }} \ + -e APPIUM_APP_WAITING_TIMEOUT={{ APPIUM_APP_WAITING_TIMEOUT }} \ -e SELENIUM_HOST={{ SELENIUM_HUB_HOST }} -e SELENIUM_PORT={{ SELENIUM_HUB_PORT }} \ -e DEFAULT_CAPABILITIES=true \ -e DEVICE_NAME="${device_name}" -e DEVICE_UDID="${udid}" \ From b72799057337986fbabc4b952643c933a8b6619b Mon Sep 17 00:00:00 2001 From: vdelendik Date: Wed, 22 Nov 2023 00:05:05 +0300 Subject: [PATCH 05/16] #218: removed usage of /opt/zebrunner mcloud-storage-volume --- roles/devices/templates/zebrunner-farm | 3 --- roles/mac-devices/templates/zebrunner-farm | 2 -- zebrunner.sh | 1 - 3 files changed, 6 deletions(-) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 3bd87c2..44044db 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -104,7 +104,6 @@ function create_containers () { --restart on-failure $DEVICE_ARG \ -v mcloud-key-volume:/root/.android \ -v appium-storage-volume:/opt/appium-storage \ - -v mcloud-storage-volume:/opt/zebrunner \ -v device-${device_name}-${udid}:/tmp/log \ -e TASK_LOG=/tmp/log/appium.log \ -e PLATFORM_NAME=$platform_name \ @@ -187,7 +186,6 @@ function create_containers () { docker run -itd --name device-${device_name}-${udid}-appium -m 1g --log-opt max-size=1024m --log-opt max-file=2 --net=${net} \ --restart on-failure \ -v appium-storage-volume:/opt/appium-storage \ - -v mcloud-storage-volume:/opt/zebrunner \ -v device-${device_name}-${udid}:/tmp/log \ -v device-${device_name}-${udid}-lockdown:/var/lib/lockdown \ --device=/dev/device-${device_name}-${udid}:${usb_bus} \ @@ -230,7 +228,6 @@ function create_containers () { docker run -d --name device-${device_name}-${udid} --log-opt max-size=1024m --log-opt max-file=2 --net=${net} \ --restart on-failure \ --link device-${device_name}-${udid}-appium:appium \ - -v mcloud-storage-volume:/opt/zebrunner \ -e WDA_HOST=appium \ -e WDA_WAIT_TIMEOUT=180 \ -e PLATFORM_NAME=$platform_name \ diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index b618f1e..ca6a3f3 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -165,7 +165,6 @@ function create_containers () { -e USBMUXD_SOCKET_ADDRESS={{ USBMUXD_SOCKET_ADDRESS }} \ --restart on-failure \ -v appium-storage-volume:/opt/appium-storage \ - -v mcloud-storage-volume:/opt/zebrunner \ -v device-${device_name}-${udid}:/tmp/log \ -e TASK_LOG=/tmp/log/appium.log \ -e APPIUM_CLI="--session-override" \ @@ -208,7 +207,6 @@ function create_containers () { -e USBMUXD_SOCKET_ADDRESS={{ USBMUXD_SOCKET_ADDRESS }} \ --restart on-failure \ --link device-${device_name}-${udid}-appium:appium \ - -v mcloud-storage-volume:/opt/zebrunner \ -e WDA_HOST=appium \ -e WDA_WAIT_TIMEOUT=180 \ -e PLATFORM_NAME=$platform_name \ diff --git a/zebrunner.sh b/zebrunner.sh index 1d6f3d1..17ef6a6 100755 --- a/zebrunner.sh +++ b/zebrunner.sh @@ -88,7 +88,6 @@ rm -f roles/mac-devices/vars/main.yml docker volume rm appium-storage-volume - docker volume rm mcloud-storage-volume } status() { From 1e77090bbe4d165c56d34d2ffeffdbabce4432c9 Mon Sep 17 00:00:00 2001 From: vdelendik Date: Wed, 22 Nov 2023 00:11:25 +0300 Subject: [PATCH 06/16] #211: stop and down operations executed in background now --- roles/devices/templates/zebrunner-farm | 8 ++++---- roles/mac-devices/templates/zebrunner-farm | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 44044db..7494672 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -261,7 +261,7 @@ function stop() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - stop_containers ${device_name} ${udid} + stop_containers ${device_name} ${udid} & else # as no device filter provided continue with stopping all device containers while read -r line @@ -273,7 +273,7 @@ function stop() { local wireless=`echo ${line} | grep "$filter_device" | cut -d '|' -f 9` if [ -L "/dev/device-${device_name}-${udid}" ] || [ "$wireless" == "True" ]; then - stop_containers ${device_name} ${udid} + stop_containers ${device_name} ${udid} & fi done < ${devices} fi @@ -305,7 +305,7 @@ function down() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - remove_containers ${device_name} ${udid} + remove_containers ${device_name} ${udid} & else while read -r line do @@ -313,7 +313,7 @@ function down() { #echo "device_name: $device_name" local udid=`echo ${line} | grep "$filter_device" | cut -d '|' -f 3` #echo "udid: $udid" - remove_containers ${device_name} ${udid} + remove_containers ${device_name} ${udid} & done < ${devices} fi } diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index ca6a3f3..9174355 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -240,7 +240,7 @@ function stop() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - stop_containers ${device_name} ${udid} + stop_containers ${device_name} ${udid} & else launchctl unload $HOME/Library/LaunchAgents/ZebrunnerDevicesListener.plist > /dev/null 2>&1 @@ -251,7 +251,7 @@ function stop() { #echo "device_name: $device_name" local udid=`echo ${line} | grep "$filter_device" | cut -d '|' -f 3` #echo "udid: $udid" - stop_containers ${device_name} ${udid} + stop_containers ${device_name} ${udid} & done < ${devices} fi } @@ -282,7 +282,7 @@ function down() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - remove_containers ${device_name} ${udid} + remove_containers ${device_name} ${udid} & else launchctl unload $HOME/Library/LaunchAgents/ZebrunnerDevicesListener.plist > /dev/null 2>&1 @@ -292,7 +292,7 @@ function down() { #echo "device_name: $device_name" local udid=`echo ${line} | grep "$filter_device" | cut -d '|' -f 3` #echo "udid: $udid" - remove_containers ${device_name} ${udid} + remove_containers ${device_name} ${udid} & done < ${devices} fi } From 8c694f653ec9c604a83e6c826cc3a83664dd926a Mon Sep 17 00:00:00 2001 From: vdelendik Date: Wed, 22 Nov 2023 00:13:51 +0300 Subject: [PATCH 07/16] #211: don't do stop/down in backgroud for a single device --- roles/devices/templates/zebrunner-farm | 4 ++-- roles/mac-devices/templates/zebrunner-farm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 7494672..90173c7 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -261,7 +261,7 @@ function stop() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - stop_containers ${device_name} ${udid} & + stop_containers ${device_name} ${udid} else # as no device filter provided continue with stopping all device containers while read -r line @@ -305,7 +305,7 @@ function down() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - remove_containers ${device_name} ${udid} & + remove_containers ${device_name} ${udid} else while read -r line do diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 9174355..ff48b96 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -240,7 +240,7 @@ function stop() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - stop_containers ${device_name} ${udid} & + stop_containers ${device_name} ${udid} else launchctl unload $HOME/Library/LaunchAgents/ZebrunnerDevicesListener.plist > /dev/null 2>&1 @@ -282,7 +282,7 @@ function down() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` - remove_containers ${device_name} ${udid} & + remove_containers ${device_name} ${udid} else launchctl unload $HOME/Library/LaunchAgents/ZebrunnerDevicesListener.plist > /dev/null 2>&1 From 58f3693b974607bb367beae0c520d5b3ff4cd891 Mon Sep 17 00:00:00 2001 From: vdelendik Date: Wed, 22 Nov 2023 00:17:22 +0300 Subject: [PATCH 08/16] #211: added echoing Press to proceed... for bg executions --- roles/devices/templates/zebrunner-farm | 2 ++ roles/mac-devices/templates/zebrunner-farm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 90173c7..e7d793a 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -276,6 +276,7 @@ function stop() { stop_containers ${device_name} ${udid} & fi done < ${devices} + echo "Press to proceed..." fi } @@ -315,6 +316,7 @@ function down() { #echo "udid: $udid" remove_containers ${device_name} ${udid} & done < ${devices} + echo "Press to proceed..." fi } diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index ff48b96..3131120 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -253,6 +253,7 @@ function stop() { #echo "udid: $udid" stop_containers ${device_name} ${udid} & done < ${devices} + echo "Press to proceed..." fi } @@ -294,6 +295,7 @@ function down() { #echo "udid: $udid" remove_containers ${device_name} ${udid} & done < ${devices} + echo "Press to proceed..." fi } From d9647300056c76d7339cc8509ca6e464af70157b Mon Sep 17 00:00:00 2001 From: vdelendik Date: Wed, 22 Nov 2023 00:25:28 +0300 Subject: [PATCH 09/16] #265: printed actually used wda file path nd bundle id for iOS devices --- roles/devices/templates/zebrunner-farm | 4 ++-- roles/mac-devices/templates/zebrunner-farm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index e7d793a..0294469 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -162,7 +162,6 @@ function create_containers () { #TODO: comment echoing wda related detailes before release local wdaIpaPath={{ WDA_FILE }} local deviceWdaIpaPath=`cat ${devices} | grep "$udid" | cut -d '|' -f 10` - echo "deviceWdaIpaPath: $deviceWdaIpaPath" if [ ! -z $deviceWdaIpaPath ] && [ ! "$deviceWdaIpaPath" == "/dev/null" ]; then wdaIpaPath=$deviceWdaIpaPath fi @@ -170,10 +169,10 @@ function create_containers () { # unable to use empty value for docker volume share! wdaIpaPath="/dev/null" fi + echo "wdaIpaPath: $wdaIpaPath" local wdaBundleId={{ WDA_BUNDLEID }} local deviceWdaBundleId=`cat ${devices} | grep "$udid" | cut -d '|' -f 11` - echo "deviceWdaBundleId: $deviceWdaBundleId" if [ ! -z $deviceWdaBundleId ]; then wdaBundleId=$deviceWdaBundleId fi @@ -181,6 +180,7 @@ function create_containers () { # provide default value if empty wdaBundleId="com.facebook.WebDriverAgentRunner.xctrunner" fi + echo "wdaBundleId: $wdaBundleId" # candidates for removal: ADB_PORT, STF_PROVIDER_MAX_PORT docker run -itd --name device-${device_name}-${udid}-appium -m 1g --log-opt max-size=1024m --log-opt max-file=2 --net=${net} \ diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 3131120..4f69a6f 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -140,7 +140,6 @@ function create_containers () { local wdaIpaPath={{ WDA_FILE }} local deviceWdaIpaPath=`cat ${devices} | grep "$udid" | cut -d '|' -f 10` - #echo "deviceWdaIpaPath: $deviceWdaIpaPath" if [ ! -z $deviceWdaIpaPath ] && [ ! "$deviceWdaIpaPath" == "/dev/null" ]; then wdaIpaPath=$deviceWdaIpaPath fi @@ -148,10 +147,10 @@ function create_containers () { # unable to use empty value for docker volume share! wdaIpaPath="/dev/null" fi + echo "wdaIpaPath: $wdaIpaPath" local wdaBundleId={{ WDA_BUNDLEID }} local deviceWdaBundleId=`cat ${devices} | grep "$udid" | cut -d '|' -f 11` - #echo "deviceWdaBundleId: $deviceWdaBundleId" if [ ! -z $deviceWdaBundleId ]; then wdaBundleId=$deviceWdaBundleId fi @@ -159,6 +158,7 @@ function create_containers () { # provide default value if empty wdaBundleId="com.facebook.WebDriverAgentRunner.xctrunner" fi + echo "wdaBundleId: $wdaBundleId" # candidates for removal: ADB_PORT, STF_PROVIDER_MAX_PORT docker run -itd --name device-${device_name}-${udid}-appium -m 1g --log-opt max-size=1024m --log-opt max-file=2 --net=${net} \ From fbc4cb0c1cd1144f178ac276f4f09e9af559f422 Mon Sep 17 00:00:00 2001 From: vdelendik Date: Wed, 22 Nov 2023 00:32:13 +0300 Subject: [PATCH 10/16] #237: echoing warning if invalid device filter is provided --- roles/devices/templates/zebrunner-farm | 15 +++++++++++++++ roles/mac-devices/templates/zebrunner-farm | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 0294469..254b8eb 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -261,6 +261,11 @@ function stop() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` + if [ -z $device_name ] || [ -z $udid ]; then + echo_warning "Unable to find device by \"$filter_device\"!" + return 0 + fi + stop_containers ${device_name} ${udid} else # as no device filter provided continue with stopping all device containers @@ -306,6 +311,11 @@ function down() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` + if [ -z $device_name ] || [ -z $udid ]; then + echo_warning "Unable to find device by \"$filter_device\"!" + return 0 + fi + remove_containers ${device_name} ${udid} else while read -r line @@ -396,6 +406,11 @@ function start() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` + if [ -z $device_name ] || [ -z $udid ]; then + echo_warning "Unable to find device by \"$filter_device\"!" + return 0 + fi + create_containers ${device_name} ${udid} start_containers ${device_name} ${udid} else diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 4f69a6f..59d0c35 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -240,6 +240,11 @@ function stop() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` + if [ -z $device_name ] || [ -z $udid ]; then + echo_warning "Unable to find device by \"$filter_device\"!" + return 0 + fi + stop_containers ${device_name} ${udid} else launchctl unload $HOME/Library/LaunchAgents/ZebrunnerDevicesListener.plist > /dev/null 2>&1 @@ -283,6 +288,11 @@ function down() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` + if [ -z $device_name ] || [ -z $udid ]; then + echo_warning "Unable to find device by \"$filter_device\"!" + return 0 + fi + remove_containers ${device_name} ${udid} else launchctl unload $HOME/Library/LaunchAgents/ZebrunnerDevicesListener.plist > /dev/null 2>&1 @@ -386,6 +396,11 @@ function start() { local device_name=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 1` local udid=`cat ${devices} | grep "$filter_device" | cut -d '|' -f 3` + if [ -z $device_name ] || [ -z $udid ]; then + echo_warning "Unable to find device by \"$filter_device\"!" + return 0 + fi + create_containers ${device_name} ${udid} start_containers ${device_name} ${udid} else From fe8765029ee2fa8dd90effd996f7e5e6e2cbff55 Mon Sep 17 00:00:00 2001 From: vdelendik Date: Wed, 22 Nov 2023 00:37:46 +0300 Subject: [PATCH 11/16] #219: removed APPIUM_HOST env var declaration for appium container --- roles/devices/templates/zebrunner-farm | 2 -- roles/mac-devices/templates/zebrunner-farm | 1 - 2 files changed, 3 deletions(-) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 254b8eb..75fbcfa 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -112,7 +112,6 @@ function create_containers () { -e CONNECT_TO_GRID=true \ -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ - -e APPIUM_HOST=${device_name}-appium \ -e APPIUM_APP_SIZE_DISABLE={{ APPIUM_APP_SIZE_DISABLE }} \ -e APPIUM_APP_FETCH_RETRIES={{ APPIUM_APP_FETCH_RETRIES }} \ -e APPIUM_MAX_LOCK_FILE_LIFETIME={{ APPIUM_MAX_LOCK_FILE_LIFETIME }} \ @@ -199,7 +198,6 @@ function create_containers () { -e CONNECT_TO_GRID=true \ -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ - -e APPIUM_HOST=${device_name}-appium \ -e APPIUM_APP_SIZE_DISABLE={{ APPIUM_APP_SIZE_DISABLE }} \ -e APPIUM_APP_FETCH_RETRIES={{ APPIUM_APP_FETCH_RETRIES }} \ -e APPIUM_MAX_LOCK_FILE_LIFETIME={{ APPIUM_MAX_LOCK_FILE_LIFETIME }} \ diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 59d0c35..893754d 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -177,7 +177,6 @@ function create_containers () { -e CONNECT_TO_GRID=true \ -e CUSTOM_NODE_CONFIG=true \ -e STF_PROVIDER_HOST={{ STF_PROVIDER_HOST }} \ - -e APPIUM_HOST=${device_name}-appium \ -e APPIUM_APP_SIZE_DISABLE={{ APPIUM_APP_SIZE_DISABLE }} \ -e APPIUM_APP_FETCH_RETRIES={{ APPIUM_APP_FETCH_RETRIES }} \ -e APPIUM_MAX_LOCK_FILE_LIFETIME={{ APPIUM_MAX_LOCK_FILE_LIFETIME }} \ From a3d9afd4854b85c81c6f4a3bc536b742b16c0b34 Mon Sep 17 00:00:00 2001 From: kolyakrasnik Date: Wed, 22 Nov 2023 19:24:47 +0300 Subject: [PATCH 12/16] #211: reverted stop/down in background --- roles/devices/templates/zebrunner-farm | 6 ++---- roles/mac-devices/templates/zebrunner-farm | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 75fbcfa..0e1f4c8 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -276,10 +276,9 @@ function stop() { local wireless=`echo ${line} | grep "$filter_device" | cut -d '|' -f 9` if [ -L "/dev/device-${device_name}-${udid}" ] || [ "$wireless" == "True" ]; then - stop_containers ${device_name} ${udid} & + stop_containers ${device_name} ${udid} fi done < ${devices} - echo "Press to proceed..." fi } @@ -322,9 +321,8 @@ function down() { #echo "device_name: $device_name" local udid=`echo ${line} | grep "$filter_device" | cut -d '|' -f 3` #echo "udid: $udid" - remove_containers ${device_name} ${udid} & + remove_containers ${device_name} ${udid} done < ${devices} - echo "Press to proceed..." fi } diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 893754d..49c4848 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -255,9 +255,8 @@ function stop() { #echo "device_name: $device_name" local udid=`echo ${line} | grep "$filter_device" | cut -d '|' -f 3` #echo "udid: $udid" - stop_containers ${device_name} ${udid} & + stop_containers ${device_name} ${udid} done < ${devices} - echo "Press to proceed..." fi } @@ -302,9 +301,8 @@ function down() { #echo "device_name: $device_name" local udid=`echo ${line} | grep "$filter_device" | cut -d '|' -f 3` #echo "udid: $udid" - remove_containers ${device_name} ${udid} & + remove_containers ${device_name} ${udid} done < ${devices} - echo "Press to proceed..." fi } From eb842d7a1f2bf36a21761f35a82cfa52787e31bd Mon Sep 17 00:00:00 2001 From: azarouski Date: Fri, 24 Nov 2023 16:13:32 +0100 Subject: [PATCH 13/16] ansible scripts were modified to detect OS name and assert compatibility --- roles/devices/tasks/udev.yml | 10 ++++++++++ roles/mac-devices/tasks/usbmuxd.yml | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/roles/devices/tasks/udev.yml b/roles/devices/tasks/udev.yml index 2854477..faa1603 100644 --- a/roles/devices/tasks/udev.yml +++ b/roles/devices/tasks/udev.yml @@ -1,5 +1,15 @@ --- +- name: Get OS name + shell: uname + register: os + +- name: Check OS compatibility + ansible.builtin.assert: + that: + - os.stdout is search("Linux") + fail_msg: "OS version is not compatible" + - name: Check if roles/devices/vars/main.yml file is generated stat: path=roles/devices/vars/main.yml register: main_yml diff --git a/roles/mac-devices/tasks/usbmuxd.yml b/roles/mac-devices/tasks/usbmuxd.yml index c8a7e1b..fe20880 100644 --- a/roles/mac-devices/tasks/usbmuxd.yml +++ b/roles/mac-devices/tasks/usbmuxd.yml @@ -1,5 +1,15 @@ --- +- name: Get OS name + shell: uname + register: os + +- name: Check OS compatibility + ansible.builtin.assert: + that: + - os.stdout is search("Darwin") + fail_msg: "OS version is not compatible" + - name: Check if roles/mac-devices/vars/main.yml file is generated stat: path=roles/mac-devices/vars/main.yml register: main_yml From 7f7a3021fa53ee3581851e1d45ba41b7f5ca59a4 Mon Sep 17 00:00:00 2001 From: azarouski Date: Fri, 24 Nov 2023 16:32:43 +0100 Subject: [PATCH 14/16] Exclamation marks were added to error messages --- roles/devices/tasks/udev.yml | 4 ++-- roles/mac-devices/tasks/usbmuxd.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/devices/tasks/udev.yml b/roles/devices/tasks/udev.yml index faa1603..a934d2c 100644 --- a/roles/devices/tasks/udev.yml +++ b/roles/devices/tasks/udev.yml @@ -8,7 +8,7 @@ ansible.builtin.assert: that: - os.stdout is search("Linux") - fail_msg: "OS version is not compatible" + fail_msg: "OS version is not compatible!" - name: Check if roles/devices/vars/main.yml file is generated stat: path=roles/devices/vars/main.yml @@ -16,7 +16,7 @@ - name: Verify Setup fail: - msg: "You have to setup services in advance using: ./zebrunner.sh setup" + msg: "You have to setup services in advance using: ./zebrunner.sh setup!" when: not main_yml.stat.exists - name: copy script to launch container with appium for device diff --git a/roles/mac-devices/tasks/usbmuxd.yml b/roles/mac-devices/tasks/usbmuxd.yml index fe20880..7e84892 100644 --- a/roles/mac-devices/tasks/usbmuxd.yml +++ b/roles/mac-devices/tasks/usbmuxd.yml @@ -8,7 +8,7 @@ ansible.builtin.assert: that: - os.stdout is search("Darwin") - fail_msg: "OS version is not compatible" + fail_msg: "OS version is not compatible!" - name: Check if roles/mac-devices/vars/main.yml file is generated stat: path=roles/mac-devices/vars/main.yml @@ -16,7 +16,7 @@ - name: Verify Setup fail: - msg: "You have to setup services in advance using: ./zebrunner.sh setup" + msg: "You have to setup services in advance using: ./zebrunner.sh setup!" when: not main_yml.stat.exists - name: copy script to launch container with appium for device From 0b71a4329ad8985a1ceeb7ebfcf4b7fd0a4867be Mon Sep 17 00:00:00 2001 From: azarouski Date: Thu, 30 Nov 2023 15:54:23 +0100 Subject: [PATCH 15/16] was removed from zebrunner-farm script. Action type and full device UDID now passing directly to zebrunner-farm --- roles/devices/templates/90_mcloud.rules | 4 ++-- roles/devices/templates/zebrunner-farm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/devices/templates/90_mcloud.rules b/roles/devices/templates/90_mcloud.rules index be67920..99293c5 100644 --- a/roles/devices/templates/90_mcloud.rules +++ b/roles/devices/templates/90_mcloud.rules @@ -1,5 +1,5 @@ {% for device in devices %} SUBSYSTEM=="usb", ENV{ID_SERIAL_SHORT}=="{{ device.id | replace('-','') }}", MODE="0666", SYMLINK+="device-{{ device.name }}-{{ device.id }}" -ACTION=="remove", ENV{ID_SERIAL_SHORT}=="{{ device.id | replace('-','') }}", RUN+="/usr/local/bin/zebrunner-farm" -ACTION=="add", ENV{ID_SERIAL_SHORT}=="{{ device.id | replace('-','') }}", RUN+="/usr/local/bin/zebrunner-farm" +ACTION=="remove", ENV{ID_SERIAL_SHORT}=="{{ device.id | replace('-','') }}", RUN+="/usr/local/bin/zebrunner-farm remove {{ device.id }}" +ACTION=="add", ENV{ID_SERIAL_SHORT}=="{{ device.id | replace('-','') }}", RUN+="/usr/local/bin/zebrunner-farm add {{ device.id }}" {% endfor %} diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm index 0e1f4c8..c71a570 100755 --- a/roles/devices/templates/zebrunner-farm +++ b/roles/devices/templates/zebrunner-farm @@ -2,7 +2,7 @@ if [ ! -z $ACTION ]; then # triggered by udev rule where device serial (udid) is a must to proceed! - if [ -z $ID_SERIAL_SHORT ]; then + if [ -z $2 ]; then echo "do nothing as device id/udid missed." exit 0 fi @@ -507,14 +507,14 @@ case "$ACTION" in add) # #122 on start obligatory re-created any existing exited containers # add action means physical connect via usb and as result we have to remove any existing container for device! - down ${ID_SERIAL_SHORT} - start ${ID_SERIAL_SHORT} + down $2 + start $2 ;; bind) echo "do nothing" ;; remove) - down ${ID_SERIAL_SHORT} + down $2 ;; start) start $2 From 583e4871320f03801fe6af4ba10ec0cc7b6acc7c Mon Sep 17 00:00:00 2001 From: azarouski Date: Thu, 30 Nov 2023 16:23:01 +0100 Subject: [PATCH 16/16] mac-devices script was edited due to new fixes --- roles/mac-devices/templates/zebrunner-farm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/mac-devices/templates/zebrunner-farm b/roles/mac-devices/templates/zebrunner-farm index 49c4848..bd65cdf 100755 --- a/roles/mac-devices/templates/zebrunner-farm +++ b/roles/mac-devices/templates/zebrunner-farm @@ -6,7 +6,7 @@ export DOCKER_DEFAULT_PLATFORM=linux/amd64 if [ ! -z $ACTION ]; then # triggered by udev rule where device serial (udid) is a must to proceed! - if [ -z $ID_SERIAL_SHORT ]; then + if [ -z $2 ]; then echo "do nothing as device id/udid missed." exit 0 fi @@ -498,14 +498,14 @@ case "$ACTION" in add) # #122 on start obligatory re-created any existing exited containers # add action means physical connect via usb and as result we have to remove any existing container for device! - down ${ID_SERIAL_SHORT} - start ${ID_SERIAL_SHORT} + down $2 + start $2 ;; bind) echo "do nothing" ;; remove) - down ${ID_SERIAL_SHORT} + down $2 ;; start) start $2