Closed xorpaul closed 3 years ago
Would this example from the main page cover this issue?
try multiple Git branches for a Puppet module until one can be used
mod 'stdlib', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :fallback => '4.889.x|foobar|master'
Obviously you'd do :fallback =>'master|main' (or just main if you're not using the link stuff and dealing with this on a branch)
Sure that would work, but then you still would have to modify each git module, which doesn't have a reference configured.
I'm currently looking into auto-detecting the correct HEAD branch
for the each git repository.
Something like this:
/tmp/test/puppetlabs-vcsrepo.git(BARE:main) $ git --git-dir . remote show origin | grep "HEAD branch" | cut -d ":" -f 2
main
git --git-dir . remote show origin
queries the remotes/Git server for the tracked branches and thus can slow down the g10k run with many git modules significantly and is not really necessary, because g10k did just update all git repositories before its trying to auto-detect the default branch.
git --git-dir . symbolic-ref HEAD
only reports the default branch of the currently checked out repository, which doesn't update if this default branches was changed. So this is not usable for g10k with older caches of the Puppetlabs modules.
This leaves me with:
git ls-remote --symref .
which also seems to be sufficiently fast enough:
$ time git ls-remote --symref /var/cache/g10k/modules/https-__github.com_puppetlabs_puppetlabs-vcsrepo.git | head -2
7e08de9823a54670493dc5afbf38bbfe179fd430 refs/heads/main
efcd9bfeedc41d76de622a884d5317b8e6a05dff refs/heads/maint/main/release_checks_7_config
real 0m0.026s
user 0m0.012s
sys 0m0.008s
Check out https://github.com/xorpaul/g10k/releases/tag/v0.8.15
I suspect that you were using -puppetfile
, which did not set the correct cache directories:
https://github.com/xorpaul/g10k/blob/master/g10k.go#L313-L314
and then failed to detect that it is not a control repository here: https://github.com/xorpaul/g10k/blob/master/git.go#L104-L107
puppetlabs/concat for example switched from
master
tomain
as the default branch:https://github.com/puppetlabs/puppetlabs-concat
This means that the following Puppetfile entry now fails with g10k: