appium-docker-android icon indicating copy to clipboard operation
appium-docker-android copied to clipboard

Latest release of Appium has broken shell commands

Open tking16 opened this issue 3 years ago • 1 comments

I have a Jenkinsfile which runs our Appium Smoke tests, for the past few days the jenkins job has been failing with absolutely no clear explaining, it all runs perfectly fine until it enters the Appium container and tries to run it's first sh command, in which it will hang for about 5 minutes then fail with:

[Pipeline] container
[Pipeline] {
[Pipeline] sh
process apparently never started in /home/jenkins/agent/workspace/android-at-tests@tmp/durable-0f6a0121
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)

So I've now just changed the image from image: "appium/appium" to image: "appium/appium:v1.22.0-p0" and it's working, which leads me to believe a recent update is causing the hang to occur. Maybe since a big refactor?

Jenkinsfile code to reproduce issue:

pipeline {
    agent {
        kubernetes {
            label 'android-at'
            defaultContainer 'jnlp'
            yaml '''
              apiVersion: v1
              kind: Pod
              metadata:
                labels:
                  deploy: android-at
              spec:
                containers:
                  - name: jnlp
                    image: jenkins/jnlp-slave
                  - name: appium
                    image: appium/appium
                    volumeMounts:
                      - mountPath: /root/.android/
                        name: adb
                        readOnly: true
                  - name: at-app
                    image: xxxxxx
                    command:
                      - cat
                    tty: true
                volumes:
                  - name: adb
                    secret:
                      defaultMode: 420
                      optional: false
                      secretName: adb
            '''
        }
    }

    stages {
        stage('Fetch apk') {
            steps {
                container('at-app') {
                    sh "curl ${APK_BUILD_OUTPUT_PATH} > app-global-debug.apk" // This all works okay
                }
            }
        }
stage('Run tests') {
            environment {
            // settings env vars
            }
            steps {
                container('appium') {
                    // Everything hangs and fails from here
                    sh "echo 'connecting to $params.DEVICE device...'"
                    sh "adb connect ${GALAXY_TAB_S8_IP}:5555"

                    
                }
}

tking16 avatar Feb 09 '23 16:02 tking16

Hi @tking16 ,

pass all needed parameters that the container need and just run this last command inside sh command, it should fix the issue. let me know if you still have the issue. If everything work fine, could you please close this issue.

it is interesting that you deploy container every time there is a test instead of having device farm before. could you also write documentation about that @tking16 ? you can commit the documentation under examples/jenkins if you like, so it will benefit the other users that there are ways to use this project.

budtmo avatar Feb 10 '23 11:02 budtmo