-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
When `checkout` or `git` steps run inside the Kubernetes plugin's `container` block the Git CLI is expected to be executed on the specified container but it is not. It is executed in the jnlp container disregarding the `container` step.
Below is a test Pipeline. It relies on the custom docker image (duemir/jenkins-jnlp-agent:alpine-no-git) which is based on the `jenkins/jnlp-slave:alpine` Dockerfile but with `git` installation removed. The Console Output is attached.
Env:
Jenkins 2.138.4
Git plugin 3.9.1
Git Client plugin 2.7.3
Kuberentes plugin 1.12.8
pipeline { agent { kubernetes { cloud 'kubernetes' label 'custom-jnlp-without-git' yaml """ kind: Pod apiVersion: v1 spec: containers: - name: jnlp image: duemir/jenkins-jnlp-agent:alpine-no-git imagePullPolicy: Always args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)'] - name: worker image: jenkins/slave:latest imagePullPolicy: Always tty: true command: - /bin/sh args: - -c - cat """ } } stages { stage('Run') { steps { sh ''' echo This runs on jnlp container git --version || true ''' container('worker') { sh ''' echo This runs on jnlp-slave container git --version || true ''' // This doesn't run on `jnlp-slave` container, it runs on the jnlp container git 'https://github.com/jglick/simple-maven-project-with-tests.git' } } } } }
- duplicates
-
JENKINS-30600 git isn't run inside build container
- Open
- relates to
-
JENKINS-53895 checkout scm over ssh in a pod created by kubernetes plugin fails
- Resolved