Hi,

      As pointed out here, docker exec will return the wrong status code when --tty is provided, thus failing jobs in Jenkins even though they should have been successful.

      I've written a small PR for that, but I'm not sure if we can just disable the tty.

      Any comments?

          [JENKINS-38305] Remove --tty from docker exec

          dan tran added a comment -

          I dont see this issue in my build, how exactly it fails on you env?

          dan tran added a comment - I dont see this issue in my build, how exactly it fails on you env?

          dantran

          It is a fault of docker exec command:

          kassner@w:~$ DOCKER_ID=$(docker run -d -it php:7.0 /bin/cat)
          kassner@w:~$ docker exec -it ${DOCKER_ID} php -r "exit(2);"
          kassner@w:~$ echo $?
          129
          kassner@w:~$ docker exec -i ${DOCKER_ID} php -r "exit(2);"
          kassner@w:~$ echo $?
          2
          kassner@w:~$
          

          Removing the tty from plugin's call avoids that, but I am not sure if we can just drop the TTY from it, even though it is non-interactive.

          Rafael Kassner added a comment - dantran It is a fault of docker exec command: kassner@w:~$ DOCKER_ID=$(docker run -d -it php:7.0 /bin/cat) kassner@w:~$ docker exec -it ${DOCKER_ID} php -r "exit(2);" kassner@w:~$ echo $? 129 kassner@w:~$ docker exec -i ${DOCKER_ID} php -r "exit(2);" kassner@w:~$ echo $? 2 kassner@w:~$ Removing the tty from plugin's call avoids that, but I am not sure if we can just drop the TTY from it, even though it is non-interactive.

          dan tran added a comment -

          agree that -t is problematic. Thanks for the details

          dan tran added a comment - agree that -t is problematic. Thanks for the details

          Keith Derrick added a comment -

          Any action on this? 

          Supplying --tty makes it impossible to run repo inside a containerized job.

          Keith Derrick added a comment - Any action on this?  Supplying --tty makes it impossible to run repo inside a containerized job.

          Keith Derrick added a comment -

          The best solution would be to provide an option (per job) to disable provision of --tty

          Keith Derrick added a comment - The best solution would be to provide an option (per job) to disable provision of --tty

            Unassigned Unassigned
            kassner Rafael Kassner
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: