Skip to content

[android] reverse tethering support to share network via usb #262

@KostyaSha

Description

@KostyaSha

Tested manually by fetching and running java version (rust version fails on GLIBC, probably needs recompile under docker image env). https://github.com/Genymobile/gnirehtet/tree/master
To run it needs few fetched files and execute command where adb is running. There is autorun option that should handle autosetup.

Maybe you can guide how better to add it as a feature? I guess it needs new ansible option, modify docker container, pass env var and update startup script.

As temp solution it was enough to extend Dockerfile

FROM public.ecr.aws/zebrunner/appium:2.0.1
USER androidusr:androidusr
RUN wget "https://github.com/Genymobile/gnirehtet/releases/download/v2.5.1/gnirehtet-java-v2.5.1.zip"
RUN unzip "gnirehtet-java-v2.5.1.zip"
USER root

and then add docker exec

diff --git a/defaults/main.yml b/defaults/main.yml
index 49e1125..2a3ebe1 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -2,8 +2,8 @@
 DEVICE_IMAGE: public.ecr.aws/zebrunner/mcloud-device
 DEVICE_VERSION: 2.5.1

-APPIUM_IMAGE: public.ecr.aws/zebrunner/appium
-APPIUM_VERSION: 2.0.1
+APPIUM_IMAGE: appium
+APPIUM_VERSION: 2.0.1-custom

 UPLOADER_IMAGE: public.ecr.aws/zebrunner/uploader
 UPLOADER_VERSION: 3.1
diff --git a/roles/devices/templates/zebrunner-farm b/roles/devices/templates/zebrunner-farm
index f25c75b..3732fe4 100755
--- a/roles/devices/templates/zebrunner-farm
+++ b/roles/devices/templates/zebrunner-farm
@@ -105,6 +105,8 @@ function create_containers () {
         -e RELAXED_SECURITY=true \
         {{ APPIUM_IMAGE }}:{{ APPIUM_VERSION }} || echo 'already created'

+    docker exec -dt device-${device_name}-${udid}-appium \
+         bash -c 'cd /home/androidusr/gnirehtet-java/ && ./gnirehtet autorun  2>&1 > /dev/null' || echo "Failed to execute gnirehtet!"
+
     docker run -d --name device-${device_name}-${udid}-uploader --net=${net} \
         --restart on-failure \
         -v device-${device_name}-${udid}:/tmp/log \

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    To do

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions