Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FACT-1281) Allow host configs to be generated at runtime #1243

Conversation

joshcooper
Copy link
Contributor

This commit adds a dependency on beaker-hostgenerator in the acceptance
Gemfile, which may be overridden using the
BEAKER_HOSTGENERATOR_VERSION environment variable.

The acceptance Rakefile will continue to use the CONFIG environment
variable, which points to an existing host config file.

If PLATFORMS is specified, it will override CONFIG, and the Rakefile
will use beaker-hostgenerator to dynamically generate a host config. The
host config is generated in the facter/acceptance/tmp directory, as
opposed to /tmp so that it doesn't conflict with concurrent acceptance
tests running on the same CI coordinator. It also appends SecureRandom
to the hostfile, because it seems like a good idea. The resulting host
config is copied to the log/latest/config.yml.

For example, to run against a tagged build:

$ bundle exec rake ci:test:aio PLATFORMS=redhat7-64a SHA=1.3.2

To run against a non-tagged commit:

$ bundle exec rake ci:test:aio PLATFORMS=redhat7-64a \
  SHA=<full sha> SUITE_VERSION=<git describe>

This commit doesn't remove the static host configs as CI jobs need to be
updated first.

@MikaelSmith
Copy link

When I try to run this on top of stable, I get

$ be rake ci:test:aio PLATFORMS=redhat7-64a SHA=1.3.2
./config/aio/options.rb
./local_options.rb
No options file found at /Users/michaelsmith/puppetlabs/facter/acceptance/local_options.rb
rake aborted!
No such file or directory @ rb_sysopen - tmp/redhat7-64a-11a3512c-19bb-4be6-9419-3bb0544cacfd.yaml
/Users/michaelsmith/puppetlabs/facter/acceptance/Rakefile:99:in `initialize'
/Users/michaelsmith/puppetlabs/facter/acceptance/Rakefile:99:in `open'
/Users/michaelsmith/puppetlabs/facter/acceptance/Rakefile:99:in `beaker_test'
/Users/michaelsmith/puppetlabs/facter/acceptance/Rakefile:279:in `block (3 levels) in <top (required)>'
Tasks: TOP => ci:test:aio
(See full trace by running task with --trace)

if platforms
cli = BeakerHostGenerator::CLI.new([platforms, '--disable-default-role'])
ENV['CONFIG'] = "tmp/#{platforms}-#{SecureRandom.uuid}.yaml"
File.open(config, 'w') do |fh|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this config variable come from? Well that's not the problem.

This Rakefile assumes the presence of acceptance/tmp. Adding Dir.mkdir('tmp') seems to work as an option.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Down below there's

def config
   ENV['CONFIG']
end

@joshcooper
Copy link
Contributor Author

I'm going to close this PR while we work on getting ci-job-configs and hiera figured out.

@joshcooper joshcooper closed this Dec 23, 2015
@joshcooper joshcooper reopened this Dec 23, 2015
@joshcooper joshcooper force-pushed the ticket/stable/FACT-1281-use-beaker-hg branch from ed85c88 to e9b279e Compare December 23, 2015 22:17
@joshcooper
Copy link
Contributor Author

Verified using:

$ bundle exec rake ci:test:aio CONFIG=config/nodes/redhat-7-x86_64.yaml SHA=1de06f72f13b56652694c62e732e14a4dc201148 SUITE_VERSION=1.3.2.147.g1de06f7
...
$ bundle exec rake ci:test:aio TEST_TARGET=debian8-64a SHA=1de06f72f13b56652694c62e732e14a4dc201148 SUITE_VERSION=1.3.2.147.g1de06f7
...
uu751l36lg10qvj.delivery.puppetlabs.net (debian8-64-1) executed in 0.35 seconds...
...
$ bundle exec rake ci:test:aio CONFIG=config/nodes/redhat-7-x86_64.yaml TEST_TARGET=debian8-64a SHA=1de06f72f13b56652694c62e732e14a4dc201148 SUITE_VERSION=1.3.2.147.g1de06f7
...
uu751l36lg10qvj.delivery.puppetlabs.net (debian8-64-1) executed in 0.05 seconds
...

@MikaelSmith
Copy link

Did you start with a tmp directory? It's not part of the repo.

@joshcooper
Copy link
Contributor Author

Ah that must be it. It's in the .gitignore list so didn't realize it was generated during the build.

This commit adds a dependency on beaker-hostgenerator in the
acceptance Gemfile, which may be overridden using the
`BEAKER_HOSTGENERATOR_VERSION` environment variable.

The acceptance Rakefile will continue to use the `CONFIG` environment
variable, which must point to an existing host config file.

If `TEST_TARGET` is specified, it will override `CONFIG`, and the Rakefile
will use beaker-hostgenerator to dynamically generate a host config. The
host config is generated in the `acceptance/tmp` directory, as
opposed to `/tmp` so that it doesn't conflict with concurrent acceptance
tests running on the same CI coordinator. It also appends SecureRandom
to the hostfile, because it seems like a good idea. The resulting host
config is copied to the `log/latest/config.yml`.

For example, to run against a tagged build:

    $ bundle exec rake ci:test:aio TEST_TARGET=redhat7-64a SHA=1.3.2

To run against a non-tagged commit:

    $ bundle exec rake ci:test:aio TEST_TARGET=redhat7-64a \
      SHA=<full sha> SUITE_VERSION=<git describe>

This commit doesn't remove the static host configs as CI jobs need
to be updated first.
@joshcooper joshcooper force-pushed the ticket/stable/FACT-1281-use-beaker-hg branch from e9b279e to f1608d9 Compare December 23, 2015 22:33
@waynr
Copy link

waynr commented Dec 23, 2015

👍 looks good to me

@MikaelSmith
Copy link

Hiera failed, hold off until that's fixed.

@kylog
Copy link

kylog commented Dec 28, 2015

Superceded by #1244, which adds the one-line, temporary workaround discussed in HipChat.

@kylog kylog closed this Dec 28, 2015
@joshcooper joshcooper deleted the ticket/stable/FACT-1281-use-beaker-hg branch March 3, 2023 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants