voxpupuli / onceover

Your gateway drug to automated infrastructure testing with Puppet
141 stars 45 forks source link

R10k config doesn't seem to be reliably honoured #185

Open dylanratcliffe opened 5 years ago

dylanratcliffe commented 5 years ago

As shown in #166 r10k doesn't seem to be accepting credential settings or forge url settings from its config file. Need to work out why this is happening and either:

  1. Document the correct location for the config file
  2. Integrate the config into oneover.yaml

The easiest way to repro this would be to change the forge.baseurl to something incorrect and write a test expecting 404s

GeoffWilliams commented 5 years ago

To get r10k working with external forge, you need an r10k.yaml that looks something like this:

sources:
  puppet: {remote: 'https://github.com/GeoffWilliams/r10k-control', basedir: /etc/puppetlabs/code-staging/environments,
    invalid_branches: error}
cachedir: /opt/puppetlabs/server/data/code-manager/git
forge: {baseurl: 'https://repo.megacorp.com/artifactory/api/puppet/puppet'}
git:
  repositories: []
  provider: rugged
deploy:
  purge_levels: [deployment, environment, puppetfile]
  purge_whitelist: [.resource_types]

You also need an external forge - only Artifactory or Unibet will work (see http://www.declarativesystems.com/blog/private_puppet_forge).

For git, the R10K config file settings for username, private_key, etc only work if you set:

git:
  provider: rugged

And you have the rugged gem in your bundle. It seems hard to install on Windows, I gave up and used shellgit, in which case you would need a ~/.ssh/config file to set things like the username and keyfile location (note changed parameter names). On windows this directory would be under \users\yourusername.

The file has contents along the lines:

Host ghe.megacorp.com
    HostName ghe.megacorp.com
    Port 22000
    User gerald
    IdentityFile ~/.ssh/ghe_megacorp.com

HTH

eleanorcuallado commented 4 years ago

I am running into issues using an external forge to get the packages. As said, I created a r10k.yaml file at the root of the git project, containing the following content:

sources:
  forge: {baseurl: 'https://forge.url.tld'}

However, when I try to download, it tells me that The module release ns-modulename-x.x.x does not exist on https://forceapi.puppetlabs.com/. . It is present on my forge, and the forge is accessible. The forge used is the Unibet one. I looked in the code of the master branch, and the r10k_config function itself is defined but not used. I am not very proefficient in ruby so I may be missing something, but where specifically is the r10k.yaml configuration given to r10k to be used?

cdenneen commented 4 years ago

@dylanratcliffe From what I can tell adding to the base of the project a r10k.yaml does work but the syntax is off.

What works is:

forge: {baseurl: 'https://forge.url.tld'}

Based on the following documentation what should work doesn't: https://github.com/puppetlabs/r10k/blob/master/doc/dynamic-environments/configuration.mkd

forge:
  baseurl: 'https://forge.url.tld'