Welcome to mirror list, hosted at ThFree Co, Russian Federation.

trigger-build-omnibus « scripts - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dcda70d7ed8955bc7b5197cd3f1c195f6c379bbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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,
  "variables[ee]" => ENV["EE_PACKAGE"] || "false"
}

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']

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