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

to add enabledTTY for container(name:'name', shell: 'sh')

XMLWordPrintable

      When I launch pipeline in container with cmd: bash --init-file /mer-bash-setup -i, pipeline is writing error.

      I need that pod exec in k8s will with enabledTTY

      My Jenkinsfile

       

      podTemplate(yaml: '''
                    apiVersion: v1
                    kind: Pod
                    metadata:
                      annotations:
                        container.apparmor.security.beta.kubernetes.io/linux: unconfined
                    spec:
                      containers:
                      - name: linux
                        image: harbor.example.com/project-build-linux:4.0.2.249-1
                        imagePullPolicy: Always
                        securityContext:
                          runAsUser: 1000
                          runAsGroup: 1000
                          capabilities:
                            add:
                            - SYS_ADMIN
                        command:
                        - sleep
                        args:
                        - 99d
                        resources:
                          limits:
                            cpu: 16
                            memory: 8Gi
                          requests:
                            cpu: 8
                            memory: 4Gi
                      imagePullSecrets:
                      - name: harbor-registry-secret
      '''
        ) {
        node(POD_LABEL) {
          stage('Build linux version') {
            container(name: 'linux') {
              sh '''
                  bash --init-file /mer-bash-setup -i
              '''
            }
          }
        }
      }
      

       

      Error:

      [Pipeline] sh
      + bash --init-file /mer-bash-setup -i
      bash: cannot set terminal process group (213): Inappropriate ioctl for device
      bash: no job control in this shell

            iocanel Ioannis Canellos
            kemaritsu Alexander
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: