Hi all,
machine with centos 7
Docker version 17.12.0-ce, build c97c6d6
Jenkins ver. 2.60.3
all plugins updated

situation:
Jenkins (running in container Alpine linux) is configured to download 
Jenkins file from gitlab and the start some containers (based on 
debian:stretch-slim) and run there some scripts....the Jenkins file looks 
like:

node {
    stage('Git fetch') {
        git poll: false, changelog: false, url: 
'https://XXX/gitlab/test.git', credentialsId: 'DOL', branch: 'master'
    }
    def appium_ready = false
    withDockerServer([uri: "tcp://localhost:2376"]) {
        parallel Cucumber: {
            stage ('Starting Cucumber')
            {
                try {
                    docker.image('docker_ruby').inside('--user root:root 
--net=host') {
                        echo 'Waiting for Appium'
                        waitUntil {
                          sleep 2
                          return (appium_ready == true)
                        }
                        try {


                            // #### Show start HERE ####
                            sh 'cucumber -t @add_unread -t ~@wip'


                        }
                        catch ( error ) {
                            cucumber 'report.json'
                        }
                        cucumber 'report.json'
                    }
                }
                catch ( error ) {
                    sh 'curl 
http://localhost:4444/lifecycle-manager/LifecycleServlet?action=shutdown || 
echo "Selenium server unreachable";exit 1' //shutdown selenium & fail
                }
                sh 'curl 
http://localhost:4444/lifecycle-manager/LifecycleServlet?action=shutdown || 
echo "Selenium server unreachable"'
            }
        },
        Appium: {
            stage ('Starting Appium')
            {
                *docker.image('docker_appium').inside('--user root:root 
--net=host') {*
                    *sh 'adb devices; cd scripts && 
./start_environment_new.sh 2>&1 >/dev/null'*
                    appium_ready = true
                    sh 'PID_SEL=`cat /tmp/selenium.pid`; while( ps -p 
$PID_SEL > /dev/null ); do sleep 5;done' // wait doesn't work
                }
            }
        }
    }
}


Everything works fine but when it is in the "*sh 'adb devices; cd scripts 
&& ./start_environment_new.sh 2>&1 >/dev/null'*" then it will timeout and 
say "*Shell Script script returned exit code -2*"
The shell script starts with usual: "#!/bin/bash"

All this approach was working fine until most probably something was 
updated ... docker, Jenkins plugins, some host OS stuff. 

Please don't you anybody have same issue a ideally fix for it? I found some 
hints on google but nothing was working for me :(.

Here is the CLI output:

[Pipeline] }[Pipeline] // stage[Pipeline] withDockerServer[Pipeline] 
{[Pipeline] parallel[Pipeline] [Cucumber] { (Branch: Cucumber)[Pipeline] 
[Appium] { (Branch: Appium)[Pipeline] [Cucumber] stage[Pipeline] [Cucumber] { 
(Starting Cucumber)[Pipeline] [Appium] stage[Pipeline] [Appium] { (Starting 
Appium)[Pipeline] [Cucumber] sh[Cucumber] [voicemail_ta_android] Running shell 
script[Pipeline] [Appium] sh[Cucumber] + docker inspect -f . docker_ruby
[Appium] [voicemail_ta_android] Running shell script
[Appium] + docker inspect -f . docker_appium
[Cucumber] .
[Appium] .[Pipeline] [Cucumber] withDockerContainer[Cucumber] Jenkins seems to 
be running inside container 
9350a6f58ccb1d0000b7fcac229dee8079a191aed4452b1403e3ee4b43f92c63
[Cucumber] $ docker run -t -d -u 1000:1000 --user root:root --net=host -w 
/var/jenkins_home/workspace/voicemail_ta_android --volumes-from 
9350a6f58ccb1d0000b7fcac229dee8079a191aed4452b1403e3ee4b43f92c63 -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat 
docker_ruby[Pipeline] [Cucumber] {[Pipeline] [Appium] 
withDockerContainer[Appium] Jenkins seems to be running inside container 
9350a6f58ccb1d0000b7fcac229dee8079a191aed4452b1403e3ee4b43f92c63
[Appium] $ docker run -t -d -u 1000:1000 --user root:root --net=host -w 
/var/jenkins_home/workspace/voicemail_ta_android --volumes-from 
9350a6f58ccb1d0000b7fcac229dee8079a191aed4452b1403e3ee4b43f92c63 -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat 
docker_appium[Pipeline] [Appium] {[Pipeline] [Cucumber] echo[Cucumber] Waiting 
for Appium[Pipeline] [Cucumber] waitUntil[Pipeline] [Cucumber] {[Pipeline] 
[Appium] sh[Appium] [voicemail_ta_android] Running shell script[Pipeline] 
[Cucumber] sleep[Cucumber] Sleeping for 2 sec[Pipeline] [Cucumber] }[Cucumber] 
Will try again after 0.25 sec[Pipeline] [Cucumber] {[Pipeline] [Cucumber] 
sleep[Cucumber] Sleeping for 2 sec[Pipeline] [Cucumber] }[Cucumber] Will try 
again after 0.3 sec[Pipeline] [Cucumber] {[Pipeline] [Cucumber] sleep[Cucumber] 
Sleeping for 2 sec[Pipeline] [Cucumber] }[Cucumber] Will try again after 0.36 
sec[Pipeline] [Cucumber] {[Pipeline] [Cucumber] sleep[Cucumber] Sleeping for 2 
sec[Pipeline] [Cucumber] }[Cucumber] Will try again after 0.43 sec[Pipeline] 
[Cucumber] {[Pipeline] [Cucumber] sleep[Cucumber] Sleeping for 2 sec[Pipeline] 
[Cucumber] }[Cucumber] Will try again after 0.51 sec[Pipeline] [Cucumber] 
{[Pipeline] [Cucumber] sleep[Cucumber] Sleeping for 2 sec[Pipeline] [Cucumber] 
}[Cucumber] Will try again after 0.62 sec[Pipeline] [Cucumber] {[Pipeline] 
[Cucumber] sleep[Cucumber] Sleeping for 2 sec[Pipeline] [Cucumber] }[Cucumber] 
Will try again after 0.74 sec[Pipeline] [Cucumber] {[Pipeline] [Cucumber] 
sleep[Cucumber] Sleeping for 2 sec[Pipeline] [Appium] }[Appium] $ docker stop 
--time=1 fd73d4d5c85464418c551dc5232d6ba29ab3f6c12b25617bc94ade803f3da8c6
[Appium] $ docker rm -f 
fd73d4d5c85464418c551dc5232d6ba29ab3f6c12b25617bc94ade803f3da8c6


When I will connect to container where the script should be executed I can 
execute it manually without problems.


Thanks for any advice!
Ondrej







-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/bdb05cfd-6267-44c7-95d8-8176468ceb70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to