puppetlabs / r10k

Smarter Puppet deployment
Other
800 stars 353 forks source link

(Initial investigation) PR #1161 breaks all controlrepos that use `control_branch` #1173

Closed dylanratcliffe closed 3 years ago

dylanratcliffe commented 3 years ago

As of the current version the R10K::Puppetfile#add_module method does the following which was introduced in #1161 :

    if @default_branch_override != nil
      args[:default_branch_override] = @default_branch_override
    end

This means that all module classes will have the :default_branch_override argument set if the R10K::Puppetfile#load was called with a non-nil default_branch_override. The :default_branch_override option is file for R10K::Module::Git modules but not for `R10K::Module::Forge for example and leats to deployment errors such as:

2021-06-25T14:07:54.515+02:00 INFO  [qtp1153833797-509] [p.c.app] Queuing deploy for production_cdpe_ia_1624622874129
2021-06-25T14:07:54.530+02:00 INFO  [deploy-pool-1] [p.c.core] Attempting to deploy :environment 'production_cdpe_ia_1624622874129'...
2021-06-25T14:07:55.225+02:00 ERROR [deploy-pool-1] [p.c.core] Errors while deploying environment 'production_cdpe_ia_1624622874129' (exit code: 1):
/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/rugged-0.27.7/lib/rugged/repository.rb:258: warning: Using the last argument as keyword parameters is deprecated
ERROR    -> Failed to evaluate /etc/puppetlabs/code-staging/environments/production_cdpe_ia_1624622874129/Puppetfile
Original exception:
R10K::Module::Forge cannot handle option 'default_branch_override'
2021-06-25T14:07:55.406+02:00 INFO  [deploy-pool-1] [p.c.core] Finished deploy attempt for :environment 'production_cdpe_ia_1624622874129'.

Steps to Reproduce

I won't have time to do a replication case but I suspect any Puppetfile that contains something like this will cause it:

mod 'puppetlabs/sqlserver',                   :latest

mod 'someone/something',
    git: 'git@somewhere.com/whatever',
    branch: :control_branch,
    default_branch: 'main'

Environment

PE 2021.2.0

Additional Context

This is in a released version of PE and will affect a great many customers. Let's get onto this ASAP

Magisus commented 3 years ago

Thanks Dylan, we're taking a look!

Magisus commented 3 years ago

The fix for this has been merged and released as 3.9.3.