Sha256: 7da13eebf32858bafe6203c23a4a28a18dc955e4896423718742edf26251afbf

Contents?: true

Size: 1.23 KB

Versions: 23

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'yaml'
require 'fileutils'
require 'English'
@threads = {}

def run_container(image, puppet_version)
  pversion = puppet_version.match(/([\d\.]+)/)[0]
  ruby_version = image.split(':').last
  dir = File.join('.', 'local_test_results', pversion, ruby_version)
  real_dir = File.expand_path(dir)
  FileUtils.rm_rf(real_dir)
  FileUtils.mkdir_p(real_dir)
  cmd = "docker run -e OUT_DIR='#{dir}' -e RUBY_VERSION='#{ruby_version}' -e PUPPET_GEM_VERSION='#{puppet_version}' --rm -ti -v ${PWD}:/module --workdir /module #{image} /bin/bash run_container_test.sh"
  File.write(File.join(real_dir, 'command.txt'), cmd)
  output = `#{cmd}`
  if $CHILD_STATUS.success?
    File.write(File.join(dir, 'success.txt'), output)
  else
    File.write(File.join(dir, 'error.txt'), output)
  end
end

def ci_data
  @ci_data ||= YAML.load_file(File.expand_path('.gitlab-ci.yml'))
end

def matrix
  unless @matrix
    @matrix = {}
    ci_data.each do |id, data|
      @matrix[id] = data if id =~ /^puppet/
    end
  end
  @matrix
end

matrix.each do |id, item|
  @threads[id] = Thread.new do
    run_container(item['image'], item['variables']['PUPPET_GEM_VERSION'])
  end
end

@threads.each { |_id, thr| thr.join } # wait on thread to finish

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
puppet-debugger-0.19.0 test_matrix.rb
puppet-debugger-0.18.0 test_matrix.rb
puppet-debugger-0.17.0 test_matrix.rb
puppet-debugger-0.16.0 test_matrix.rb
puppet-debugger-0.15.2 test_matrix.rb
puppet-debugger-0.15.1 test_matrix.rb
puppet-debugger-0.15.0 test_matrix.rb
puppet-debugger-0.14.0 test_matrix.rb
puppet-debugger-0.13.0 test_matrix.rb
puppet-debugger-0.12.3 test_matrix.rb
puppet-debugger-0.12.2 test_matrix.rb
puppet-debugger-0.12.1 test_matrix.rb
puppet-debugger-0.12.0 test_matrix.rb
puppet-debugger-0.11.0 test_matrix.rb
puppet-debugger-0.10.3 test_matrix.rb
puppet-debugger-0.10.2 test_matrix.rb
puppet-debugger-0.10.1 test_matrix.rb
puppet-debugger-0.10.0 test_matrix.rb
puppet-debugger-0.9.1 test_matrix.rb
puppet-debugger-0.9.0 test_matrix.rb