Merge pull request #883 from VazeeKevin/stdlib/argocd
stdlib: ArgoCD app support
This commit is contained in:
commit
73fe95824c
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -144,9 +144,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Provision Localstack AWS resources
|
- name: Provision Localstack AWS resources
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: test
|
AWS_ACCESS_KEY_ID: test
|
||||||
AWS_SECRET_ACCESS_KEY: test
|
AWS_SECRET_ACCESS_KEY: test
|
||||||
AWS_DEFAULT_REGION: us-east-2
|
AWS_DEFAULT_REGION: us-east-2
|
||||||
run: |
|
run: |
|
||||||
aws --endpoint-url=http://localhost:4566 s3 mb s3://dagger-ci
|
aws --endpoint-url=http://localhost:4566 s3 mb s3://dagger-ci
|
||||||
aws --endpoint-url=http://localhost:4566 ecr create-repository --repository-name dagger-ci
|
aws --endpoint-url=http://localhost:4566 ecr create-repository --repository-name dagger-ci
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Index
|
# Index
|
||||||
|
|
||||||
- [alpine](./alpine.md) - Base package for Alpine Linux
|
- [alpine](./alpine.md) - Base package for Alpine Linux
|
||||||
|
- [argocd](./argocd.md) - ArgoCD client operations
|
||||||
- [aws](./aws/README.md) - AWS base package
|
- [aws](./aws/README.md) - AWS base package
|
||||||
- [aws/cloudformation](./aws/cloudformation.md) - AWS CloudFormation
|
- [aws/cloudformation](./aws/cloudformation.md) - AWS CloudFormation
|
||||||
- [aws/ecr](./aws/ecr.md) - Amazon Elastic Container Registry (ECR)
|
- [aws/ecr](./aws/ecr.md) - Amazon Elastic Container Registry (ECR)
|
||||||
|
137
docs/reference/argocd.md
Normal file
137
docs/reference/argocd.md
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: argocd
|
||||||
|
---
|
||||||
|
|
||||||
|
# alpha.dagger.io/argocd
|
||||||
|
|
||||||
|
ArgoCD client operations
|
||||||
|
|
||||||
|
```cue
|
||||||
|
import "alpha.dagger.io/argocd"
|
||||||
|
```
|
||||||
|
|
||||||
|
## argocd.#App
|
||||||
|
|
||||||
|
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 |
|
||||||
|
|*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
|
||||||
|
|
||||||
|
_No output._
|
||||||
|
|
||||||
|
## argocd.#CLI
|
||||||
|
|
||||||
|
Re-usable CLI component
|
||||||
|
|
||||||
|
### argocd.#CLI 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 |
|
||||||
|
|
||||||
|
### argocd.#CLI Outputs
|
||||||
|
|
||||||
|
_No output._
|
||||||
|
|
||||||
|
## argocd.#Config
|
||||||
|
|
||||||
|
ArgoCD configuration
|
||||||
|
|
||||||
|
### argocd.#Config Inputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ------------- |:-------------: |:-------------: |
|
||||||
|
|*version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version |
|
||||||
|
|*server* | `string` |ArgoCD server |
|
||||||
|
|*project* | `*"default" \| string` |ArgoCD project |
|
||||||
|
|*token* | `dagger.#Secret` |ArgoCD authentication token |
|
||||||
|
|
||||||
|
### argocd.#Config Outputs
|
||||||
|
|
||||||
|
_No output._
|
||||||
|
|
||||||
|
## argocd.#Status
|
||||||
|
|
||||||
|
Get application's status
|
||||||
|
|
||||||
|
### argocd.#Status 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` |ArgoCD application |
|
||||||
|
|
||||||
|
### argocd.#Status Outputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ------------- |:-------------: |:-------------: |
|
||||||
|
|*outputs.health* | `string` |Application health |
|
||||||
|
|*outputs.sync* | `string` |Application sync state |
|
||||||
|
|*outputs.namespace* | `string` |Namespace |
|
||||||
|
|*outputs.server* | `string` |Server |
|
||||||
|
|*outputs.urls* | `string` |Comma separated list of application URLs |
|
||||||
|
|*outputs.state* | `string` |Last operation state message |
|
||||||
|
|
||||||
|
## argocd.#Sync
|
||||||
|
|
||||||
|
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` |- |
|
||||||
|
|*status.config.version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version |
|
||||||
|
|*status.config.server* | `string` |ArgoCD server |
|
||||||
|
|*status.config.project* | `*"default" \| string` |ArgoCD project |
|
||||||
|
|*status.config.token* | `dagger.#Secret` |ArgoCD authentication token |
|
||||||
|
|*status.name* | `string` |ArgoCD application |
|
||||||
|
|
||||||
|
### argocd.#Sync Outputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ------------- |:-------------: |:-------------: |
|
||||||
|
|*status.outputs.health* | `string` |Application health |
|
||||||
|
|*status.outputs.sync* | `string` |Application sync state |
|
||||||
|
|*status.outputs.namespace* | `string` |Namespace |
|
||||||
|
|*status.outputs.server* | `string` |Server |
|
||||||
|
|*status.outputs.urls* | `string` |Comma separated list of application URLs |
|
||||||
|
|*status.outputs.state* | `string` |Last operation state message |
|
45
docs/reference/argocd/README.md
Normal file
45
docs/reference/argocd/README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: argocd
|
||||||
|
---
|
||||||
|
|
||||||
|
# alpha.dagger.io/argocd
|
||||||
|
|
||||||
|
ArgoCD client operations
|
||||||
|
|
||||||
|
```cue
|
||||||
|
import "alpha.dagger.io/argocd"
|
||||||
|
```
|
||||||
|
|
||||||
|
## argocd.#CLI
|
||||||
|
|
||||||
|
Re-usable CLI component
|
||||||
|
|
||||||
|
### argocd.#CLI 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 |
|
||||||
|
|
||||||
|
### argocd.#CLI Outputs
|
||||||
|
|
||||||
|
_No output._
|
||||||
|
|
||||||
|
## argocd.#Config
|
||||||
|
|
||||||
|
ArgoCD configuration
|
||||||
|
|
||||||
|
### argocd.#Config Inputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ------------- |:-------------: |:-------------: |
|
||||||
|
|*version* | `*"v2.0.5" \| string` |ArgoCD CLI binary version |
|
||||||
|
|*server* | `string` |ArgoCD server |
|
||||||
|
|*project* | `*"default" \| string` |ArgoCD project |
|
||||||
|
|*token* | `dagger.#Secret` |ArgoCD authentication token |
|
||||||
|
|
||||||
|
### argocd.#Config Outputs
|
||||||
|
|
||||||
|
_No output._
|
72
docs/reference/argocd/app.md
Normal file
72
docs/reference/argocd/app.md
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: app
|
||||||
|
---
|
||||||
|
|
||||||
|
# alpha.dagger.io/argocd/app
|
||||||
|
|
||||||
|
ArgoCD applications
|
||||||
|
|
||||||
|
```cue
|
||||||
|
import "alpha.dagger.io/argocd/app"
|
||||||
|
```
|
||||||
|
|
||||||
|
## app.#Application
|
||||||
|
|
||||||
|
Get an application
|
||||||
|
|
||||||
|
### app.#Application 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` |ArgoCD application |
|
||||||
|
|
||||||
|
### app.#Application Outputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ------------- |:-------------: |:-------------: |
|
||||||
|
|*outputs.health* | `string` |Application health |
|
||||||
|
|*outputs.sync* | `string` |Application sync state |
|
||||||
|
|*outputs.namespace* | `string` |Namespace |
|
||||||
|
|*outputs.server* | `string` |Server |
|
||||||
|
|*outputs.urls* | `string` |Comma separated list of application URLs |
|
||||||
|
|*outputs.state* | `string` |Last operation state message |
|
||||||
|
|
||||||
|
## app.#Synchronization
|
||||||
|
|
||||||
|
Sync an application to its target state
|
||||||
|
|
||||||
|
### app.#Synchronization 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 |
|
||||||
|
|
||||||
|
### app.#Synchronization Outputs
|
||||||
|
|
||||||
|
_No output._
|
||||||
|
|
||||||
|
## app.#SynchronizedApplication
|
||||||
|
|
||||||
|
Wait for an application to reach a synced and healthy state
|
||||||
|
|
||||||
|
### app.#SynchronizedApplication 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 |
|
||||||
|
|
||||||
|
### app.#SynchronizedApplication Outputs
|
||||||
|
|
||||||
|
_No output._
|
2
stdlib/.dagger/env/argocd-infra/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/argocd-infra/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# dagger state
|
||||||
|
state/**
|
23
stdlib/.dagger/env/argocd-infra/values.yaml
vendored
Normal file
23
stdlib/.dagger/env/argocd-infra/values.yaml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
plan:
|
||||||
|
package: ./argocd/tests/infra
|
||||||
|
name: argocd-infra
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBmVmEzZ3RDdjlBRXBleURr
|
||||||
|
cmx6YW40ZHFLMHpqa2RYWUlIdTFIZlYyZ3pnCmVieTB2MXdid1l5ZitUMkprVGFz
|
||||||
|
RHl4elJzdWRTYS9MaXZkU29UMG1SSmcKLS0tIHFjNHhBVVVwcGwrVWZHOXoxdGps
|
||||||
|
RWlubERCTjFkSStyQXdpbSttbXB1RmcKQeRMIc8QGKI8HkoBXCQzR/gaBoiYTYxy
|
||||||
|
vLjf1kMlX4BvmwTpmDO9Wer8a/NXEwA3zpK/kHaoXGBZln8Lf4J87A==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2021-09-09T10:52:18Z"
|
||||||
|
mac: ENC[AES256_GCM,data:B5CZFBYviKy/l8YYzg3luUdeFpRTGx5q+Q5b56SvIVvdp33TQwvU6bftiNOwUHjI3a3B2p70QNKxam+Yk7Pf9jC1nN6dR1jWh0RcicTjQOI6URN6NgS667/iCG7e94fKiVKlbgRq/P7eudnJrkhPsiqqHopmWg41g+izH+YOX2I=,iv:X6nxvaEdtnyUSEPODJLrPfuju906b9EYsye4MstBGRc=,tag:olbgC+EtQ8U8FJejQv5u/Q==,type:str]
|
||||||
|
pgp: []
|
||||||
|
encrypted_suffix: secret
|
||||||
|
version: 3.7.1
|
2
stdlib/.dagger/env/argocd/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/argocd/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# dagger state
|
||||||
|
state/**
|
26
stdlib/.dagger/env/argocd/values.yaml
vendored
Normal file
26
stdlib/.dagger/env/argocd/values.yaml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
plan:
|
||||||
|
package: ./argocd/tests
|
||||||
|
name: argocd
|
||||||
|
inputs:
|
||||||
|
TestConfig.argocdConfig.server:
|
||||||
|
text: localhost:8080
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBhZEhvaGFiVGVUcWZhcjVj
|
||||||
|
WmthWWRMMmFXSmRIbzNKUm9IMms0TUltcjBvClE4UHlwcHVGcjVJTHRhNUx1Lyt4
|
||||||
|
UHZlTlBRRnhtMmMzcmFPUGlBTXlVMncKLS0tIFpkSXU1SDUvZTR4MVgxNWxKV3V3
|
||||||
|
LzM4MENHSVZFNVJza3FhVGkyd0R4d3cKPI6V2o1BR8WVrsAdsuuKOW9Lw32c+KUh
|
||||||
|
WBHXbYucWjPeogNVIZK+/iJs4Pz92fQ1awdj0H47ro3d7I3QfZoeJQ==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2021-09-10T09:08:35Z"
|
||||||
|
mac: ENC[AES256_GCM,data:RhRtuEL1xqfJ8pvofq91JMKElZY4Pqvb3SY3IhVevotGBAR6UvmKBA6Nfi3VsvbjfAlbA8/Ip+ifHNhuv6iS1kcj+u5Y7E+6esMdXoXlPmry1Jpt8fWu+zeO2t2XiVGsSEw8nLhPyZfMsp0KBoec1I43NUIKQXoPMbUFMMy1rLQ=,iv:Q817XyIlU/0BgUc6tNVZ8f9cz83I/3FbF8wvqaWNtso=,tag:/Ui9/AAT4RnnwfrOw83xew==,type:str]
|
||||||
|
pgp: []
|
||||||
|
encrypted_suffix: secret
|
||||||
|
version: 3.7.1
|
48
stdlib/argocd/app.cue
Normal file
48
stdlib/argocd/app.cue
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package argocd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger"
|
||||||
|
"alpha.dagger.io/os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create an ArgoCD application
|
||||||
|
#App: {
|
||||||
|
// ArgoCD configuration
|
||||||
|
config: #Config
|
||||||
|
|
||||||
|
// App name
|
||||||
|
name: dagger.#Input & {string}
|
||||||
|
|
||||||
|
// Repository url (git or helm)
|
||||||
|
repo: dagger.#Input & {string}
|
||||||
|
|
||||||
|
// Folder to deploy
|
||||||
|
path: dagger.#Input & {"." | string}
|
||||||
|
|
||||||
|
// Destination server
|
||||||
|
server: dagger.#Input & {*"https://kubernetes.default.svc" | string}
|
||||||
|
|
||||||
|
// Destination namespace
|
||||||
|
namespace: dagger.#Input & {*"default" | string}
|
||||||
|
|
||||||
|
os.#Container & {
|
||||||
|
image: #CLI & {
|
||||||
|
"config": config
|
||||||
|
}
|
||||||
|
command: #"""
|
||||||
|
argocd app create "$APP_NAME" \
|
||||||
|
--repo "$APP_REPO" \
|
||||||
|
--path "$APP_PATH" \
|
||||||
|
--dest-server "$APP_SERVER" \
|
||||||
|
--dest-namespace "$APP_NAMESPACE"
|
||||||
|
"""#
|
||||||
|
always: true
|
||||||
|
env: {
|
||||||
|
APP_NAME: name
|
||||||
|
APP_REPO: repo
|
||||||
|
APP_PATH: path
|
||||||
|
APP_SERVER: server
|
||||||
|
APP_NAMESPACE: namespace
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
99
stdlib/argocd/argocd.cue
Normal file
99
stdlib/argocd/argocd.cue
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// ArgoCD client operations
|
||||||
|
package argocd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/alpine"
|
||||||
|
"alpha.dagger.io/dagger"
|
||||||
|
"alpha.dagger.io/dagger/op"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ArgoCD configuration
|
||||||
|
#Config: {
|
||||||
|
// ArgoCD CLI binary version
|
||||||
|
version: *"v2.0.5" | dagger.#Input & {string}
|
||||||
|
|
||||||
|
// ArgoCD server
|
||||||
|
server: dagger.#Input & {string}
|
||||||
|
|
||||||
|
// ArgoCD project
|
||||||
|
project: *"default" | dagger.#Input & {string}
|
||||||
|
|
||||||
|
// Basic authentification to login
|
||||||
|
basicAuth: {
|
||||||
|
// Username
|
||||||
|
username: dagger.#Input & {string}
|
||||||
|
|
||||||
|
// Password
|
||||||
|
password: dagger.#Input & {dagger.#Secret}
|
||||||
|
} | *null
|
||||||
|
|
||||||
|
// ArgoCD authentication token
|
||||||
|
token: dagger.#Input & {*null | dagger.#Secret}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-usable CLI component
|
||||||
|
#CLI: {
|
||||||
|
config: #Config
|
||||||
|
|
||||||
|
#up: [
|
||||||
|
op.#Load & {
|
||||||
|
from: alpine.#Image & {
|
||||||
|
package: bash: "=~5.1"
|
||||||
|
package: jq: "=~1.6"
|
||||||
|
package: curl: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Install the ArgoCD CLI
|
||||||
|
op.#Exec & {
|
||||||
|
args: ["sh", "-c",
|
||||||
|
#"""
|
||||||
|
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64 &&
|
||||||
|
chmod +x /usr/local/bin/argocd
|
||||||
|
"""#,
|
||||||
|
]
|
||||||
|
env: VERSION: config.version
|
||||||
|
},
|
||||||
|
|
||||||
|
if config.basicAuth != null && config.token == null {
|
||||||
|
// Login to ArgoCD server
|
||||||
|
op.#Exec & {
|
||||||
|
args: ["sh", "-c", #"""
|
||||||
|
argocd login "$ARGO_SERVER" --username "$ARGO_USERNAME" --password $(cat /run/secrets/password) --insecure
|
||||||
|
"""#,
|
||||||
|
]
|
||||||
|
env: {
|
||||||
|
ARGO_SERVER: config.server
|
||||||
|
ARGO_USERNAME: config.basicAuth.username
|
||||||
|
}
|
||||||
|
mount: "/run/secrets/password": secret: config.basicAuth.password
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
if config.token != null && config.basicAuth == null {
|
||||||
|
// Write config file
|
||||||
|
op.#Exec & {
|
||||||
|
args: ["sh", "-c",
|
||||||
|
#"""
|
||||||
|
mkdir -p ~/.argocd && cat > ~/.argocd/config << EOF
|
||||||
|
contexts:
|
||||||
|
- name: "$SERVER"
|
||||||
|
server: "$SERVER"
|
||||||
|
user: "$SERVER"
|
||||||
|
current-context: "$SERVER"
|
||||||
|
servers:
|
||||||
|
- grpc-web-root-path: ""
|
||||||
|
server: "$SERVER"
|
||||||
|
users:
|
||||||
|
- auth-token: $(cat /run/secrets/token)
|
||||||
|
name: "$SERVER"
|
||||||
|
EOF
|
||||||
|
"""#,
|
||||||
|
]
|
||||||
|
mount: "/run/secrets/token": secret: config.token
|
||||||
|
env: SERVER: config.server
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
59
stdlib/argocd/status.cue
Normal file
59
stdlib/argocd/status.cue
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package argocd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger"
|
||||||
|
"alpha.dagger.io/dagger/op"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get application's status
|
||||||
|
#Status: {
|
||||||
|
// ArgoCD configuration
|
||||||
|
config: #Config
|
||||||
|
|
||||||
|
// ArgoCD application
|
||||||
|
name: dagger.#Input & {string}
|
||||||
|
|
||||||
|
// ArgoCD CLI output
|
||||||
|
outputs: {
|
||||||
|
// Application health
|
||||||
|
health: dagger.#Output & {string}
|
||||||
|
|
||||||
|
// Application sync state
|
||||||
|
sync: dagger.#Output & {string}
|
||||||
|
|
||||||
|
// Namespace
|
||||||
|
namespace: dagger.#Output & {string}
|
||||||
|
|
||||||
|
// Server
|
||||||
|
server: dagger.#Output & {string}
|
||||||
|
|
||||||
|
// Comma separated list of application URLs
|
||||||
|
urls: dagger.#Output & {string}
|
||||||
|
|
||||||
|
// Last operation state message
|
||||||
|
state: dagger.#Output & {string}
|
||||||
|
}
|
||||||
|
|
||||||
|
outputs: #up: [
|
||||||
|
op.#Load & {
|
||||||
|
from: #CLI & {
|
||||||
|
"config": config
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
op.#Exec & {
|
||||||
|
args: ["sh", "-c",
|
||||||
|
#"""
|
||||||
|
argocd app get "$APPLICATION" --output json | jq '{health:.status.health.status,sync:.status.sync.status,namespace:.spec.destination.namespace,server:.spec.destination.server,urls:(.status.summary.externalURLs//[]|join(",")),state:.status.operationState.message}' > /output.json
|
||||||
|
"""#,
|
||||||
|
]
|
||||||
|
env: APPLICATION: name
|
||||||
|
always: true
|
||||||
|
},
|
||||||
|
|
||||||
|
op.#Export & {
|
||||||
|
source: "/output.json"
|
||||||
|
format: "json"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
41
stdlib/argocd/sync.cue
Normal file
41
stdlib/argocd/sync.cue
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package argocd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger"
|
||||||
|
"alpha.dagger.io/os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Sync an application to its targer state
|
||||||
|
#Sync: {
|
||||||
|
// ArgoCD configuration
|
||||||
|
config: #Config
|
||||||
|
|
||||||
|
// ArgoCD application
|
||||||
|
application: dagger.#Input & {string}
|
||||||
|
|
||||||
|
// Wait the application to sync correctly
|
||||||
|
wait: dagger.#Input & {*false | bool}
|
||||||
|
|
||||||
|
ctr: os.#Container & {
|
||||||
|
image: #CLI & {
|
||||||
|
"config": config
|
||||||
|
}
|
||||||
|
command: #"""
|
||||||
|
argocd app sync "$APPLICATION"
|
||||||
|
|
||||||
|
if [ -n "$WAIT_FLAG" ]; then
|
||||||
|
argocd app wait "$APPLICATION"
|
||||||
|
fi
|
||||||
|
"""#
|
||||||
|
always: true
|
||||||
|
env: APPLICATION: application
|
||||||
|
if wait {
|
||||||
|
env: WAIT_FLAG: "wait"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
status: #Status & {
|
||||||
|
config: ctr.image.config
|
||||||
|
name: application
|
||||||
|
}
|
||||||
|
}
|
38
stdlib/argocd/tests/argocd.cue
Normal file
38
stdlib/argocd/tests/argocd.cue
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package argocd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger"
|
||||||
|
"alpha.dagger.io/os"
|
||||||
|
)
|
||||||
|
|
||||||
|
TestConfig: argocdConfig: #Config & {
|
||||||
|
version: dagger.#Input & {*"v2.0.5" | string}
|
||||||
|
server: dagger.#Input & {*"dagger-example-argocd-server.tld" | string}
|
||||||
|
basicAuth: {
|
||||||
|
username: dagger.#Input & {*"admin" | string}
|
||||||
|
password: dagger.#Input & {dagger.#Secret}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TestClient: os.#Container & {
|
||||||
|
image: #CLI & {
|
||||||
|
config: TestConfig.argocdConfig
|
||||||
|
}
|
||||||
|
command: #"""
|
||||||
|
argocd account list | grep "$ARGOCD_USERNAME"
|
||||||
|
"""#
|
||||||
|
env: ARGOCD_USERNAME: TestConfig.argocdConfig.basicAuth.username
|
||||||
|
}
|
||||||
|
|
||||||
|
TestApp: #App & {
|
||||||
|
config: TestConfig.argocdConfig
|
||||||
|
name: "daggerci-test"
|
||||||
|
repo: "https://github.com/argoproj/argocd-example-apps.git"
|
||||||
|
path: "guestbook"
|
||||||
|
}
|
||||||
|
|
||||||
|
TestArgoCDStatus: #Sync & {
|
||||||
|
config: TestApp.config
|
||||||
|
application: TestApp.name
|
||||||
|
wait: true
|
||||||
|
}
|
14
stdlib/argocd/tests/infra/infra.cue
Normal file
14
stdlib/argocd/tests/infra/infra.cue
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package infra
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger"
|
||||||
|
"alpha.dagger.io/kubernetes"
|
||||||
|
)
|
||||||
|
|
||||||
|
TestKubeconfig: dagger.#Input & {string}
|
||||||
|
|
||||||
|
TestArgoInfra: kubernetes.#Resources & {
|
||||||
|
kubeconfig: TestKubeconfig
|
||||||
|
namespace: "argocd"
|
||||||
|
url: "https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml"
|
||||||
|
}
|
@ -74,13 +74,24 @@ skip_unless_local_localstack() {
|
|||||||
#
|
#
|
||||||
# This is need to do kubernetes test in the CI.
|
# This is need to do kubernetes test in the CI.
|
||||||
skip_unless_local_kube() {
|
skip_unless_local_kube() {
|
||||||
if [ -f ~/.kube/config ] && grep -q "user: kind-kind" ~/.kube/config &> /dev/null && grep -q "127.0.0.1" ~/.kube/config &> /dev/null; then
|
if [ -f ~/.kube/config ] && grep -q "127.0.0.1" ~/.kube/config &> /dev/null; then
|
||||||
echo "Kubernetes available"
|
echo "Kubernetes available"
|
||||||
else
|
else
|
||||||
skip "local kubernetes cluster not available"
|
skip "local kubernetes cluster not available"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if there is a local endpoint.
|
||||||
|
#
|
||||||
|
# This is necessary to do test with endpoint.
|
||||||
|
# Usage:
|
||||||
|
# skip_unless_endpoint_available "localhost:8080"
|
||||||
|
skip_unless_endpoint_available() {
|
||||||
|
local endpoint="$1"
|
||||||
|
|
||||||
|
curl "$endpoint"
|
||||||
|
}
|
||||||
|
|
||||||
# Cleanup local Localstack instances
|
# Cleanup local Localstack instances
|
||||||
setup_localstack() {
|
setup_localstack() {
|
||||||
if [ "$(curl -s http://localhost:4566)" = '{"status": "running"}' ] && \
|
if [ "$(curl -s http://localhost:4566)" = '{"status": "running"}' ] && \
|
||||||
|
@ -1,87 +1,87 @@
|
|||||||
# Instead of setup, this runs only once
|
# Instead of setup, this runs only once
|
||||||
setup_file() {
|
setup_file() {
|
||||||
load 'helpers'
|
load 'helpers'
|
||||||
|
|
||||||
setup_localstack
|
setup_localstack
|
||||||
}
|
}
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
load 'helpers'
|
load 'helpers'
|
||||||
|
|
||||||
common_setup
|
common_setup
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "cue-sanity-check" {
|
@test "cue-sanity-check" {
|
||||||
dagger -e sanity-check up
|
dagger -e sanity-check up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "os" {
|
@test "os" {
|
||||||
dagger -e os up
|
dagger -e os up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "go" {
|
@test "go" {
|
||||||
dagger -e go up
|
dagger -e go up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "js/yarn" {
|
@test "js/yarn" {
|
||||||
dagger -e js-yarn up
|
dagger -e js-yarn up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "java/maven" {
|
@test "java/maven" {
|
||||||
dagger -e java-maven up
|
dagger -e java-maven up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "alpine" {
|
@test "alpine" {
|
||||||
dagger -e alpine up
|
dagger -e alpine up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "netlify" {
|
@test "netlify" {
|
||||||
dagger -e netlify up
|
dagger -e netlify up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "git" {
|
@test "git" {
|
||||||
# Fetch repo
|
# Fetch repo
|
||||||
dagger -e git-repo up
|
dagger -e git-repo up
|
||||||
|
|
||||||
# Commit & push
|
# Commit & push
|
||||||
dagger -e git-commit up
|
dagger -e git-commit up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "os.#Container" {
|
@test "os.#Container" {
|
||||||
dagger -e os-container up
|
dagger -e os-container up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "aws: ecr" {
|
@test "aws: ecr" {
|
||||||
dagger -e aws-ecr up
|
dagger -e aws-ecr up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "aws: ecr/localstack" {
|
@test "aws: ecr/localstack" {
|
||||||
skip_unless_local_localstack
|
skip_unless_local_localstack
|
||||||
|
|
||||||
dagger -e aws-ecr-localstack up
|
dagger -e aws-ecr-localstack up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "aws: s3" {
|
@test "aws: s3" {
|
||||||
dagger -e aws-s3 up
|
dagger -e aws-s3 up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "aws: s3/localstack" {
|
@test "aws: s3/localstack" {
|
||||||
skip_unless_local_localstack
|
skip_unless_local_localstack
|
||||||
|
|
||||||
dagger -e aws-s3-localstack up
|
dagger -e aws-s3-localstack up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "aws: eks" {
|
@test "aws: eks" {
|
||||||
dagger -e aws-eks up
|
dagger -e aws-eks up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker run: local" {
|
@test "docker run: local" {
|
||||||
skip "Not implemented yet + missing inputs leading to failure"
|
skip "Not implemented yet + missing inputs leading to failure"
|
||||||
# dagger -e docker-run-local up
|
# dagger -e docker-run-local up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker build" {
|
@test "docker build" {
|
||||||
dagger -e docker-build up
|
dagger -e docker-build up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker push and pull" {
|
@test "docker push and pull" {
|
||||||
@ -96,7 +96,7 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "docker push: multi registry" {
|
@test "docker push: multi registry" {
|
||||||
run dagger -e docker-push-multi-registry up
|
run dagger -e docker-push-multi-registry up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker push: invalid credential" {
|
@test "docker push: invalid credential" {
|
||||||
@ -106,111 +106,140 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "docker command: ssh" {
|
@test "docker command: ssh" {
|
||||||
dagger -e docker-command-ssh up
|
dagger -e docker-command-ssh up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker command: ssh with key passphrase" {
|
@test "docker command: ssh with key passphrase" {
|
||||||
dagger -e docker-command-ssh-key-passphrase up
|
dagger -e docker-command-ssh-key-passphrase up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker command: ssh with wrong key passphrase" {
|
@test "docker command: ssh with wrong key passphrase" {
|
||||||
run dagger -e docker-command-ssh-wrong-key-passphrase up
|
run dagger -e docker-command-ssh-wrong-key-passphrase up
|
||||||
assert_failure
|
assert_failure
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker compose" {
|
@test "docker compose" {
|
||||||
dagger -e docker-compose up
|
dagger -e docker-compose up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker run: ssh" {
|
@test "docker run: ssh" {
|
||||||
dagger -e docker-run-ssh up
|
dagger -e docker-run-ssh up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "kubernetes: deployment" {
|
@test "kubernetes: deployment" {
|
||||||
skip_unless_local_kube
|
skip_unless_local_kube
|
||||||
|
|
||||||
# Copy deployment to sandbox
|
# Copy deployment to sandbox
|
||||||
copy_to_sandbox kubernetes-deployment kubernetes
|
copy_to_sandbox kubernetes-deployment kubernetes
|
||||||
|
|
||||||
# Set kubeconfig
|
# Set kubeconfig
|
||||||
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment input text TestKubeconfig -f "$HOME"/.kube/config
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment input text TestKubeconfig -f "$HOME"/.kube/config
|
||||||
|
|
||||||
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment up
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment up
|
||||||
|
|
||||||
# Unset kubeconfig
|
# Unset kubeconfig
|
||||||
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment input unset TestKubeconfig
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment input unset TestKubeconfig
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "kubernetes: kustomize" {
|
@test "kubernetes: kustomize" {
|
||||||
dagger -e kubernetes-kustomize up
|
dagger -e kubernetes-kustomize up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "kubernetes: helm" {
|
@test "kubernetes: helm" {
|
||||||
skip_unless_local_kube
|
skip_unless_local_kube
|
||||||
|
|
||||||
# Copy deployment to sandbox
|
# Copy deployment to sandbox
|
||||||
copy_to_sandbox kubernetes-helm kubernetes
|
copy_to_sandbox kubernetes-helm kubernetes
|
||||||
|
|
||||||
# Set kubeconfig
|
# Set kubeconfig
|
||||||
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm input text TestKubeconfig -f "$HOME"/.kube/config
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm input text TestKubeconfig -f "$HOME"/.kube/config
|
||||||
|
|
||||||
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm up
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm up
|
||||||
|
|
||||||
# Unset kubeconfig
|
# Unset kubeconfig
|
||||||
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm input unset TestKubeconfig
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm input unset TestKubeconfig
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "google cloud: gcr" {
|
@test "google cloud: gcr" {
|
||||||
dagger -e google-gcr up
|
dagger -e google-gcr up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "google cloud: gcs" {
|
@test "google cloud: gcs" {
|
||||||
dagger -e google-gcs up
|
dagger -e google-gcs up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "google cloud: gke" {
|
@test "google cloud: gke" {
|
||||||
dagger -e google-gke up
|
dagger -e google-gke up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "google cloud: cloudrun" {
|
@test "google cloud: cloudrun" {
|
||||||
dagger -e google-cloudrun up
|
dagger -e google-cloudrun up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "terraform" {
|
@test "terraform" {
|
||||||
# it must fail because of a missing var
|
# it must fail because of a missing var
|
||||||
run dagger -e terraform up
|
run dagger -e terraform up
|
||||||
assert_failure
|
assert_failure
|
||||||
|
|
||||||
# Copy deployment to sandbox
|
# Copy deployment to sandbox
|
||||||
copy_to_sandbox terraform terraform
|
copy_to_sandbox terraform terraform
|
||||||
|
|
||||||
# Add the var and try again
|
# Add the var and try again
|
||||||
run dagger -w "$DAGGER_SANDBOX" -e terraform input text TestTerraform.apply.tfvars.input "42"
|
run dagger -w "$DAGGER_SANDBOX" -e terraform input text TestTerraform.apply.tfvars.input "42"
|
||||||
run dagger -w "$DAGGER_SANDBOX" -e terraform up
|
run dagger -w "$DAGGER_SANDBOX" -e terraform up
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
# ensure the tfvar was passed correctly
|
# ensure the tfvar was passed correctly
|
||||||
run dagger -w "$DAGGER_SANDBOX" query -e terraform TestTerraform.apply.output.input.value -f text
|
run dagger -w "$DAGGER_SANDBOX" query -e terraform TestTerraform.apply.output.input.value -f text
|
||||||
assert_success
|
assert_success
|
||||||
assert_output "42"
|
assert_output "42"
|
||||||
|
|
||||||
# ensure the random value is always the same
|
# ensure the random value is always the same
|
||||||
# this proves we're effectively using the s3 backend
|
# this proves we're effectively using the s3 backend
|
||||||
run dagger -w "$DAGGER_SANDBOX" query -e terraform TestTerraform.apply.output.random.value -f json
|
run dagger -w "$DAGGER_SANDBOX" query -e terraform TestTerraform.apply.output.random.value -f json
|
||||||
assert_success
|
assert_success
|
||||||
assert_output "36"
|
assert_output "36"
|
||||||
|
|
||||||
# Unset input
|
# Unset input
|
||||||
run dagger -w "$DAGGER_SANDBOX" -e terraform input unset TestTerraform.apply.tfvars.input
|
run dagger -w "$DAGGER_SANDBOX" -e terraform input unset TestTerraform.apply.tfvars.input
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "azure-resourcegroup" {
|
@test "azure-resourcegroup" {
|
||||||
skip "Azure CI infra not implemented yet - manually tested and working"
|
skip "Azure CI infra not implemented yet - manually tested and working"
|
||||||
#dagger -e azure-resourcegroup up
|
#dagger -e azure-resourcegroup up
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "azure-storage" {
|
@test "azure-storage" {
|
||||||
skip "Azure CI infra not implemented yet - manually tested and working"
|
skip "Azure CI infra not implemented yet - manually tested and working"
|
||||||
#dagger -e azure-storage up
|
#dagger -e azure-storage up
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "argocd" {
|
||||||
|
skip_unless_local_kube
|
||||||
|
|
||||||
|
# Deploy argoCD infra
|
||||||
|
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 &
|
||||||
|
sleep 3 || (pkill kubectl && exit 1)
|
||||||
|
|
||||||
|
# Run test
|
||||||
|
dagger -e argocd input secret TestConfig.argocdConfig.basicAuth.password "$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d)" || (pkill kubectl && exit 1)
|
||||||
|
dagger -e argocd up || (pkill kubectl && exit 1)
|
||||||
|
dagger -e argocd input unset TestConfig.argocdConfig.basicAuth.password || (pkill kubectl && exit 1)
|
||||||
|
|
||||||
|
# Kill Pid
|
||||||
|
pgrep kubectl && pkill kubectl
|
||||||
|
|
||||||
|
# Check output
|
||||||
|
run dagger -e argocd query TestArgoCDStatus.status.outputs.health -f json
|
||||||
|
assert_success
|
||||||
|
assert_output "\"Healthy\""
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user