Commit Graph

53 Commits

Author SHA1 Message Date
R Tyler Croy f8dc3af95e Update the cargo versions
Fixes #64
2021-03-03 22:04:25 -08:00
R Tyler Croy 102ded9756 Finally fiddled around enough to make this work 2021-03-03 22:04:25 -08:00
R Tyler Croy 2ebf41bb31 This is just awful
Hopefully finding better ways in https://github.com/launchbadge/sqlx/issues/1083
2021-03-03 22:04:25 -08:00
R Tyler Croy 14d78e009f Check pointing some exploration with graphql for the reldata service 2021-03-03 22:04:25 -08:00
R Tyler Croy 08d584974b Upgrade to tide 0.16 across the board to make the async-graphql example code work 2021-03-03 22:04:25 -08:00
R Tyler Croy 8a1a47669c Scaffolding up reldata service's data migrations
Right now I'm just working within sqlite, but the migrations will need to be
mirrored for PostgreSQL in the future in `migrations/postgres`

Running this entails using the sqlx-cli (`cargo install sqlx-cli`)

    % sqlx migrate --source migrations/sqlite run
2021-03-03 22:04:25 -08:00
R Tyler Croy f017ea4660 Pull in the async-graphql dependency for reldata
I'm hoping that I can map objects through with graphql relatively easily so I
don't have to go full REST API for this service

See #63
2021-03-03 22:04:25 -08:00
R Tyler Croy 4e9c851dd6 Refactor some dependencies to allow jumping to async-std 1.9.0
There are some good stabilizations and other work in this release that I want.

Also, my Cargo.tomls have been too strict, need to start relaxing that
2021-03-03 22:04:25 -08:00
R Tyler Croy 60e0b82247 Add a stub relational data service while I explore GraphQL
See #63
2021-03-03 22:04:25 -08:00
R Tyler Croy 127d3b7aa4 Refactor the parser code into its own crate for future development
This will inform #46
2020-11-28 21:42:48 -08:00
R Tyler Croy 02c34b30fd Allow the local-orchestrator to stream agent output into the logs
This is now the third place I have this same exact code. This should be
refactored into an otto-exec crate and re-used between `sh`, `otto-agent`, and
the local orchestrator
2020-11-27 21:26:21 -08:00
R Tyler Croy f5e4ddbc81 Ensure that stdout and stderr are output together from the sh step
Fixes #43
2020-11-27 21:12:20 -08:00
R Tyler Croy d054fdf7ea Correct the parsing of keyword arguments and multiple positional arguments.
This is basically me stumbling over a shortcut that I left in the parser code
when I first started on it. Now that I am integration testing, I tripped right
into this.

Fixes #44
2020-11-27 11:47:58 -08:00
R Tyler Croy ee2510ed6f Refactor the source tree to separate local executables (CLIs) and models a bit more
This should make the compile cycles a little bit more sensible when just working
on the CLI components of the agent, for example.
2020-11-26 10:40:37 -08:00
R Tyler Croy 8b9674af3e Ensure the agent is always converting positional parameters to keyword arguments
Steps are always expecting keyword arguments, but for developer convenience they
can use positional arguments.

This commit properly converts those positional arguments.

Run with my local integration test:

    #!/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

Fixes #42
2020-11-25 21:24:55 -08:00
R Tyler Croy 308c516e47 Run sequential contexts in the local-orchestrator if there was a success 2020-11-22 20:02:00 -08:00
R Tyler Croy bc8e6e7cec Very simple and naive agent launching in the local orchestrator
Nothing here is suitable yet, but we're getting there.

Run with:

curl -XPOST -d @test-runworkload.json http://localhost:7673/v1/run

The JSON file:

{
    "pipeline": "2265b5d0-1f70-46de-bf50-f1050e9fac9a",
    "contexts" : [
        {
            "uuid" :"3ce1f6fb-79ca-4564-a47e-98265f53ef7f",
            "properties" : {},
            "steps" : [
                {
                    "symbol":  "sh",
                    "uuid": "5599cffb-f23a-4e0f-a0b9-f74654641b2b",
                    "context": "3ce1f6fb-79ca-4564-a47e-98265f53ef7f",
                    "parameters" : {
                        "script" : "pwd"
                    }
                }
            ]
        }
    ]
}
2020-11-22 15:50:34 -08:00
R Tyler Croy c7d50516ac Make the parser failure message a bit more compact
While running fuzzing this was spewing way too many log lines
2020-11-22 10:46:52 -08:00
R Tyler Croy 6ccb9d841d Sketch out the RunWorkload for the local-orchestrator service 2020-11-22 10:39:47 -08:00
R Tyler Croy 391894ded7 Add the local orchestrator apispecs and a simple healthcheck
Still not sure what this API should look like, but will start playing around
with it.
2020-11-21 15:42:10 -08:00
R Tyler Croy 6db9ca6d75 Update the parser apispec to include the new response format
Missed this earlier since CI doesn't _yet_ run schemathesis
2020-11-21 15:04:26 -08:00
R Tyler Croy 508346498d Add the stub for the local-orchestrator
See #41
2020-11-21 14:59:27 -08:00
R Tyler Croy e4e3660d3a Upgrade to the latest tide release 👏 2020-11-15 14:45:23 -08:00
R Tyler Croy 43540a5dd6 Switch the invocation file formats from YAML to JSON
YAML is a bonkers format with a lot of leeway for bugs, JSON is dumb but very
predictable.

Since these are machine-read files, they can be JSON. The human-editable step
library manifests will remain YAML
2020-11-14 20:15:16 -08:00
R Tyler Croy d92a72ec7d Restructuring the models to allow for parallel execution of contexts
This will lay the ground work for more complex pipeline verbs like fanout and
parallel

This also changes the invocation file format for the agent to basically:

    ---
    pipeline: 'some-uuid'
    steps:
      - symbol: sh
        context: 'some-uuid'
        parameters:

This means that the agents will be a little more stupid when it comes to the
overall pipeline structure
2020-11-14 15:43:28 -08:00
R Tyler Croy bd41fecab3 Slight cleanup/refactoring 2020-11-11 19:59:16 -08:00
R Tyler Croy 414ad11f8e Add simple single line comments 2020-11-08 15:55:08 -08:00
R Tyler Croy f496748483 Shuffle the parser to make stages truly optional, allowing inline orphan steps
This is the manifestation of @steven-terrana's feedback. Basically the pipeline
is linear from top to bottom, and the author can put un-staged steps anywhere
along the path that they want. This should make the simplest pipelines pretty
dang simple.

These steps will have to be rendered somehow by a frontend at some point, but
that's a problem for later! 😸
2020-11-08 15:38:01 -08:00
R Tyler Croy 5c6fc665ba Remove the stages{} block which is not terribly useful.
This starts to make room for multiple root-level verbs in the pipeline, but also
for stages to be optional, e.g.

    pipeline {
        steps {
            sh 'make all'
            archive 'build/*.tar.gz'
        }
    }

(the above doesn't parse yet)

Based on a discussion about the merits of the stage block with @steven-terrana
2020-11-08 15:16:00 -08:00
R Tyler Croy 603ad5eb4f Add some documentation around the parser service 2020-11-08 15:09:07 -08:00
R Tyler Croy b70cf8c17b Update the object-store to also allow use with catflap 2020-11-08 15:01:06 -08:00
R Tyler Croy 649d29f3d2 cargo fmt 2020-11-08 14:50:54 -08:00
R Tyler Croy d5303133e8 Add a simple /health endpoint which all Otto services should have 2020-11-08 14:50:31 -08:00
R Tyler Croy 8be8dc98d7 Start returning a real pipeline object
I need to figure out how tos share this ParsePipelineResponse model with the
models directory which is the real source of truth here
2020-11-08 14:37:33 -08:00
R Tyler Croy 35ec2e63bb Flesh out the apispec some more and make the basic schemathesis runs pass
This is passing only with the local patch I made too work around this issue:
    https://github.com/schemathesis/schemathesis/issues/850
2020-11-08 14:09:35 -08:00
R Tyler Croy 25a2bf6fb6 Exploring using openapi and schemathesis to describe the parser service API
Running via:
    schemathesis run ./services/parser/apispec.yml --base-url=http://localhost:7672 --checks all

The parser service is also using `catflap` for development: https://github.com/passcod/catflap

See #13
2020-11-08 09:27:19 -08:00
R Tyler Croy f7c845e374 Upgrade to async-std 1.7.0
WOOOOO
2020-11-04 13:05:55 -08:00
R Tyler Croy 8404b6fca2 Move the parser into the services directory where it belongs
This commit also cleans up a lot of build warnings that were bugging me
2020-11-03 20:54:05 -08:00
R Tyler Croy 2dc7670cbd cargo fmt 2020-11-01 15:26:09 -08:00
R Tyler Croy 394a9c9ddd Implement a simplistic object store for putting artifacts 2020-11-01 14:37:13 -08:00
R Tyler Croy 1baebf061c Move the services into their own own directory for a cleaner root tree
There's going to be a number of services..
2020-10-30 20:05:44 -07:00
R Tyler Croy d55f7f60ca
Remove all the TypeScript code to start over again with something different 2019-12-13 21:03:46 -08:00
R Tyler Croy 75069fab67
Introduce ts-lint and clean everything up a bit 2019-07-07 11:27:44 -07:00
R Tyler Croy e7ecc6574a
Remove some unnecessary semi-colons 2019-07-07 11:10:27 -07:00
R Tyler Croy 8ddfa393a4
Scaffolding out the internal representation of the otto file format
This is just me thinking out loud in code, I'll likely restructure this a
couple times before I'm happy with it
2019-07-07 09:51:05 -07:00
R Tyler Croy ff919ce892
Make the stage block behave more consistently like other blocks
None of the other blocks have parenthesis and take arguments the way the
stage(name) does. To make all blocks behave a bit more in line with one another,
this commit changes the behavior of naming stages to look more like a
generalized block settings.

This presages some macro work that's coming in the following commits.
2019-07-06 10:37:13 -07:00
R Tyler Croy 0f66174874
Clean up the cache use syntax to avoid the confusing re-use of "from"
In the context of the cache {} block, we don't want to use `from` to copy the
cache directives from another stage entirely, rather we want to "use" the named
cached entry.

I think it makes sense to allow caches to be pulled individually. Imagining a
case where a compilation stage might create multiple platform specific
directories or binaries. In such cases, a Windows test-specific stage would only
want to grab the cached entries for Windows, etc.
2019-07-05 18:39:09 -07:00
R Tyler Croy 34359b5d4f
Start describing the parser service and its role in the system
This is still just a sketch of what's in my brain. The internal representation
is likely going to have to evolve a lot more once the parser gets further along
2019-07-04 20:02:47 -07:00
R Tyler Croy a841198910
Add support for blackbox testing the API for the orchestrator with dredd
This requires some shenanigans with the headers of the response, since
Feathers/Express likes to augment the Content-Type with the charset field. The
charset field throws dredd off for some silly reason, so this might trimming in
some express middleware later
2019-07-03 11:46:26 -07:00
R Tyler Croy 21a4ebadcc
Bootstrap the orchestration service from a common configuration 2019-06-25 20:44:59 -07:00