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

Git Client plugin's CLI implementation does not interoperate with Kubernetes plugin

    Details

    • Similar Issues:

      Description

      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'
              }
            }
          }
        }
      }
       

       

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          Possibly related to the pull request from Nicolas De Loof to fix the execution location or remoting location of portions of the git plugin or git client plugin?

          I don't plan to work on this anytime soon since my focus is on the BuildData bloat fix and the JGit improvements in git plugin 4.0.0 and git client 3.0.0. Pull requests will be happily considered with tests to duplicate the problem and an implementation to fix the tests and solve the bug.

          Show
          markewaite Mark Waite added a comment - Possibly related to the pull request from Nicolas De Loof to fix the execution location or remoting location of portions of the git plugin or git client plugin? I don't plan to work on this anytime soon since my focus is on the BuildData bloat fix and the JGit improvements in git plugin 4.0.0 and git client 3.0.0. Pull requests will be happily considered with tests to duplicate the problem and an implementation to fix the tests and solve the bug.
          Hide
          ndeloof Nicolas De Loof added a comment -

          issue known for a long time (already reported on docker-slaves-plugin)

          see https://github.com/jenkinsci/git-client-plugin/pull/219

           

           

          Show
          ndeloof Nicolas De Loof added a comment - issue known for a long time (already reported on docker-slaves-plugin) see https://github.com/jenkinsci/git-client-plugin/pull/219    

            People

            • Assignee:
              Unassigned
              Reporter:
              duemir Denys Digtiar
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: