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

git isn't run inside build container

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Using docker-slaves, the checkout build phase is ran with commands inside the remoting container (which by change has git) not inside the configured build container.

      This is due to git-client to create it's own LocalLauncher vs using the Node's one.

        Attachments

          Issue Links

            Activity

            ndeloof Nicolas De Loof created issue -
            ndeloof Nicolas De Loof made changes -
            Field Original Value New Value
            Remote Link This issue links to "Proposed fix (Web Link)" [ 13159 ]
            rgerard Rusty Gerard made changes -
            Link This issue duplicates JENKINS-21342 [ JENKINS-21342 ]
            Hide
            ndeloof Nicolas De Loof added a comment -

            git-client plugin do not rely on Launcher/FilePath abstraction but sends the whole GitClient implementation class to remote, making it just impossible to rely on a Launcher from caller. Would need to fully refactor GitClient implementation to run on master.

            Show
            ndeloof Nicolas De Loof added a comment - git-client plugin do not rely on Launcher/FilePath abstraction but sends the whole GitClient implementation class to remote, making it just impossible to rely on a Launcher from caller. Would need to fully refactor GitClient implementation to run on master.
            Show
            ndeloof Nicolas De Loof added a comment - see https://github.com/jenkinsci/git-client-plugin/pull/211
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 165712 ] JNJira + In-Review [ 182103 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "git-client PR 219 (Web Link)" [ 15412 ]
            jglick Jesse Glick made changes -
            Component/s docker-slaves-plugin [ 20839 ]
            jglick Jesse Glick made changes -
            Labels docker-slaves
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            jglick Jesse Glick added a comment -

            Affects docker-workflow as well from what I can tell: if Jenkins is configured with only a CLI Git tool (the default), and an agent lacks a Git executable,

            docker.image('cloudbees/java-build-tools').inside {git '…'}
            

            will fail on the git command with an error indicating that the command was not found—because it is being run in the agent’s namespace, not the container’s.

            Show
            jglick Jesse Glick added a comment - Affects docker-workflow as well from what I can tell: if Jenkins is configured with only a CLI Git tool (the default), and an agent lacks a Git executable, docker.image( 'cloudbees/java-build-tools' ).inside {git '…' } will fail on the git command with an error indicating that the command was not found—because it is being run in the agent’s namespace, not the container’s.
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-40217 [ JENKINS-40217 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-54078 [ JENKINS-54078 ]
            batmat Baptiste Mathus made changes -
            Summary git isn't ran inside build container git isn't run inside build container
            ndeloof Nicolas De Loof made changes -
            Assignee Nicolas De Loof [ ndeloof ]
            markewaite Mark Waite made changes -
            Status In Progress [ 3 ] Open [ 1 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-56076 [ JENKINS-56076 ]
            Hide
            jglick Jesse Glick added a comment -

            At least adding a warning in git #811.

            Show
            jglick Jesse Glick added a comment - At least adding a warning in git #811.
            jglick Jesse Glick made changes -
            Remote Link This issue links to "git #811 (Web Link)" [ 24228 ]
            Hide
            markewaite Mark Waite added a comment -

            Warning message released in git plugin 4.1.0, Jan 18, 2020. Does not resolve the bug, but provides a warning about the bug.

            Show
            markewaite Mark Waite added a comment - Warning message released in git plugin 4.1.0, Jan 18, 2020. Does not resolve the bug, but provides a warning about the bug.
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-51542 [ JENKINS-51542 ]
            vladichko Vlad Aginsky made changes -
            Priority Minor [ 4 ] Major [ 3 ]
            Hide
            vladichko Vlad Aginsky added a comment -

            I think it is not a minor issue, since it can be a blocket to use git plugin in q8s enviroment. Raising prio.

            Show
            vladichko Vlad Aginsky added a comment - I think it is not a minor issue, since it can be a blocket to use git plugin in q8s enviroment. Raising prio.
            Hide
            spinus1 Alessio Moscatello added a comment -

            Hello,

            are there any updates with this issue? In my company we're trying to setup Jenkins running on k8s, to launch build in dedicated Docker images...we run into this bug, so I cannot run git (neither tool like repo) in container namespace, but only in the agent one...do you have any workaround for this? It seems that PR on git plugin to fix this issue are not being maintained...

            Thank you,

            Alessio

            Show
            spinus1 Alessio Moscatello added a comment - Hello, are there any updates with this issue? In my company we're trying to setup Jenkins running on k8s, to launch build in dedicated Docker images...we run into this bug, so I cannot run git (neither tool like repo) in container namespace, but only in the agent one...do you have any workaround for this? It seems that PR on git plugin to fix this issue are not being maintained... Thank you, Alessio
            Hide
            markewaite Mark Waite added a comment - - edited

            Alessio Moscatello, I believe that] the withCredentials step and the ssh-agent step can be used to perform the checkout instead of using the checkout scm step. Those give you full control of command line git arguments.

            Show
            markewaite Mark Waite added a comment - - edited Alessio Moscatello , I believe that] the withCredentials step and the ssh-agent step can be used to perform the checkout instead of using the checkout scm step. Those give you full control of command line git arguments.
            Hide
            jglick Jesse Glick added a comment -

            …but you then lose behaviors of checkout scm for multibranch projects (pinning an exact commit, merging with base branch); for non-multibranch projects, you lose the changelog & polling integrations. Pick your poison.

            Also see JENKINS-28335.

            Show
            jglick Jesse Glick added a comment - …but you then lose behaviors of checkout scm for multibranch projects (pinning an exact commit, merging with base branch); for non-multibranch projects, you lose the changelog & polling integrations. Pick your poison. Also see JENKINS-28335 .
            Hide
            spinus1 Alessio Moscatello added a comment -

            Hello Mark Waite, it could work, but I'll loose functionalities like repository polling...

            What if I just checkout code from agent name space? I think it's just a matt
            er of adding repo to JNPL container that is used to run Jenkins agent...

            Show
            spinus1 Alessio Moscatello added a comment - Hello Mark Waite, it could work, but I'll loose functionalities like repository polling... What if I just checkout code from agent name space? I think it's just a matt er of adding repo to JNPL container that is used to run Jenkins agent...
            markewaite Mark Waite made changes -
            Link This issue is related to JENKINS-46230 [ JENKINS-46230 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-53877 [ JENKINS-53877 ]
            Hide
            cvakiitho Tomas Hartmann added a comment -

            This also affects K8N plugin when you use pod+container: 

            podTemplate(cloud: 'kubernetes', containers: [containerTemplate(args: '-c', command: '/bin/bash ', image: 'image with git ca-cert', name: 'base', workingDir: '/home/jenkins')], label: 'base') {
              node('base'){
                container('base')

            {       git credentialsId: 'something', url: '[https://some-ca-cert-git|https://some/].git' }

            }

            Show
            cvakiitho Tomas Hartmann added a comment - This also affects K8N plugin when you use pod+container:  podTemplate(cloud: 'kubernetes', containers: [containerTemplate(args: '-c', command: '/bin/bash ', image: 'image with git ca-cert', name: 'base', workingDir: '/home/jenkins')] , label: 'base') {   node('base'){     container('base') {       git credentialsId: 'something', url: '[https://some-ca-cert-git|https://some/].git' } }
            Hide
            faroguy0 Ian Panzer added a comment -

            Any update on this issue? Encountering it in a k8s environment on AWS.

            Show
            faroguy0 Ian Panzer added a comment - Any update on this issue? Encountering it in a k8s environment on AWS.
            Hide
            markewaite Mark Waite added a comment -

            No change Ian Panzer

            Show
            markewaite Mark Waite added a comment - No change Ian Panzer

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ndeloof Nicolas De Loof
              Votes:
              17 Vote for this issue
              Watchers:
              27 Start watching this issue

                Dates

                Created:
                Updated: