Commit 79dcf015 authored by DJ Mountney's avatar DJ Mountney
Browse files

Merge branch 'rubocop-lib' into 'master'

Make support scripts rubocop friendly

See merge request !1568
parents bbcfa58d dff1e6f0
......@@ -6,5 +6,5 @@ Knapsack.load_tasks
 
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |t|
t.options = ['-D', 'config', 'lib', 'spec', 'files/gitlab-ctl-commands', 'files/gitlab-cookbooks/gitlab-ee', 'files/gitlab-cookbooks/runit']
t.options = ['-D', 'config', 'lib', 'spec', 'support', 'files/gitlab-ctl-commands', 'files/gitlab-cookbooks/gitlab-ee', 'files/gitlab-cookbooks/runit']
end
......@@ -10,11 +10,11 @@ require 'yaml'
 
module GitlabYamlConverter
class Flattener
def initialize(separator='_')
def initialize(separator = '_')
@separator = separator
end
 
def flatten(hash, prefix=nil)
def flatten(hash, prefix = nil)
Enumerator.new do |yielder|
hash.each do |key, value|
raise "Bad key: #{key.inspect}" unless key.is_a?(String)
......@@ -39,6 +39,4 @@ module GitlabYamlConverter
end
end
 
if $0 == __FILE__
GitlabYamlConverter.convert(YAML.load(ARGF.read))
end
GitlabYamlConverter.convert(YAML.safe_load(ARGF.read)) if $PROGRAM_NAME == __FILE__
......@@ -11,7 +11,8 @@ Dir.glob(path + "/*_main_rspec_report.json").each do |main_report_file|
new_report = main_report.dup
main_file_name = File.basename(main_report_file)
match = main_file_name.match(/(?<DISTRO_NAME>.*?)_(?<DISTRO_VERSION>.*?)_.*/)
os,version = match['DISTRO_NAME'], match['DISTRO_VERSION']
os = match['DISTRO_NAME']
version = match['DISTRO_VERSION']
puts "#{os} #{version}"
Dir.glob(path + "/#{os}_#{version}_rspec_node_*").each do |report_file|
report = JSON.parse(File.read(report_file))
......@@ -27,5 +28,4 @@ Dir.glob(path + "/*_main_rspec_report.json").each do |main_report_file|
 
File.write(main_report_file, JSON.pretty_generate(new_report))
puts "\tSaved #{main_report_file}."
end
......@@ -51,7 +51,7 @@ def repo_string
end
end
 
if os == :unknown or version == :unknown
if (os == :unknown) || (version == :unknown)
abort "Unsupported OS: #{ohai.values_at('platform', 'platform_version').inspect}"
end
 
......@@ -83,5 +83,5 @@ when 'platform-dir'
when 'repo-string'
repo_string
else
abort "Usage: #{$0} platform-dir|repo-string"
abort "Usage: #{$PROGRAM_NAME} platform-dir|repo-string"
end
......@@ -2,13 +2,12 @@
require 'net/http'
require 'json'
 
uri=URI("https://gitlab.com/api/v4/projects/#{ENV['CI_PROJECT_ID']}/pipelines/#{ENV['CI_PIPELINE_ID']}/jobs")
uri = URI("https://gitlab.com/api/v4/projects/#{ENV['CI_PROJECT_ID']}/pipelines/#{ENV['CI_PIPELINE_ID']}/jobs")
req = Net::HTTP::Get.new(uri)
req['PRIVATE-TOKEN'] = ENV["TRIGGER_PRIVATE_TOKEN"]
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl=true
http.use_ssl = true
res = http.request(req)
output = JSON.parse(res.body)
id = output.find {|job| job['name'] == 'Trigger:package'}['id']
id = output.find { |job| job['name'] == 'Trigger:package' }['id']
puts "#{ENV['CI_PROJECT_URL']}/builds/#{id}/artifacts/file/pkg/ubuntu-16.04/gitlab.deb"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment