diff options
Diffstat (limited to 'scripts/trigger-build')
-rwxr-xr-x | scripts/trigger-build | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/trigger-build b/scripts/trigger-build new file mode 100755 index 00000000000..741e6361f01 --- /dev/null +++ b/scripts/trigger-build @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +require 'net/http' +require 'json' + +uri = URI('https://gitlab.com/api/v4/projects/20699/trigger/pipeline') +params = { + "ref" => ENV["OMNIBUS_BRANCH"] || "master", + "token" => ENV["BUILD_TRIGGER_TOKEN"], + "variables[GITLAB_VERSION]" => ENV["CI_COMMIT_SHA"], + "variables[ALTERNATIVE_SOURCES]" => true, +} + +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}" |