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:
61
pkg/universe.dagger.io/netlify/test/netlify-test.cue
Normal file
61
pkg/universe.dagger.io/netlify/test/netlify-test.cue
Normal file
@@ -0,0 +1,61 @@
|
||||
package yarn
|
||||
|
||||
import (
|
||||
"encoding/yaml"
|
||||
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/netlify"
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/bash"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
inputs: secrets: test: command: {
|
||||
name: "sops"
|
||||
args: ["-d", "../../test_secrets.yaml"]
|
||||
}
|
||||
|
||||
actions: {
|
||||
testSecrets: engine.#TransformSecret & {
|
||||
input: inputs.secrets.test.contents
|
||||
#function: {
|
||||
input: _
|
||||
output: yaml.Unmarshal(input)
|
||||
}
|
||||
}
|
||||
|
||||
marker: "hello world"
|
||||
|
||||
data: engine.#WriteFile & {
|
||||
input: engine.#Scratch
|
||||
path: "index.html"
|
||||
contents: marker
|
||||
}
|
||||
|
||||
// Deploy to netlify
|
||||
deploy: netlify.#Deploy & {
|
||||
team: "blocklayer"
|
||||
token: testSecrets.output.netlifyToken.contents
|
||||
|
||||
site: "dagger-test"
|
||||
contents: data.output
|
||||
}
|
||||
|
||||
_alpine: alpine.#Build & {
|
||||
packages: {
|
||||
bash: {}
|
||||
curl: {}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the website was deployed
|
||||
verify: bash.#Run & {
|
||||
input: _alpine.output
|
||||
script: #"""
|
||||
test "$(curl \#(deploy.deployUrl))" = "\#(marker)"
|
||||
"""#
|
||||
}
|
||||
}
|
||||
}
|
9
pkg/universe.dagger.io/netlify/test/netlify.bats
Normal file
9
pkg/universe.dagger.io/netlify/test/netlify.bats
Normal file
@@ -0,0 +1,9 @@
|
||||
setup() {
|
||||
load '../../bats_helpers'
|
||||
|
||||
common_setup
|
||||
}
|
||||
|
||||
@test "netlify.#Deploy" {
|
||||
dagger up ./netlify-test.cue
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
package netlify
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
deploy: #Deploy & {
|
||||
contents: dagger.#Scratch
|
||||
}
|
Reference in New Issue
Block a user