Port azure.#CLI from up
to os.#Container
+ manual testing + integrate bats test
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
parent
5908aa628e
commit
bdd6b5a56e
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
2
stdlib/.dagger/env/azure-resourcegroup/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/azure-resourcegroup/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
@ -1 +0,0 @@
|
||||
module: ""
|
@ -1,2 +0,0 @@
|
||||
# dagger universe
|
||||
alpha.dagger.io
|
17
stdlib/.dagger/env/azure-resourcegroup/rg.cue
vendored
17
stdlib/.dagger/env/azure-resourcegroup/rg.cue
vendored
@ -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"
|
||||
}
|
23
stdlib/.dagger/env/azure-resourcegroup/values.yaml
vendored
Normal file
23
stdlib/.dagger/env/azure-resourcegroup/values.yaml
vendored
Normal file
@ -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
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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: """
|
||||
|
@ -185,6 +185,7 @@ setup() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
# @test "azure-resourcegroup" {
|
||||
# dagger -e azure-resourcegroup up
|
||||
# }
|
||||
@test "azure-resourcegroup" {
|
||||
skip "Azure CI infra not implemented yet - manually tested and working"
|
||||
#dagger -e azure-resourcegroup up
|
||||
}
|
Reference in New Issue
Block a user