Hi all https://github.com/amarula/git-collect-plugin/tree/main
I think that now, it is better to collect offline commits and use the plugin on my shared library. Michael On Fri, Dec 5, 2025 at 8:28 AM Michael Nazzareno Trimarchi <[email protected]> wrote: > > Hi all > > On Sun, Jan 12, 2025 at 4:35 PM Michael Nazzareno Trimarchi > <[email protected]> wrote: > > > > Hi James > > > > On Sun, Jan 12, 2025 at 4:29 PM James Nord <[email protected]> wrote: > > > > > > I Michael, > > > > > > if the reason you are needing to clone / checkout via sh is due to > > > passing some flags like ` --filter=tree:0` then I thought you would be > > > able to implement that by extending > > > https://javadoc.jenkins.io/plugin/git/jenkins/plugins/git/traits/CloneOptionTrait.html > > > and creating a special trait for it ( e.g. a TreeLessCloneTrait) and get > > > Jenkins to do the checkout at least with the cli base git implementation > > > and add ind some extra flags to the CLI arg.. > > > > > > However it appears I am mistaken and this would actually need new methods > > > / support in `CloneOption` (and possible `FetchOption`) and the support > > > to be in the git plugin and the git client plugin. > > > > > > So let's flip this around, what functionality is missing that prevents > > > you from cloning / fetching from Jenkins as opposed to from the cli via > > > an sh step, is it just the treeless clone? > > > > > > > Not really, I'm thinking that in general it would be nice to be able > > to create a gitscm object from an already checkout object from git > > tool. Some examples come with kas that are used to checkout projects > > using git tool (https://github.com/siemens/kas), but then if I have a > > way to generate objects on top of checkout coming from a third party > > tool would be nice. No TreeLessClone Traits can be added and so on > > > > Moving most of the implementation using gitscm to collect data object > but I found a new restriction: > > 18:40:53 Warning: A secret was passed to "checkout" using Groovy > String interpolation, which is insecure. 18:40:53 Affected argument(s) > used the following variable(s): [GERRIT_RESTAPI_USER] 18:40:53 See > https://jenkins.io/redirect/groovy-string-interpolation for details. > 18:40:53 The recommended git tool is: NONE 18:40:54 No credentials > specified 18:40:54 Warning: JENKINS-30600: special launcher > > Now, my checkout are not using credentials passed using the > credentialsid in gitscm but using ssh-agent, the reason is that > I need more then one credentials when I need to deal with a project > that can potentially download other git projects in order > to build an entire OS. I think that here the commands are not > executed inside the container but outside and the ssh agent is running > inside it. Is this correct? > > Is it really needed to check out things outside the docker container > with gitscm? Can I just run the gitscm command inside the docker > launcher instance? > > Michael > > > > > Michael > > > > > Regards > > > > > > /James > > > > > > On Sun, 12 Jan 2025 at 10:14, Michael Nazzareno Trimarchi > > > <[email protected]> wrote: > > >> > > >> Hi James > > >> > > >> On Sun, Jan 12, 2025 at 10:47 AM James Nord <[email protected]> wrote: > > >> > > > >> > Take a little ok at the clone and checkout traits > > >> > https://javadoc.jenkins.io/plugin/git/jenkins/plugins/git/traits/package-summary.html > > >> > > > >> > It would appear that you should be able to do this with a new trait. > > >> > > > >> > > >> I miss here a bit. It should be help to extend some clone or checkout > > >> option? Like --filter=tree:0 > > >> > > >> Michael > > >> > > >> > Regards > > >> > > > >> > /James > > >> > On Saturday, 11 January 2025 at 14:52:31 UTC > > >> > [email protected] wrote: > > >> >> > > >> >> Hi Mark > > >> >> > > >> >> On Sat, Jan 11, 2025 at 3:16 PM Mark Waite <[email protected]> > > >> >> wrote: > > >> >> > > > >> >> > > > >> >> > > > >> >> > On Saturday, January 11, 2025 at 4:22:58 AM UTC-7 Michael wrote: > > >> >> > > > >> >> > Hi all > > >> >> > > > >> >> > Is it possible to use git clone from sh context but then populate > > >> >> > as I > > >> >> > had clone using gitscm? > > >> >> > > > >> >> > > > >> >> > Not really. Maybe you could approximate it by calling checkout scm > > >> >> > with parameters that try to duplicate your git clone parameters and > > >> >> > use the return value from checkout scm. > > >> >> > > > >> >> > > >> >> Right now what I'm trying to do is something like this and change > > >> >> groovy library > > >> >> > > >> >> - def git_opts = history ? '--filter=tree:0' : '--depth 1' > > >> >> + def depth = history ? 0 : 1 > > >> >> def updateRepository = { > > >> >> - if (context.fileExists(directory)) { > > >> >> - context.dir(directory) { > > >> >> - context.sh """ > > >> >> - git remote remove origin > > >> >> - git remote add origin ${url} > > >> >> - git remote set-branches --add origin ${branch} > > >> >> - git fetch origin ${branch} ${git_opts} > > >> >> - git reset --hard FETCH_HEAD > > >> >> - """ > > >> >> - } > > >> >> - } else { > > >> >> - context.sh "git clone ${git_opts} --branch ${branch} > > >> >> ${url} ${directory}" > > >> >> - } > > >> >> + context.checkout( > > >> >> + changelog: true, > > >> >> + poll: false, > > >> >> + scm: [ > > >> >> + $class: 'GitSCM', > > >> >> + branches: [[name: "*/${branch}"]], > > >> >> + extensions: [ > > >> >> + [$class: 'cleanAfterCheckout', > > >> >> deleteUntrackedNestedRepositories: true], > > >> >> + [$class: 'RelativeTargetDirectory', > > >> >> relativeTargetDir: "${directory}"], > > >> >> + [$class: 'CloneOption', depth: "${depth}", > > >> >> honorRefspec: true, noTags: false, \ > > >> >> + reference: "${directory}", shallow: > > >> >> depth > 0 ? true : false > > >> >> + ] > > >> >> + ], > > >> >> + userRemoteConfigs: [ > > >> >> + [credentialsId: "${credentials}", url: "${url}"] > > >> >> + ] > > >> >> + ] > > >> >> + ) > > >> >> } > > >> >> > > >> >> > > >> >> This is not exactly the same (by the way needs to be tested) but using > > >> >> gitscm I have a lot more features. Would be nice to allow > > >> >> gitscm to re-evaluate some already checkout or already .git on > > >> >> filesystem to calculate the data. Looking at several plugins does not > > >> >> sound very easy. The reason that I'm moving to using gitscm is to > > >> >> integrate plugins like git-forensic etc. I have found gitSCM really > > >> >> nice > > >> >> but could be a bit limited if you are trying to have more git > > >> >> flexibility. Like in this case I can not use --filter=tree:0' > > >> >> > > >> >> Michael > > >> >> > > >> >> > > >> >> > Mark Waite > > >> >> > > > >> >> > -- > > >> >> > You received this message because you are subscribed to the Google > > >> >> > Groups "Jenkins Developers" group. > > >> >> > To unsubscribe from this group and stop receiving emails from it, > > >> >> > send an email to [email protected]. > > >> >> > To view this discussion visit > > >> >> > https://groups.google.com/d/msgid/jenkinsci-dev/ea47d6bd-097f-41b2-a223-ae42d1277853n%40googlegroups.com. > > >> >> > > >> >> > > >> >> > > >> >> -- > > >> >> Michael Nazzareno Trimarchi > > >> >> Co-Founder & Chief Executive Officer > > >> >> M. +39 347 913 2170 > > >> >> [email protected] > > >> >> __________________________________ > > >> >> > > >> >> Amarula Solutions BV > > >> >> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > > >> >> T. +31 (0)85 111 9172 > > >> >> [email protected] > > >> >> www.amarulasolutions.com > > >> > > > >> > -- > > >> > You received this message because you are subscribed to the Google > > >> > Groups "Jenkins Developers" group. > > >> > To unsubscribe from this group and stop receiving emails from it, send > > >> > an email to [email protected]. > > >> > To view this discussion visit > > >> > https://groups.google.com/d/msgid/jenkinsci-dev/4fb0794a-e327-42f8-864f-886bf1ab3f97n%40googlegroups.com. > > >> > > >> > > >> > > >> -- > > >> Michael Nazzareno Trimarchi > > >> Co-Founder & Chief Executive Officer > > >> M. +39 347 913 2170 > > >> [email protected] > > >> __________________________________ > > >> > > >> Amarula Solutions BV > > >> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > > >> T. +31 (0)85 111 9172 > > >> [email protected] > > >> www.amarulasolutions.com > > >> > > >> -- > > >> You received this message because you are subscribed to the Google > > >> Groups "Jenkins Developers" group. > > >> To unsubscribe from this group and stop receiving emails from it, send > > >> an email to [email protected]. > > >> To view this discussion visit > > >> https://groups.google.com/d/msgid/jenkinsci-dev/CAOf5uwnzjQgGtDfJTCrh0Y6BHYPJC2CskqhUCFOL0345UNYcjQ%40mail.gmail.com. > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Jenkins Developers" group. > > > To unsubscribe from this group and stop receiving emails from it, send an > > > email to [email protected]. > > > To view this discussion visit > > > https://groups.google.com/d/msgid/jenkinsci-dev/CAPzq3pc_ks-G9256g397Xawx2Q5GNMWEDw%2BCSdkMiAR6kosbmQ%40mail.gmail.com. > > > > > > > > -- > > Michael Nazzareno Trimarchi > > Co-Founder & Chief Executive Officer > > M. +39 347 913 2170 > > [email protected] > > __________________________________ > > > > Amarula Solutions BV > > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > > T. +31 (0)85 111 9172 > > [email protected] > > www.amarulasolutions.com > > > > -- > Michael Nazzareno Trimarchi > Co-Founder & Chief Executive Officer > M. +39 347 913 2170 > [email protected] > __________________________________ > > Amarula Solutions BV > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > T. +31 (0)85 111 9172 > [email protected] > www.amarulasolutions.com -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jenkinsci-dev/CAOf5uw%3Dz0BuA%3D0hYA1ONSEdpAwAyCXWgjsf4ZqgdEFvC_tpNMw%40mail.gmail.com.
