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
@ -22,6 +22,7 @@ Azure Cli to be used by all Azure packages
|
|||||||
|*config.subscriptionId* | `dagger.#Secret` |AZURE subscription id |
|
|*config.subscriptionId* | `dagger.#Secret` |AZURE subscription id |
|
||||||
|*config.appId* | `dagger.#Secret` |AZURE app id for the service principal used |
|
|*config.appId* | `dagger.#Secret` |AZURE app id for the service principal used |
|
||||||
|*config.password* | `dagger.#Secret` |AZURE password 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
|
### azure.#CLI Outputs
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ Create a resource group
|
|||||||
|*ctr.image.config.subscriptionId* | `dagger.#Secret` |AZURE subscription 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.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.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
|
### 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 (
|
import (
|
||||||
"alpha.dagger.io/dagger"
|
"alpha.dagger.io/dagger"
|
||||||
"alpha.dagger.io/dagger/op"
|
"alpha.dagger.io/docker"
|
||||||
|
"alpha.dagger.io/os"
|
||||||
)
|
)
|
||||||
|
|
||||||
//Azure Config shared by all Azure packages
|
//Azure Config shared by all Azure packages
|
||||||
@ -23,22 +24,21 @@ import (
|
|||||||
// Azure Config
|
// Azure Config
|
||||||
config: #Config
|
config: #Config
|
||||||
|
|
||||||
#up: [
|
// Container image
|
||||||
op.#FetchContainer & {
|
os.#Container & {
|
||||||
ref: "mcr.microsoft.com/azure-cli"
|
image: docker.#Pull & {
|
||||||
},
|
from: "mcr.microsoft.com/azure-cli"
|
||||||
|
}
|
||||||
|
always: true
|
||||||
|
|
||||||
op.#Exec & {
|
command: """
|
||||||
args: ["sh", "-c",
|
|
||||||
#"""
|
|
||||||
az login --service-principal -u "$(cat /run/secrets/appId)" -p "$(cat /run/secrets/password)" -t "$(cat /run/secrets/tenantId)"
|
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)"
|
az account set -s "$(cat /run/secrets/subscriptionId)"
|
||||||
"""#,
|
"""
|
||||||
]
|
|
||||||
mount: "/run/secrets/appId": secret: config.appId
|
secret: "/run/secrets/appId": config.appId
|
||||||
mount: "/run/secrets/password": secret: config.password
|
secret: "/run/secrets/password": config.password
|
||||||
mount: "/run/secrets/tenantId": secret: config.tenantId
|
secret: "/run/secrets/tenantId": config.tenantId
|
||||||
mount: "/run/secrets/subscriptionId": secret: config.subscriptionId
|
secret: "/run/secrets/subscriptionId": config.subscriptionId
|
||||||
},
|
}
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package resourcegroup
|
package resourcegroup
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"alpha.dagger.io/os"
|
|
||||||
"alpha.dagger.io/azure"
|
"alpha.dagger.io/azure"
|
||||||
|
"alpha.dagger.io/os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create a resource group
|
// Create a resource group
|
||||||
@ -21,9 +21,6 @@ import (
|
|||||||
image: azure.#CLI & {
|
image: azure.#CLI & {
|
||||||
"config": config
|
"config": config
|
||||||
}
|
}
|
||||||
// Path of the shell to execute
|
|
||||||
shell: path: "/bin/bash"
|
|
||||||
|
|
||||||
always: true
|
always: true
|
||||||
|
|
||||||
command: """
|
command: """
|
||||||
|
@ -185,6 +185,7 @@ setup() {
|
|||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
# @test "azure-resourcegroup" {
|
@test "azure-resourcegroup" {
|
||||||
|
skip "Azure CI infra not implemented yet - manually tested and working"
|
||||||
#dagger -e azure-resourcegroup up
|
#dagger -e azure-resourcegroup up
|
||||||
# }
|
}
|
Reference in New Issue
Block a user