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

tty is not allocated for `sh` step in `docker` agent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline
    • None

       

      With test pipeline:

      pipeline {
          agent { docker { image 'alpine' } }
          stages {
              stage('test  tty') {
                  steps {
                      sh "tty"
                  }
              }
          }
      }
      

       

       

      I can see in logs:

       

      docker run -t -d [ ... other options ... ] cat
      

      so the container is started with tty

       

      but output from `sh` command is:

      + tty
      not a tty
      

      It looks like shell command is executed with `docker exec somename somecommand` instead of `docker exec -t somename somecommand`

      Is there a way to start `sh` step with tty enabled?

       

      Note: in case of some commands it is important to run with `tty`, for example https://mustache.github.io/mustache.1.html

      `mustache --error params template` will fail with error.

       

      I am not sure if JENKINS-39013 is related - in my case container is run with tty but 'sh' step inside the container are not.

       

       

            Unassigned Unassigned
            rempusze Bartosz Rempuszewski
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: