summaryrefslogtreecommitdiff
path: root/scripts/trigger-build
blob: ccdb01c96ca36f3cfce72a06426f27493ce72636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby

require 'net/http'
require 'json'

uri = URI('https://gitlab.com/api/v4/projects/20699/trigger/pipeline')
params = {
  "token" => ENV['BUILD_TRIGGER_TOKEN'],
  "variables[GITLAB_VERSION]" => ENV['CI_COMMIT_SHA'],
  "variables[ALTERNATIVE_SOURCES]" => true,
}
params['ref'] = ENV['OMNIBUS_BRANCH'] || "master"
Dir.glob("*_VERSION").each do |version_file|
  params["variables[#{version_file}]"] = File.read(version_file).strip
end
res = Net::HTTP.post_form(uri, params)
pipeline_id = JSON.parse(res.body)['id']
puts "Triggered pipeline can be found at https://gitlab.com/gitlab-org/omnibus-gitlab/pipelines/#{pipeline_id}"