netlify: Europa port

- Fix netlify.#Deploy (there's still FIXMEs)
- Externalize the `deploy.sh` script
- Add tests
- Misc engine fixes for more explicit error messages

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2022-01-19 17:19:37 -08:00
parent 7cd17c39bc
commit 5016cf5e30
14 changed files with 243 additions and 99 deletions

View File

@@ -77,6 +77,10 @@ func (c *fsContext) FromValue(v *compiler.Value) (*FS, error) {
c.l.RLock()
defer c.l.RUnlock()
if !v.LookupPath(fsIDPath).IsConcrete() {
return nil, fmt.Errorf("invalid FS at path %q: FS is not set", v.Path())
}
// This is #Scratch, so we'll return an empty FS
if v.LookupPath(fsIDPath).Kind() == cue.NullKind {
return &FS{}, nil

View File

@@ -64,9 +64,13 @@ func (c *secretContext) FromValue(v *compiler.Value) (*Secret, error) {
c.l.RLock()
defer c.l.RUnlock()
if !v.LookupPath(secretIDPath).IsConcrete() {
return nil, fmt.Errorf("invalid secret at path %q: secret is not set", v.Path())
}
id, err := v.LookupPath(secretIDPath).String()
if err != nil {
return nil, fmt.Errorf("invalid secret %q: %w", v.Path(), err)
return nil, fmt.Errorf("invalid secret at path %q: %w", v.Path(), err)
}
secret, ok := c.store[id]

View File

@@ -71,9 +71,13 @@ func (c *serviceContext) FromValue(v *compiler.Value) (*Service, error) {
c.l.RLock()
defer c.l.RUnlock()
if !v.LookupPath(serviceIDPath).IsConcrete() {
return nil, fmt.Errorf("invalid service at path %q: service is not set", v.Path())
}
id, err := v.LookupPath(serviceIDPath).String()
if err != nil {
return nil, fmt.Errorf("invalid service %q: %w", v.Path(), err)
return nil, fmt.Errorf("invalid service at path %q: %w", v.Path(), err)
}
s, ok := c.store[id]