-
Bug
-
Resolution: Won't Fix
-
Blocker
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
The error you're encountering, "bash: cannot set terminal process group," may be because the bash command is trying to allocate a pseudo-terminal (PTY), but it's running in a non-interactive shell within your Jenkins pipeline.
To resolve this, you could maybe use the script step in your Jenkins pipeline to run your desired commands in an interactive shell context.
By wrapping your sh command in the script block, you're creating an interactive context for your bash command, which should resolve the "Inappropriate ioctl for device" error. This should allow your pod to execute the bash command with TTY enabled.