feat: Allow default values in client: env (#2122)

Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
Helder Correia
2022-04-11 18:31:36 +00:00
committed by GitHub
parent 732ef96a06
commit 80ae63928b
4 changed files with 30 additions and 9 deletions

View File

@@ -1,11 +1,22 @@
package main
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
)
dagger.#Plan & {
client: env: {
REGISTRY_USER: string
// load as a string
REGISTRY_USER: string
// load as a secret
REGISTRY_TOKEN: dagger.#Secret
// load as a string, using a default if not defined
BASE_IMAGE: string | *"registry.example.com/image"
}
actions: pull: docker.#Pull & {
source: "registry.example.com/image"
source: client.env.BASE_IMAGE
auth: {
username: client.env.REGISTRY_USER
secret: client.env.REGISTRY_TOKEN