forked from sous-chefs/nginx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CircleCI testing for ChefDK & parallel
Using ChefDK to maintain the dependency chain. Parallelize kitchen testing across multiple CircleCI workers. Skip testing Debian via Docker until we sort out the service runner.
- Loading branch information
1 parent
d0c7c2c
commit a921767
Showing
4 changed files
with
54 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'kitchen/rake_tasks' | ||
|
||
desc 'Run Kitchen tests using CircleCI parallelism mode, split by platform' | ||
task :circle do | ||
# Load environment-defined config | ||
def kitchen_loader | ||
Kitchen::Loader::YAML.new(local_config: ENV['KITCHEN_LOCAL_YAML']) | ||
end | ||
|
||
def kitchen_config | ||
Kitchen::Config.new(loader: kitchen_loader) | ||
end | ||
|
||
def total_workers | ||
ENV['CIRCLE_NODE_TOTAL'].to_i | ||
end | ||
|
||
def current_worker | ||
ENV['CIRCLE_NODE_INDEX'].to_i | ||
end | ||
|
||
def command | ||
commands = [] | ||
|
||
kitchen_config.platforms.sort_by(&:name).each_with_index do |platform, index| | ||
next unless index % total_workers == current_worker | ||
# Escape the platform name to somehting the CLI will understand. | ||
# TODO: This could likely be pulled from kitchen_config.instances somehow | ||
name = platform.name.delete('.') | ||
|
||
commands.push "kitchen verify #{name}" | ||
end | ||
|
||
commands.join(' && ') | ||
end | ||
|
||
sh command unless command.empty? | ||
end |