Universe: docker, yarn: cue fmt

Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
This commit is contained in:
Sam Alba 2022-01-14 15:28:33 -08:00
parent c7ffdf788f
commit ce378d5095
3 changed files with 48 additions and 52 deletions

View File

@ -10,7 +10,6 @@ import (
steps: [#Step, ...#Step] steps: [#Step, ...#Step]
output: #Image output: #Image
// Generate build DAG from linerar steps // Generate build DAG from linerar steps
_dag: { _dag: {
for idx, step in steps { for idx, step in steps {

View File

@ -10,11 +10,9 @@ import (
) )
dagger.#Plan & { dagger.#Plan & {
inputs: { inputs: directories: {
directories: { testdata: path: "./testdata"
testdata: path: "./testdata" testdata2: path: "./testdata2"
testdata2: path: "./testdata2"
}
} }
actions: { actions: {
@ -24,59 +22,59 @@ dagger.#Plan & {
} }
pkg: yarn.#Build & { pkg: yarn.#Build & {
source: inputs.directories.testdata.contents source: inputs.directories.testdata.contents
"cache": cache "cache": cache
} }
_image: engine.#Pull & { _image: engine.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
} }
// FIXME: use bash.#Script // FIXME: use bash.#Script
test: engine.#Exec & { test: engine.#Exec & {
input: _image.output input: _image.output
mounts: build: { mounts: build: {
dest: "/build" dest: "/build"
contents: pkg.output contents: pkg.output
} }
args: [ args: [
"sh", "-c", "sh", "-c",
#""" #"""
test "$(cat /build/test)" = "output" test "$(cat /build/test)" = "output"
"""# """#,
] ]
} }
} }
// FIXME: re-enable? // FIXME: re-enable?
// TestSecretsAndFile: { // TestSecretsAndFile: {
// pkg: #Package & { // pkg: #Package & {
// source: inputs.directories.testdata2 // source: inputs.directories.testdata2
// writeEnvFile: "/.env" // writeEnvFile: "/.env"
// env: { // env: {
// one: "one" // one: "one"
// two: "two" // two: "two"
// } // }
// secrets: { // secrets: {
// secretone: dagger.#Secret @dagger(input) // secretone: dagger.#Secret @dagger(input)
// secretwo: dagger.#Secret @dagger(input) // secretwo: dagger.#Secret @dagger(input)
// } // }
// } // }
// test: os.#Container & { // test: os.#Container & {
// image: alpine.#Image & { // image: alpine.#Image & {
// package: bash: true // package: bash: true
// } // }
// shell: path: "/bin/bash" // shell: path: "/bin/bash"
// mount: "/build": from: pkg.build // mount: "/build": from: pkg.build
// command: """ // command: """
// content="$(cat /build/env)" // content="$(cat /build/env)"
// [[ "${content}" = *"SECRETONE="* ]] && \\ // [[ "${content}" = *"SECRETONE="* ]] && \\
// [[ "${content}" = *"SECRETWO="* ]] && \\ // [[ "${content}" = *"SECRETWO="* ]] && \\
// [[ "${content}" = *"ONE=one"* ]] && \\ // [[ "${content}" = *"ONE=one"* ]] && \\
// [[ "${content}" = *"TWO=two"* ]] // [[ "${content}" = *"TWO=two"* ]]
// """ // """
// } // }
// } // }
} }
} }

View File

@ -54,30 +54,29 @@ import (
yarnImage: docker.#Run & { yarnImage: docker.#Run & {
image: alpine.image image: alpine.image
script: """ script: """
apk add -U --no-cache bash yarn apk add -U --no-cache bash yarn
""" """
} }
// Run yarn in a containerized build environment // Run yarn in a containerized build environment
command: bash.#Run & { command: bash.#Run & {
// FIXME: not working? // FIXME: not working?
// *{ // *{
// _image: alpine.#Build & { // _image: alpine.#Build & {
// packages: { // packages: {
// bash: version: "=~5.1" // bash: version: "=~5.1"
// yarn: version: yarnVersion // yarn: version: yarnVersion
// } // }
// } // }
// image: _image.output // image: _image.output
// env: CUSTOM_IMAGE: "0" // env: CUSTOM_IMAGE: "0"
// } | { // } | {
// env: CUSTOM_IMAGE: "1" // env: CUSTOM_IMAGE: "1"
// } // }
image: docker.#Image & yarnImage.output image: docker.#Image & yarnImage.output
script: #""" script: #"""
# Create $ENVFILE_NAME file if set # Create $ENVFILE_NAME file if set
[ -n "$ENVFILE_NAME" ] && echo "$ENVFILE" > "$ENVFILE_NAME" [ -n "$ENVFILE_NAME" ] && echo "$ENVFILE" > "$ENVFILE_NAME"