Add an Ottofile which runs this repos tests

Basically this requires:

* `make run` to launch the service mesh
* `./scripts/local-run`

And then you wait, because log output from the agent's step invocation is not
yet streaming 😆
This commit is contained in:
R Tyler Croy 2020-11-27 11:57:05 -08:00
parent d054fdf7ea
commit 6b3781b746
2 changed files with 59 additions and 0 deletions

18
Ottofile Normal file
View File

@ -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

41
scripts/local-run Executable file
View File

@ -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