summaryrefslogtreecommitdiff
path: root/scripts/trigger-build
diff options
context:
space:
mode:
authorBalasankar C <balasankar@gitlab.com>2017-05-09 15:19:48 +0530
committerBalasankar C <balasankar@gitlab.com>2017-05-09 15:42:42 +0530
commite85aa42428e2ab77ed74317b481351197e34e1e3 (patch)
tree1720c5c26aa92571864b983dbdbb96eda0623076 /scripts/trigger-build
parentc44680d1b8e0d14ab46f5785c508b286ee9271b8 (diff)
downloadgitlab-ce-e85aa42428e2ab77ed74317b481351197e34e1e3.tar.gz
Move triggering build logic to separate script
Diffstat (limited to 'scripts/trigger-build')
-rwxr-xr-xscripts/trigger-build18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/trigger-build b/scripts/trigger-build
new file mode 100755
index 00000000000..ccdb01c96ca
--- /dev/null
+++ b/scripts/trigger-build
@@ -0,0 +1,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}"