2017-05-09 05:49:48 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'net/http'
|
|
|
|
require 'json'
|
|
|
|
|
|
|
|
uri = URI('https://gitlab.com/api/v4/projects/20699/trigger/pipeline')
|
|
|
|
params = {
|
2017-05-09 09:21:32 -04:00
|
|
|
"ref" => ENV["OMNIBUS_BRANCH"] || "master",
|
|
|
|
"token" => ENV["BUILD_TRIGGER_TOKEN"],
|
|
|
|
"variables[GITLAB_VERSION]" => ENV["CI_COMMIT_SHA"],
|
2017-05-25 07:31:15 -04:00
|
|
|
"variables[ALTERNATIVE_SOURCES]" => true,
|
2017-06-09 07:07:50 -04:00
|
|
|
"variables[ee]" => ENV["EE_PACKAGE"] || "false"
|
2017-05-09 05:49:48 -04:00
|
|
|
}
|
2017-05-09 09:21:32 -04:00
|
|
|
|
2017-05-09 05:49:48 -04:00
|
|
|
Dir.glob("*_VERSION").each do |version_file|
|
|
|
|
params["variables[#{version_file}]"] = File.read(version_file).strip
|
|
|
|
end
|
2017-05-09 09:21:32 -04:00
|
|
|
|
2017-05-09 05:49:48 -04:00
|
|
|
res = Net::HTTP.post_form(uri, params)
|
|
|
|
pipeline_id = JSON.parse(res.body)['id']
|
2017-05-09 09:21:32 -04:00
|
|
|
|
2017-06-09 07:07:50 -04:00
|
|
|
unless pipeline_id.nil?
|
|
|
|
puts "Triggered pipeline can be found at https://gitlab.com/gitlab-org/omnibus-gitlab/pipelines/#{pipeline_id}"
|
|
|
|
else
|
|
|
|
puts "Trigger failed. The response from trigger is: "
|
|
|
|
puts res.body
|
|
|
|
end
|