Adding support for azure storage
Signed-off-by: Sujay Pillai <sujayopillai@gmail.com>
This commit is contained in:
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"
|
||||
}
|
@@ -188,4 +188,9 @@ setup() {
|
||||
@test "azure-resourcegroup" {
|
||||
skip "Azure CI infra not implemented yet - manually tested and working"
|
||||
#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