Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38305

Remove --tty from docker exec

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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?

        Attachments

          Activity

          Hide
          dantran dan tran added a comment -

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

          Show
          dantran dan tran added a comment - I dont see this issue in my build, how exactly it fails on you env?
          Hide
          kassner Rafael Kassner added a comment -

          dan tran

          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.

          Show
          kassner Rafael Kassner added a comment - dan tran 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.
          Hide
          dantran dan tran added a comment -

          agree that -t is problematic. Thanks for the details

          Show
          dantran dan tran added a comment - agree that -t is problematic. Thanks for the details
          Hide
          kdopen Keith Derrick added a comment -

          Any action on this? 

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

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

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

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

            People

            • Assignee:
              Unassigned
              Reporter:
              kassner Rafael Kassner
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: