cue modules: move stdlib to pkg/alpha.dagger.io

In preparation for Europa, we will vendor multiple CUE modules:

- `pkg/alpha.dagger.io`: legacy non-europa packages
- `pkg/dagger.io`: core Europa packages
- `pkg/universe.dagger.io`: Europa universe

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2022-01-11 12:40:02 -08:00
parent e5316f3a1e
commit 282759c0e5
277 changed files with 33 additions and 31 deletions

View File

@@ -0,0 +1,79 @@
package staticwebapp
import (
"alpha.dagger.io/azure"
"alpha.dagger.io/os"
"alpha.dagger.io/dagger"
)
// Create a static web app
#StaticWebApp: {
// Azure Config
config: azure.#Config
// ResourceGroup name in which to create static webapp
rgName: string & dagger.#Input
// StaticWebApp location
stappLocation: string & dagger.#Input
// StaticWebApp name
stappName: string & dagger.#Input
// GitHubRepository URL
remote: string & dagger.#Input
// GitHub Branch
ref: *"main" | string & dagger.#Input
// Location of your application code
appLocation: *"/" | string & dagger.#Input
// Location of your build artifacts
buildLocation: *"build" | string & dagger.#Input
// GitHub Personal Access Token
authToken: dagger.#Secret & dagger.#Input
// DefaultHostName generated by Azure
defaultHostName: string & dagger.#Output
// Container image
ctr: os.#Container & {
image: azure.#CLI & {
"config": config
}
always: true
command: #"""
az staticwebapp create -n "$AZURE_STATICWEBAPP_NAME" \
-g "$AZURE_DEFAULTS_GROUP" \
-l "$AZURE_DEFAULTS_LOCATION" \
-s "$GIT_URL" \
-b "$GIT_BRANCH" \
-t "$(cat /run/secrets/git_pat)" \
--app-location "$APP_LOCATION" \
--output-location "$BUILD_LOCATION" | jq -r '.defaultHostname' | tr -d "\n" > /defaultHostName
"""#
secret: "/run/secrets/git_pat": authToken
env: {
AZURE_DEFAULTS_GROUP: rgName
AZURE_DEFAULTS_LOCATION: stappLocation
AZURE_STATICWEBAPP_NAME: stappName
GIT_URL: remote
GIT_BRANCH: ref
APP_LOCATION: appLocation
BUILD_LOCATION: buildLocation
}
}
// DefaultHostName generated by Azure
defaultHostName: ({
os.#File & {
from: ctr
path: "/defaultHostName"
}
}).contents
}

View File

@@ -0,0 +1,31 @@
package staticwebapp
import (
"alpha.dagger.io/azure"
"alpha.dagger.io/azure/resourcegroup"
"alpha.dagger.io/azure/staticwebapp"
"alpha.dagger.io/random"
"strings"
)
TestConfig: azConfig: azure.#Config & {
}
TestSuffix: random.#String & {
seed: "azrg"
}
TestRG: resourcegroup.#ResourceGroup & {
config: TestConfig.azConfig
rgName: "rg-test-\(TestSuffix.out)"
rgLocation: "eastus2"
}
// rgName is obtained from above TestRG
TestSWA: staticwebapp.#StaticWebApp & {
config: TestRG.config
rgName: "\(strings.Split(TestRG.id, "/")[4])"
stappLocation: "eastus2"
stappName: "stapp-test-\(TestSuffix.out)"
remote: "https://github.com/sujaypillai/todoapp"
}