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

            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
            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.
            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.
            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.
            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...
            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: