suborbital / subo

The Suborbital CLI
Apache License 2.0
81 stars 25 forks source link

Validate bundle directive (#53) #208

Closed rnpridgeon closed 2 years ago

rnpridgeon commented 2 years ago

Compliments: https://github.com/suborbital/atmo/pull/137

Subo does not currently verify the directive when bundling projects which may result in unexpected errors when deploying a bundle.

This PR adds an additional step to the build process which will validate the augmented directive.

User defined directive

handlers:
  - type: request
    resource: /hello
    method: POST
    steps:
      - fn: helloworld
  - type: request
    resource: /hello
    method: POST
    steps:
      - fn: helloworld

Without this change:

subo build .
ℹ️  🐳 using Docker toolchain
⏩ START: building runnable: helloworld (rust)
 Downloading crates ...
...
✅ DONE: helloworld was built -> /root/runnable/helloworld/helloworld.wasm
✅ DONE: bundle was created -> /home/ryanp/Workspaces/suborbital/subo/demo/runnables.wasm.zip @ v0.1.0

With this change:

subo build .
ℹ️  🐳 using Docker toolchain
⏩ START: building runnable: helloworld (rust)
 Downloading crates ...
 ...
✅ DONE: helloworld was built -> /root/runnable/helloworld/helloworld.wasm
Error: failed to Bundle: 🚫 failed to AugmentAndValidateDirectiveFns: found 1 problems:
        a handle is already registered for path '/hello'
Usage:
  subo build [dir] [flags]
rnpridgeon commented 2 years ago

Turns out this is a bit more aggressive than it should be. Will revisit monday

javorszky commented 2 years ago

The very first piece of review of whether we should find a different expression for "sanity". Reason: https://www.selfdefined.app/definitions/sanity-check/ (tldr it's ableist) (this also applies to the entirety of our codebase though, but this is the first one I'm reviewing that it came up)

rnpridgeon commented 2 years ago

renamed targets and scripts to smoketest, removed sudo from clean up trap.

I'm not sure if sanity.yml is a required name for the CI so I'll leave that as is for now and we can follow up on it later.

https://github.com/suborbital/subo/issues/212