Commit 2aa084a4 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'improve-trigger-build-output' into 'master'

Increase verbosity of triggered build

Closes omnibus-gitlab#2318

See merge request !11188
parents f59a44db 784941ee
...@@ -141,6 +141,7 @@ stages: ...@@ -141,6 +141,7 @@ stages:
# Trigger a package build on omnibus-gitlab repository # Trigger a package build on omnibus-gitlab repository
build-package: build-package:
before_script: []
services: [] services: []
variables: variables:
SETUP_DB: "false" SETUP_DB: "false"
...@@ -148,17 +149,7 @@ build-package: ...@@ -148,17 +149,7 @@ build-package:
stage: build stage: build
when: manual when: manual
script: script:
# If no branch in omnibus is specified, trigger pipeline against master - scripts/trigger-build
- if [ -z "$OMNIBUS_BRANCH" ] ; then export OMNIBUS_BRANCH=master ;fi
- echo "token=${BUILD_TRIGGER_TOKEN}" > version_details
- echo "ref=${OMNIBUS_BRANCH}" >> version_details
- echo "variables[ALTERNATIVE_SOURCES]=true" >> version_details
- echo "variables[GITLAB_VERSION]=${CI_COMMIT_SHA}" >> version_details
# Collect version details of all components
- for f in *_VERSION; do echo "variables[$f]=$(cat $f)" >> version_details; done
# Trigger the API and pass values collected above as parameters to it
- cat version_details | tr '\n' '&' | curl -X POST https://gitlab.com/api/v4/projects/20699/trigger/pipeline --data-binary @-
- rm version_details
# Prepare and merge knapsack tests # Prepare and merge knapsack tests
knapsack: knapsack:
......
#!/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}"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment