diff --git a/examples/react-netlify/inputs.yaml b/examples/react-netlify/inputs.yaml index 81fd683b..f40e6e4d 100644 --- a/examples/react-netlify/inputs.yaml +++ b/examples/react-netlify/inputs.yaml @@ -1,13 +1,14 @@ todoApp: account: + name: ENC[AES256_GCM,data:/T5E/8rU3YVxpA==,iv:dscf+kcVg0jYd5ICyJJL/f80BHyUDtfHWW9cRSP7aCU=,tag:xHZpdqNoYa58NbAX691vhg==,type:str] token: ENC[AES256_GCM,data:6RBg3KafhrJYS8hbACxNRtnkpSNeablIiqHhUZTjz04X3cPyP4igPn7cnw==,iv:kj0vn83GaAtocUBdacO5D+6SJu6sVxfs58LYvUdpivA=,tag:CzZFkr9sXFHOOQihqYBdTA==,type:str] sops: kms: [] gcp_kms: [] azure_kv: [] hc_vault: [] - lastmodified: '2021-03-18T22:02:52Z' - mac: ENC[AES256_GCM,data:vuEPq+lDznl4V0yOArOJsqFYG2fJpztUpcRKYlbq3VRAUiFP8iGUe5OPx5KhSs9pRlrC9x60n0tVnnChB+daYR+RO61q8NCv2/5ypbseAXws5InQY8gKR9Ia0pkNL1hA38tvtcuSR7upzx/oUjVJQC7sDvJ+d1Vz7zxSuNs1qM4=,iv:MnZh4fLWIivLSe/I/RlZ75/7jSkO+RhhB9C5VFGjbtM=,tag:1cY5i7Io9BGambpkNejYpA==,type:str] + lastmodified: '2021-03-19T00:41:47Z' + mac: ENC[AES256_GCM,data:eaDHLQHEH8wtCiDhcl9wWIC+WwitEBRr4K/p7chOKJ8sBc3wlH+dT3HVX5hTYX5rwU0ai2wgfcOg6mw4mDksIJvU4JpZV/AIo16ETjZDhRSc5hU1hUAiOQCYuJPqyGa12HzxzA81mcFm8kJETnoTYiTo7ApG9ShmOCp6XPezjPk=,iv:5Pd9eGTrVnr0ITNj/TrgJz9UE2SjVqqmOxxZOw0Spus=,tag:VGxPwp7hXHtz9Zvk+6WsqA==,type:str] pgp: - created_at: '2021-03-18T22:02:51Z' enc: | diff --git a/examples/react-netlify/main.cue b/examples/react-netlify/main.cue index c48ced57..df4d2549 100644 --- a/examples/react-netlify/main.cue +++ b/examples/react-netlify/main.cue @@ -13,11 +13,10 @@ repository: git.#Repository & { todoApp: netlify.#Site & { account: { - name: "blocklayer" token: string // Fill using --input-string todoApp.account.token=XXX } - name: "dagger-test" + name: "dagger-example-react-netlify" contents: yarn.#Script & { source: repository diff --git a/tests/stdlib/netlify/inputs.yaml b/tests/stdlib/netlify/inputs.yaml new file mode 100644 index 00000000..bfdc3e13 --- /dev/null +++ b/tests/stdlib/netlify/inputs.yaml @@ -0,0 +1,35 @@ +TestNetlify: + deploy: + account: + name: ENC[AES256_GCM,data:AupEMRKMWvb8Wg==,iv:M4ni+CrI0udcYqgSTciuYZOVyZkTUVSrluSwJFIjqiE=,tag:dztVg8S/db5uI0cC7rivQg==,type:str] + token: ENC[AES256_GCM,data:W7Y1Qf4w5gn5OeGigY3a35VFP9THOZ7Hu9L5l84afwEpYlAQm+M8C67CHA==,iv:Jey3UX/3DihTGG87aFU2FWzEIuXlQ+pboxTd8Gx5gNY=,tag:LnpTzsVzTZkkk+jsbtkpKw==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + lastmodified: '2021-03-19T00:15:11Z' + mac: ENC[AES256_GCM,data:bXUJxpw4wIzqzNRjYnyxiYqfTCk78YGOI8CdyIjhFsVgEhla8FmS/CCeUlEunfbTwaYQkWx+Uodz8MVk1yGcvjOl6KQvcIL8/U2uA3WYJaHI94ZdlE1J+YlLOdQR8D+RJbDkJiEhQKek2d21CM3A8njx5uUvWkzQE43lmeQAKgI=,iv:kITjaVpxc3vqLPl+mhufC5mADNk+86+u664jltBN9ro=,tag:j8/xMpLjgI8TvNb+O21C4g==,type:str] + pgp: + - created_at: '2021-03-19T00:15:11Z' + enc: | + -----BEGIN PGP MESSAGE----- + + hQIMAzqVY590vudzAQ//XsnreKKngyWdere1fMGDZxJgS7+e6dkg/2NfH58gcHvp + qv3/MqYN9rz/WhmpbZTdkahxuNOrsVjGT1hcBjjqgkK5wBiUqTaEGR6GKd1bhZ5o + t8oyYEPu4hUdzD52bcO/sapTymYSA6tc9XsGaMlferzsZVZ2T25nXpFrQ8gcRtbi + 12Tmx6FbiaqfOcNjCgcyQ7sS1oDLSXgKtj9yS8rC3LuD1ZR9HgeqBWycH318hFEH + Dkj0FlmVhF6cOZGK5WgUR7ibp5v44ta+A94HXIyUbEfN2yCo1iLxJRjH5s/S0xsJ + CwssAK3NtSxnxTk9UgX//pyl29WX2Bc3tbSEYn1pelHvWNfb6zWUMmc4O0pTtLJO + AFjeZvmB33ry1AFkuy+5NTp2B66NiiNTa7ojamTF3i2d6zVCGUJ9HO560i3pURax + 7YM1fsexBk0P6GohEdgWwx41BGqd8jt0vmrhrVIXeqDiykwYNUAkv55PTDWmG8MJ + bUNAEsKOaDHT0MaIGIqAmIdIWm//IdmK7sL8r9T3mnBQovtANRV1A+ejSWZF0fbG + DY8b4knVJVL8BMu0QnToSyHDChgAqr2liciZ+Cmx72hTVi8RkJzsBXMtjNG6bEiK + R8eBUueEsnU44PkHCJBg2gs3v+m2KUjlVbwNLFDG6/xFUs21j6bV7dhn2l3RZSPS + XgE0hKI6GK8uyu24E8mJ+pYZF4CYIgkTbyTN2fn64N3aNMn8L1bHonpXxexcnWaI + 46fatc3YtQg2mgoeNhvM7xtJYJU5RwfaTsjdjecK9jBKWiXXlgoLBwHJgkB03YQ= + =Lrp5 + -----END PGP MESSAGE----- + fp: 6CB37404020B5F0A0B41B5BB225EBAB0B936AC65 + unencrypted_suffix: _unencrypted + version: 3.6.1 diff --git a/tests/stdlib/netlify/netlify.cue b/tests/stdlib/netlify/netlify.cue new file mode 100644 index 00000000..afaf3918 --- /dev/null +++ b/tests/stdlib/netlify/netlify.cue @@ -0,0 +1,60 @@ +package netlify + +import ( + "dagger.io/llb" + "dagger.io/alpine" + "dagger.io/netlify" +) + +TestNetlify: { + // Generate a random number + random: { + string + #compute: [ + llb.#Load & {from: alpine.#Image}, + llb.#Exec & { + args: ["sh", "-c", "echo -n $RANDOM > /rand"] + }, + llb.#Export & { + source: "/rand" + }, + ] + } + + // Generate a website containing the random number + html: #compute: [ + llb.#WriteFile & { + content: random + dest: "index.html" + }, + ] + + // Deploy to netlify + deploy: netlify.#Site & { + contents: html + name: "dagger-test" + } + + // Check if the deployed site has the random marker + check: #compute: [ + llb.#Load & { + from: alpine.#Image & { + package: bash: "=~5.1" + package: curl: "=~7.74" + } + }, + llb.#Exec & { + args: [ + "/bin/bash", + "--noprofile", + "--norc", + "-eo", + "pipefail", + "-c", + #""" + test "$(curl \#(deploy.url))" = "\#(random)" + """#, + ] + }, + ] +} diff --git a/tests/test.sh b/tests/test.sh index 08f89287..7a8296b7 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -24,6 +24,8 @@ test::stdlib() { "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/go --input-dir TestData="$d"/stdlib/go/testdata test::one "stdlib: file" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/file + test::secret "$d"/stdlib/netlify/inputs.yaml "stdlib: netlify" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/stdlib/netlify } test::examples() {