Adding support for azure storage
Signed-off-by: Sujay Pillai <sujayopillai@gmail.com>
This commit is contained in:
parent
1e7c3cbc15
commit
7481294a8c
@ -11,6 +11,7 @@
|
|||||||
- [aws/s3](./aws/s3.md) - AWS Simple Storage Service
|
- [aws/s3](./aws/s3.md) - AWS Simple Storage Service
|
||||||
- [azure](./azure/README.md) - Azure base package
|
- [azure](./azure/README.md) - Azure base package
|
||||||
- [azure/resourcegroup](./azure/resourcegroup.md) - -
|
- [azure/resourcegroup](./azure/resourcegroup.md) - -
|
||||||
|
- [azure/storage](./azure/storage.md) - -
|
||||||
- [dagger](./dagger/README.md) - Dagger core types
|
- [dagger](./dagger/README.md) - Dagger core types
|
||||||
- [dagger/op](./dagger/op.md) - op: low-level operations for Dagger processing pipelines
|
- [dagger/op](./dagger/op.md) - op: low-level operations for Dagger processing pipelines
|
||||||
- [docker](./docker/README.md) - Docker container operations
|
- [docker](./docker/README.md) - Docker container operations
|
||||||
|
43
docs/reference/universe/azure/storage.md
Normal file
43
docs/reference/universe/azure/storage.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: storage
|
||||||
|
---
|
||||||
|
|
||||||
|
# alpha.dagger.io/azure/storage
|
||||||
|
|
||||||
|
```cue
|
||||||
|
import "alpha.dagger.io/azure/storage"
|
||||||
|
```
|
||||||
|
|
||||||
|
## storage.#StorageAccount
|
||||||
|
|
||||||
|
Create a storage account
|
||||||
|
|
||||||
|
### storage.#StorageAccount 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 |
|
||||||
|
|*stLocation* | `string` |StorageAccount location |
|
||||||
|
|*stName* | `string` |StorageAccount name |
|
||||||
|
|*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:2.27.1@sha256:1e117183100c9fce099ebdc189d73e506e7b02d2b73d767d3fc07caee72f9fb1"` |Remote ref (example: "index.docker.io/alpine:latest") |
|
||||||
|
|*ctr.image.secret."/run/secrets/appId"* | `dagger.#Secret` |- |
|
||||||
|
|*ctr.image.secret."/run/secrets/password"* | `dagger.#Secret` |- |
|
||||||
|
|*ctr.image.secret."/run/secrets/tenantId"* | `dagger.#Secret` |- |
|
||||||
|
|*ctr.image.secret."/run/secrets/subscriptionId"* | `dagger.#Secret` |- |
|
||||||
|
|*ctr.env.AZURE_DEFAULTS_GROUP* | `string` |- |
|
||||||
|
|*ctr.env.AZURE_DEFAULTS_LOCATION* | `string` |- |
|
||||||
|
|*ctr.env.AZURE_STORAGE_ACCOUNT* | `string` |- |
|
||||||
|
|
||||||
|
### storage.#StorageAccount Outputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ------------- |:-------------: |:-------------: |
|
||||||
|
|*id* | `string` |StorageAccount Id |
|
52
stdlib/azure/storage/st.cue
Normal file
52
stdlib/azure/storage/st.cue
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package storage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/azure"
|
||||||
|
"alpha.dagger.io/os"
|
||||||
|
"alpha.dagger.io/dagger"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a storage account
|
||||||
|
#StorageAccount: {
|
||||||
|
// Azure Config
|
||||||
|
config: azure.#Config
|
||||||
|
|
||||||
|
// ResourceGroup name
|
||||||
|
rgName: string & dagger.#Input
|
||||||
|
|
||||||
|
// StorageAccount location
|
||||||
|
stLocation: string & dagger.#Input
|
||||||
|
|
||||||
|
// StorageAccount name
|
||||||
|
stName: string & dagger.#Input
|
||||||
|
|
||||||
|
// StorageAccount Id
|
||||||
|
id: string & dagger.#Output
|
||||||
|
|
||||||
|
// Container image
|
||||||
|
ctr: os.#Container & {
|
||||||
|
image: azure.#CLI & {
|
||||||
|
"config": config
|
||||||
|
}
|
||||||
|
always: true
|
||||||
|
|
||||||
|
command: """
|
||||||
|
az storage account create -n "$AZURE_STORAGE_ACCOUNT" -g "$AZURE_DEFAULTS_GROUP" -l "$AZURE_DEFAULTS_LOCATION"
|
||||||
|
az storage account show -n "$AZURE_STORAGE_ACCOUNT" -g "$AZURE_DEFAULTS_GROUP" --query "id" -o json | jq -r . | tr -d "\n" > /storageAccountId
|
||||||
|
"""
|
||||||
|
|
||||||
|
env: {
|
||||||
|
AZURE_DEFAULTS_GROUP: rgName
|
||||||
|
AZURE_DEFAULTS_LOCATION: stLocation
|
||||||
|
AZURE_STORAGE_ACCOUNT: stName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// StorageAccount Id
|
||||||
|
id: ({
|
||||||
|
os.#File & {
|
||||||
|
from: ctr
|
||||||
|
path: "/storageAccountId"
|
||||||
|
}
|
||||||
|
}).contents
|
||||||
|
}
|
28
stdlib/azure/storage/tests/st.cue
Normal file
28
stdlib/azure/storage/tests/st.cue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package storage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/azure"
|
||||||
|
"alpha.dagger.io/azure/resourcegroup"
|
||||||
|
"alpha.dagger.io/azure/storage"
|
||||||
|
"alpha.dagger.io/random"
|
||||||
|
)
|
||||||
|
|
||||||
|
TestConfig: azureConfig: azure.#Config & {
|
||||||
|
}
|
||||||
|
|
||||||
|
TestSuffix: random.#String & {
|
||||||
|
seed: "azst"
|
||||||
|
}
|
||||||
|
|
||||||
|
TestRG: resourcegroup.#ResourceGroup & {
|
||||||
|
config: TestConfig.azureConfig
|
||||||
|
rgName: "rg-test-\(TestSuffix.out)"
|
||||||
|
rgLocation: "eastus2"
|
||||||
|
}
|
||||||
|
|
||||||
|
TestStorage: storage.#StorageAccount & {
|
||||||
|
config: TestConfig.azureConfig
|
||||||
|
rgName: "rg-test-ahkkzwyoaucw"
|
||||||
|
stLocation: "eastus2"
|
||||||
|
stName: "st\(TestSuffix.out)001"
|
||||||
|
}
|
@ -189,3 +189,8 @@ setup() {
|
|||||||
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" {
|
||||||
|
skip "Azure CI infra not implemented yet - manually tested and working"
|
||||||
|
#dagger -e azure-storage up
|
||||||
|
}
|
Reference in New Issue
Block a user