diff --git a/Ottofile b/Ottofile new file mode 100644 index 0000000..037e632 --- /dev/null +++ b/Ottofile @@ -0,0 +1,18 @@ + +pipeline { + steps { + sh 'pwd' + // branch needed until #45 is addressed + git url: 'https://git.brokenco.de/rtyler/otto', branch: 'main', into: '.' + } + + stage { + name = 'Build' + steps { + sh 'cargo test' + } + } +} + + +// vim: sw=2 et ts=2 ft=groovy diff --git a/scripts/local-run b/scripts/local-run new file mode 100755 index 0000000..38bd015 --- /dev/null +++ b/scripts/local-run @@ -0,0 +1,41 @@ +#!/usr/bin/env ruby + +require 'json' +require 'net/http' + +pipeline = nil + +# Parse it +Net::HTTP.start('localhost', 7672) do |http| + otto = File.read('Ottofile') + response = http.post('/v1/parse', otto) + + if response.code.to_i != 200 + puts 'Failed to parse file' + exit 1 + end + + pipeline = JSON.parse(response.read_body) +end + +# Hit the local-orchestrator +Net::HTTP.start('localhost', 7673) do |http| + contexts = [] + pipeline['batches'].each do |batch| + contexts += (batch['contexts']) + end + + payload = JSON.dump({ + :pipeline => pipeline['uuid'], + :contexts => contexts, + }) + + puts payload + res = http.post('/v1/run', payload) + + if res.code.to_i != 200 + puts "Failed to orchestrate! #{res.code} #{res.read_body}" + exit 1 + end + puts 'Enqueued' +end