diff --git a/docs/reference/universe/azure/README.md b/docs/reference/universe/azure/README.md index 5b54802d..1f2e288d 100644 --- a/docs/reference/universe/azure/README.md +++ b/docs/reference/universe/azure/README.md @@ -16,12 +16,13 @@ Azure Cli to be used by all Azure packages ### azure.#CLI Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.tenantId* | `dagger.#Secret` |AZURE tenant id | -|*config.subscriptionId* | `dagger.#Secret` |AZURE subscription id | -|*config.appId* | `dagger.#Secret` |AZURE app id for the service principal used | -|*config.password* | `dagger.#Secret` |AZURE password for the service principal used | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.tenantId* | `dagger.#Secret` |AZURE tenant id | +|*config.subscriptionId* | `dagger.#Secret` |AZURE subscription id | +|*config.appId* | `dagger.#Secret` |AZURE app id for the service principal used | +|*config.password* | `dagger.#Secret` |AZURE password for the service principal used | +|*image.from* | `"mcr.microsoft.com/azure-cli"` |Remote ref (example: "index.docker.io/alpine:latest") | ### azure.#CLI Outputs diff --git a/docs/reference/universe/azure/resourcegroup.md b/docs/reference/universe/azure/resourcegroup.md index e6a9b670..9de772be 100644 --- a/docs/reference/universe/azure/resourcegroup.md +++ b/docs/reference/universe/azure/resourcegroup.md @@ -14,18 +14,19 @@ Create a resource group ### resourcegroup.#ResourceGroup Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.tenantId* | `dagger.#Secret` |AZURE tenant id | -|*config.subscriptionId* | `dagger.#Secret` |AZURE subscription id | -|*config.appId* | `dagger.#Secret` |AZURE app id for the service principal used | -|*config.password* | `dagger.#Secret` |AZURE password for the service principal used | -|*rgName* | `string` |ResourceGroup name | -|*rgLocation* | `string` |ResourceGroup location | -|*ctr.image.config.tenantId* | `dagger.#Secret` |AZURE tenant id | -|*ctr.image.config.subscriptionId* | `dagger.#Secret` |AZURE subscription id | -|*ctr.image.config.appId* | `dagger.#Secret` |AZURE app id for the service principal used | -|*ctr.image.config.password* | `dagger.#Secret` |AZURE password for the service principal used | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.tenantId* | `dagger.#Secret` |AZURE tenant id | +|*config.subscriptionId* | `dagger.#Secret` |AZURE subscription id | +|*config.appId* | `dagger.#Secret` |AZURE app id for the service principal used | +|*config.password* | `dagger.#Secret` |AZURE password for the service principal used | +|*rgName* | `string` |ResourceGroup name | +|*rgLocation* | `string` |ResourceGroup location | +|*ctr.image.config.tenantId* | `dagger.#Secret` |AZURE tenant id | +|*ctr.image.config.subscriptionId* | `dagger.#Secret` |AZURE subscription id | +|*ctr.image.config.appId* | `dagger.#Secret` |AZURE app id for the service principal used | +|*ctr.image.config.password* | `dagger.#Secret` |AZURE password for the service principal used | +|*ctr.image.image.from* | `"mcr.microsoft.com/azure-cli"` |Remote ref (example: "index.docker.io/alpine:latest") | ### resourcegroup.#ResourceGroup Outputs diff --git a/stdlib/.dagger/env/azure-resourcegroup/.gitignore b/stdlib/.dagger/env/azure-resourcegroup/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/stdlib/.dagger/env/azure-resourcegroup/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/stdlib/.dagger/env/azure-resourcegroup/cue.mod/module.cue b/stdlib/.dagger/env/azure-resourcegroup/cue.mod/module.cue deleted file mode 100644 index f8af9cef..00000000 --- a/stdlib/.dagger/env/azure-resourcegroup/cue.mod/module.cue +++ /dev/null @@ -1 +0,0 @@ -module: "" diff --git a/stdlib/.dagger/env/azure-resourcegroup/cue.mod/pkg/.gitignore b/stdlib/.dagger/env/azure-resourcegroup/cue.mod/pkg/.gitignore deleted file mode 100644 index a572e9ee..00000000 --- a/stdlib/.dagger/env/azure-resourcegroup/cue.mod/pkg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# dagger universe -alpha.dagger.io diff --git a/stdlib/.dagger/env/azure-resourcegroup/rg.cue b/stdlib/.dagger/env/azure-resourcegroup/rg.cue deleted file mode 100644 index 86b07df6..00000000 --- a/stdlib/.dagger/env/azure-resourcegroup/rg.cue +++ /dev/null @@ -1,17 +0,0 @@ -package rg - -import ( - "alpha.dagger.io/azure" - "alpha.dagger.io/azure/resourcegroup" - "alpha.dagger.io/random" -) - -suffix: random.#String & { - seed: "azrg" -} - -rg: resourcegroup.#ResourceGroup & { - config: azure.#Config - rgName: "rg-test-\(suffix.out)" - rgLocation: "eastus2" -} diff --git a/stdlib/.dagger/env/azure-resourcegroup/values.yaml b/stdlib/.dagger/env/azure-resourcegroup/values.yaml new file mode 100644 index 00000000..8edd915a --- /dev/null +++ b/stdlib/.dagger/env/azure-resourcegroup/values.yaml @@ -0,0 +1,23 @@ +plan: + package: ./azure/resourcegroup/tests +name: azure-resourcegroup +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwcVNxbzdlRHczM3hoSlFB + OCtid2ZyNDZsMmRYeXRJM0hmY09rUWFjanpFClNjUnFXT09yb3BJMmJKNXN1MUIw + eTNIcmZKTG5YR0h6a0UxL0lIeFRBQkEKLS0tIHk4TFRYZkdmVGFWM3lWQ0pwcmx1 + TWlwSE9KTFlod21qbm5jQUdsZXVTT3cK7HMCg+rmRPy3d+uihLMPg7SvxVI7Xyr5 + Jv6BZJovEyX8PaB/dozzCwGMsGB4fALG2TRNbgskjR0LTGUgzv+yhQ== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-08-11T13:13:45Z" + mac: ENC[AES256_GCM,data:lldSGzZoJV4V56chs0Iue+gCBqvwViRY4ZeY4MajyeNBTH6i/k3YXGEZ1lI4suXLyf4BABILMQz0Y34G9oPk8cBWgPx4ZP0iCpvVa/H06xVkBVfntym7p/GWkNsOGiU3KpdGwD/0LLdjDOmL3vKbxNrpS7RvvTgQQtI4+jXtKEc=,iv:vB6P7SPT77ZOEAjTyOO6oSWRWUUWTrC4ekgT5kXvofQ=,tag:ucfzyP9V6HIfIlI8pMDROg==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 diff --git a/stdlib/azure/azure.cue b/stdlib/azure/azure.cue index 23429454..e7cffd71 100644 --- a/stdlib/azure/azure.cue +++ b/stdlib/azure/azure.cue @@ -3,7 +3,8 @@ package azure import ( "alpha.dagger.io/dagger" - "alpha.dagger.io/dagger/op" + "alpha.dagger.io/docker" + "alpha.dagger.io/os" ) //Azure Config shared by all Azure packages @@ -23,22 +24,21 @@ import ( // Azure Config config: #Config - #up: [ - op.#FetchContainer & { - ref: "mcr.microsoft.com/azure-cli" - }, + // Container image + os.#Container & { + image: docker.#Pull & { + from: "mcr.microsoft.com/azure-cli" + } + always: true - op.#Exec & { - args: ["sh", "-c", - #""" - az login --service-principal -u "$(cat /run/secrets/appId)" -p "$(cat /run/secrets/password)" -t "$(cat /run/secrets/tenantId)" - az account set -s "$(cat /run/secrets/subscriptionId)" - """#, - ] - mount: "/run/secrets/appId": secret: config.appId - mount: "/run/secrets/password": secret: config.password - mount: "/run/secrets/tenantId": secret: config.tenantId - mount: "/run/secrets/subscriptionId": secret: config.subscriptionId - }, - ] + command: """ + az login --service-principal -u "$(cat /run/secrets/appId)" -p "$(cat /run/secrets/password)" -t "$(cat /run/secrets/tenantId)" + az account set -s "$(cat /run/secrets/subscriptionId)" + """ + + secret: "/run/secrets/appId": config.appId + secret: "/run/secrets/password": config.password + secret: "/run/secrets/tenantId": config.tenantId + secret: "/run/secrets/subscriptionId": config.subscriptionId + } } diff --git a/stdlib/azure/resourcegroup/rg.cue b/stdlib/azure/resourcegroup/rg.cue index 26a3ae96..0099ca6a 100644 --- a/stdlib/azure/resourcegroup/rg.cue +++ b/stdlib/azure/resourcegroup/rg.cue @@ -1,8 +1,8 @@ package resourcegroup import ( - "alpha.dagger.io/os" "alpha.dagger.io/azure" + "alpha.dagger.io/os" ) // Create a resource group @@ -21,9 +21,6 @@ import ( image: azure.#CLI & { "config": config } - // Path of the shell to execute - shell: path: "/bin/bash" - always: true command: """ diff --git a/stdlib/universe.bats b/stdlib/universe.bats index 54de3063..02760c06 100644 --- a/stdlib/universe.bats +++ b/stdlib/universe.bats @@ -185,6 +185,7 @@ setup() { assert_success } -# @test "azure-resourcegroup" { -# dagger -e azure-resourcegroup up -# } \ No newline at end of file +@test "azure-resourcegroup" { + skip "Azure CI infra not implemented yet - manually tested and working" + #dagger -e azure-resourcegroup up +} \ No newline at end of file