diff --git a/docs/reference/argocd.md b/docs/reference/argocd.md index 26230c96..8c819934 100644 --- a/docs/reference/argocd.md +++ b/docs/reference/argocd.md @@ -16,26 +16,26 @@ Create an ArgoCD application ### argocd.#App Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | -|*config.server* | `string` |ArgoCD server | -|*config.project* | `*"default" \| string` |ArgoCD project | -|*config.token* | `dagger.#Secret` |ArgoCD authentication token | -|*name* | `string` |App name | -|*repo* | `string` |Repository url (git or helm) | -|*path* | `string` |Folder to deploy | -|*server* | `*"https://kubernetes.default.svc" \| string` |Destination server | -|*namespace* | `*"default" \| string` |Destination namespace | -|*ctr.image.config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | -|*ctr.image.config.server* | `string` |ArgoCD server | -|*ctr.image.config.project* | `*"default" \| string` |ArgoCD project | -|*ctr.image.config.token* | `dagger.#Secret` |ArgoCD authentication token | -|*ctr.env.APP_NAME* | `string` |- | -|*ctr.env.APP_REPO* | `string` |- | -|*ctr.env.APP_PATH* | `string` |- | -|*ctr.env.APP_SERVER* | `*"https://kubernetes.default.svc" \| string` |- | -|*ctr.env.APP_NAMESPACE* | `*"default" \| string` |- | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | +|*config.server* | `string` |ArgoCD server | +|*config.project* | `*"default" \| string` |ArgoCD project | +|*config.token* | `dagger.#Secret` |ArgoCD authentication token | +|*name* | `string` |App name | +|*repo* | `string` |Repository url (git or helm) | +|*path* | `string` |Folder to deploy | +|*server* | `*"https://kubernetes.default.svc" \| string` |Destination server | +|*image.config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | +|*image.config.server* | `string` |ArgoCD server | +|*image.config.project* | `*"default" \| string` |ArgoCD project | +|*image.config.token* | `dagger.#Secret` |ArgoCD authentication token | +|*namespace* | `*"default" \| string` |Destination namespace | +|*env.APP_NAME* | `string` |- | +|*env.APP_REPO* | `string` |- | +|*env.APP_PATH* | `string` |- | +|*env.APP_SERVER* | `*"https://kubernetes.default.svc" \| string` |- | +|*env.APP_NAMESPACE* | `*"default" \| string` |- | ### argocd.#App Outputs @@ -106,19 +106,19 @@ Sync an application to its targer state ### argocd.#Sync Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | -|*config.server* | `string` |ArgoCD server | -|*config.project* | `*"default" \| string` |ArgoCD project | -|*config.token* | `dagger.#Secret` |ArgoCD authentication token | -|*application* | `string` |ArgoCD application | -|*wait* | `*false \| bool` |Wait the application to sync correctly | -|*ctr.image.config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | -|*ctr.image.config.server* | `string` |ArgoCD server | -|*ctr.image.config.project* | `*"default" \| string` |ArgoCD project | -|*ctr.image.config.token* | `dagger.#Secret` |ArgoCD authentication token | -|*ctr.env.APPLICATION* | `string` |- | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | +|*config.server* | `string` |ArgoCD server | +|*config.project* | `*"default" \| string` |ArgoCD project | +|*config.token* | `dagger.#Secret` |ArgoCD authentication token | +|*application* | `string` |ArgoCD application | +|*image.config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version | +|*image.config.server* | `string` |ArgoCD server | +|*image.config.project* | `*"default" \| string` |ArgoCD project | +|*image.config.token* | `dagger.#Secret` |ArgoCD authentication token | +|*wait* | `*false \| bool` |Wait the application to sync correctly | +|*env.APPLICATION* | `string` |- | ### argocd.#Sync Outputs diff --git a/stdlib/argocd/app.cue b/stdlib/argocd/app.cue index 94f60290..dd652f10 100644 --- a/stdlib/argocd/app.cue +++ b/stdlib/argocd/app.cue @@ -25,7 +25,7 @@ import ( // Destination namespace namespace: dagger.#Input & {*"default" | string} - ctr: os.#Container & { + os.#Container & { image: #CLI & { "config": config } @@ -36,6 +36,7 @@ import ( --dest-server "$APP_SERVER" \ --dest-namespace "$APP_NAMESPACE" """# + always: true env: { APP_NAME: name APP_REPO: repo diff --git a/stdlib/argocd/status.cue b/stdlib/argocd/status.cue index 890645e8..0383f4d1 100644 --- a/stdlib/argocd/status.cue +++ b/stdlib/argocd/status.cue @@ -48,6 +48,7 @@ import ( """#, ] env: APPLICATION: name + always: true }, op.#Export & { diff --git a/stdlib/argocd/sync.cue b/stdlib/argocd/sync.cue index 72186aff..69a75bcf 100644 --- a/stdlib/argocd/sync.cue +++ b/stdlib/argocd/sync.cue @@ -16,7 +16,7 @@ import ( // Wait the application to sync correctly wait: dagger.#Input & {*false | bool} - ctr: os.#Container & { + os.#Container & { image: #CLI & { "config": config } @@ -27,6 +27,7 @@ import ( argocd app wait "$APPLICATION" fi """# + always: true env: APPLICATION: application if wait { env: WAIT_FLAG: "wait" diff --git a/stdlib/universe.bats b/stdlib/universe.bats index a05d40a0..ad751934 100644 --- a/stdlib/universe.bats +++ b/stdlib/universe.bats @@ -222,6 +222,9 @@ setup() { dagger -e argocd-infra input text TestKubeconfig -f "$HOME"/.kube/config dagger -e argocd-infra up + # Wait for infra to be ready + kubectl -n argocd wait --for=condition=available deployment -l "app.kubernetes.io/part-of=argocd" --timeout=45s + # Forward port # We need to kill subprocess to avoid infinity loop kubectl port-forward svc/argocd-server -n argocd 8080:443 >/dev/null 2>/dev/null &