diff --git a/tests/ops/push-container/main.cue b/tests/ops/push-container/main.cue index c1fb4689..7d39e1bb 100644 --- a/tests/ops/push-container/main.cue +++ b/tests/ops/push-container/main.cue @@ -1,4 +1,4 @@ -package testing +package main import ( "dagger.io/dagger/op" diff --git a/tests/ops/push-container/random.cue b/tests/ops/push-container/random.cue index b48f1848..5787a9e1 100644 --- a/tests/ops/push-container/random.cue +++ b/tests/ops/push-container/random.cue @@ -1,21 +1,49 @@ -package testing +package main import ( + "strconv" + "dagger.io/alpine" "dagger.io/dagger/op" ) -// Generate a random number -random: { - string - #up: [ - op.#Load & {from: alpine.#Image}, - op.#Exec & { - always: true - args: ["sh", "-c", "cat /dev/urandom | tr -dc 'a-z' | fold -w 10 | head -n 1 | tr -d '\n' > /rand"] - }, - op.#Export & { - source: "/rand" - }, - ] +#Random: { + size: *12 | number + + out: { + string + + #up: [ + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, + + op.#Exec & { + always: true + args: ["sh", "-c", #""" + printf "$(python3 /entrypoint.py)" > /rand + """#, + ] + env: SIZE: strconv.FormatInt(size, 10) + }, + + op.#Export & { + source: "/rand" + }, + ] + } } diff --git a/tests/stdlib/aws/ecr/.dagger/env/default/plan/ecr.cue b/tests/stdlib/aws/ecr/.dagger/env/default/plan/ecr.cue index c093a895..96a6c982 100644 --- a/tests/stdlib/aws/ecr/.dagger/env/default/plan/ecr.cue +++ b/tests/stdlib/aws/ecr/.dagger/env/default/plan/ecr.cue @@ -1,4 +1,4 @@ -package ecr +package main import ( "dagger.io/aws" diff --git a/tests/stdlib/aws/ecr/.dagger/env/default/plan/random.cue b/tests/stdlib/aws/ecr/.dagger/env/default/plan/random.cue index 522cbd34..5787a9e1 100644 --- a/tests/stdlib/aws/ecr/.dagger/env/default/plan/random.cue +++ b/tests/stdlib/aws/ecr/.dagger/env/default/plan/random.cue @@ -1,4 +1,4 @@ -package ecr +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/docker/push-pull/push-pull.cue b/tests/stdlib/docker/push-pull/push-pull.cue index b3a0b7d9..41b82a37 100644 --- a/tests/stdlib/docker/push-pull/push-pull.cue +++ b/tests/stdlib/docker/push-pull/push-pull.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "dagger.io/dagger" diff --git a/tests/stdlib/docker/push-pull/random.cue b/tests/stdlib/docker/push-pull/random.cue index 1c30f6fc..5787a9e1 100644 --- a/tests/stdlib/docker/push-pull/random.cue +++ b/tests/stdlib/docker/push-pull/random.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/docker/run/local/.dagger/env/default/plan/local.cue b/tests/stdlib/docker/run/local/.dagger/env/default/plan/local.cue index 1b894eb5..7dec865e 100644 --- a/tests/stdlib/docker/run/local/.dagger/env/default/plan/local.cue +++ b/tests/stdlib/docker/run/local/.dagger/env/default/plan/local.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "dagger.io/docker" diff --git a/tests/stdlib/docker/run/local/.dagger/env/default/plan/random.cue b/tests/stdlib/docker/run/local/.dagger/env/default/plan/random.cue index 1c30f6fc..5787a9e1 100644 --- a/tests/stdlib/docker/run/local/.dagger/env/default/plan/random.cue +++ b/tests/stdlib/docker/run/local/.dagger/env/default/plan/random.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/passphrase.cue b/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/passphrase.cue index 1253c7b2..e058b1ca 100644 --- a/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/passphrase.cue +++ b/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/passphrase.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "dagger.io/docker" diff --git a/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/random.cue b/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/random.cue index 1c30f6fc..5787a9e1 100644 --- a/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/random.cue +++ b/tests/stdlib/docker/run/ssh-passphrase/.dagger/env/default/plan/random.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/random.cue b/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/random.cue index 1c30f6fc..5787a9e1 100644 --- a/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/random.cue +++ b/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/random.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/wrong-passphrase.cue b/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/wrong-passphrase.cue index bc301be6..5c1bda50 100644 --- a/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/wrong-passphrase.cue +++ b/tests/stdlib/docker/run/ssh-wrong-passphrase/.dagger/env/default/plan/wrong-passphrase.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "dagger.io/docker" diff --git a/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/random.cue b/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/random.cue index 1c30f6fc..5787a9e1 100644 --- a/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/random.cue +++ b/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/random.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/simple.cue b/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/simple.cue index d8d6f6a7..b1478042 100644 --- a/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/simple.cue +++ b/tests/stdlib/docker/run/ssh/.dagger/env/default/plan/simple.cue @@ -1,4 +1,4 @@ -package docker +package main import ( "dagger.io/docker" diff --git a/tests/stdlib/gcp/gcr/.dagger/env/default/plan/gcr.cue b/tests/stdlib/gcp/gcr/.dagger/env/default/plan/gcr.cue index 59252816..207a519d 100644 --- a/tests/stdlib/gcp/gcr/.dagger/env/default/plan/gcr.cue +++ b/tests/stdlib/gcp/gcr/.dagger/env/default/plan/gcr.cue @@ -1,4 +1,4 @@ -package gcr +package main import ( "dagger.io/gcp" diff --git a/tests/stdlib/gcp/gcr/.dagger/env/default/plan/random.cue b/tests/stdlib/gcp/gcr/.dagger/env/default/plan/random.cue index a17a9404..5787a9e1 100644 --- a/tests/stdlib/gcp/gcr/.dagger/env/default/plan/random.cue +++ b/tests/stdlib/gcp/gcr/.dagger/env/default/plan/random.cue @@ -1,4 +1,4 @@ -package gcr +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/kubernetes/helm/helm.cue b/tests/stdlib/kubernetes/helm/helm.cue index 8f8580d2..3b4dfdf6 100644 --- a/tests/stdlib/kubernetes/helm/helm.cue +++ b/tests/stdlib/kubernetes/helm/helm.cue @@ -1,4 +1,4 @@ -package helm +package main import ( "dagger.io/dagger" diff --git a/tests/stdlib/kubernetes/helm/random.cue b/tests/stdlib/kubernetes/helm/random.cue index a8a815ec..5787a9e1 100644 --- a/tests/stdlib/kubernetes/helm/random.cue +++ b/tests/stdlib/kubernetes/helm/random.cue @@ -1,4 +1,4 @@ -package helm +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/kubernetes/helm/verify.cue b/tests/stdlib/kubernetes/helm/verify.cue index b2c42896..6f0e9579 100644 --- a/tests/stdlib/kubernetes/helm/verify.cue +++ b/tests/stdlib/kubernetes/helm/verify.cue @@ -1,4 +1,4 @@ -package helm +package main import ( "dagger.io/dagger/op" diff --git a/tests/stdlib/kubernetes/kubernetes.cue b/tests/stdlib/kubernetes/kubernetes.cue index e851e4cb..cd693930 100644 --- a/tests/stdlib/kubernetes/kubernetes.cue +++ b/tests/stdlib/kubernetes/kubernetes.cue @@ -1,4 +1,4 @@ -package kubernetes +package main import ( "encoding/yaml" diff --git a/tests/stdlib/kubernetes/kustomize/kustomize.cue b/tests/stdlib/kubernetes/kustomize/kustomize.cue index 50fc9fb4..2ebe0682 100644 --- a/tests/stdlib/kubernetes/kustomize/kustomize.cue +++ b/tests/stdlib/kubernetes/kustomize/kustomize.cue @@ -1,4 +1,4 @@ -package kustomize +package main import ( "encoding/yaml" diff --git a/tests/stdlib/kubernetes/kustomize/verify.cue b/tests/stdlib/kubernetes/kustomize/verify.cue index 18a923b5..48075413 100644 --- a/tests/stdlib/kubernetes/kustomize/verify.cue +++ b/tests/stdlib/kubernetes/kustomize/verify.cue @@ -1,4 +1,4 @@ -package kustomize +package main import ( "dagger.io/dagger/op" diff --git a/tests/stdlib/kubernetes/random.cue b/tests/stdlib/kubernetes/random.cue index 51bb53c5..5787a9e1 100644 --- a/tests/stdlib/kubernetes/random.cue +++ b/tests/stdlib/kubernetes/random.cue @@ -1,4 +1,4 @@ -package kubernetes +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10) diff --git a/tests/stdlib/kubernetes/verify.cue b/tests/stdlib/kubernetes/verify.cue index 210ddce8..0ce59bf8 100644 --- a/tests/stdlib/kubernetes/verify.cue +++ b/tests/stdlib/kubernetes/verify.cue @@ -1,4 +1,4 @@ -package kubernetes +package main import ( "dagger.io/dagger/op" diff --git a/tests/stdlib/netlify/.dagger/env/default/plan/netlify.cue b/tests/stdlib/netlify/.dagger/env/default/plan/netlify.cue index ea6c7ae9..bee7ccbb 100644 --- a/tests/stdlib/netlify/.dagger/env/default/plan/netlify.cue +++ b/tests/stdlib/netlify/.dagger/env/default/plan/netlify.cue @@ -1,4 +1,4 @@ -package netlify +package main import ( "dagger.io/dagger/op" diff --git a/tests/stdlib/netlify/.dagger/env/default/plan/random.cue b/tests/stdlib/netlify/.dagger/env/default/plan/random.cue index 53c78a18..5787a9e1 100644 --- a/tests/stdlib/netlify/.dagger/env/default/plan/random.cue +++ b/tests/stdlib/netlify/.dagger/env/default/plan/random.cue @@ -1,4 +1,4 @@ -package netlify +package main import ( "strconv" @@ -14,12 +14,28 @@ import ( string #up: [ - op.#Load & {from: alpine.#Image}, + op.#Load & {from: alpine.#Image & { + package: python3: "=~3.8" + }}, + + op.#WriteFile & { + dest: "/entrypoint.py" + content: #""" + import random + import string + import os + + size = int(os.environ['SIZE']) + letters = string.ascii_lowercase + + print ( ''.join(random.choice(letters) for i in range(size)) ) + """# + }, op.#Exec & { always: true args: ["sh", "-c", #""" - tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand + printf "$(python3 /entrypoint.py)" > /rand """#, ] env: SIZE: strconv.FormatInt(size, 10)