yarn: enable image customization

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2022-02-12 07:28:11 +00:00
parent 27aa487b21
commit a6502c7947
2 changed files with 34 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/docker"
"universe.dagger.io/yarn"
)
@ -15,10 +16,15 @@ dagger.#Plan & {
actions: tests: {
// Configuration for all tests
common: {
data: inputs.directories.testdata.contents
}
// Run yarn.#Build
simple: {
build: yarn.#Build & {
source: inputs.directories.testdata.contents
source: common.data
}
verify: #AssertFile & {
@ -32,7 +38,7 @@ dagger.#Plan & {
customName: {
build: yarn.#Build & {
name: "My Build"
source: inputs.directories.testdata.contents
source: common.data
}
verify: #AssertFile & {
input: build.output
@ -40,6 +46,30 @@ dagger.#Plan & {
contents: "output\n"
}
}
// Run yarn.#Build with a custom docker image
customImage: {
buildImage: docker.#Build & {
steps: [
docker.#Pull & {
source: "alpine"
},
docker.#Run & {
command: {
name: "apk"
args: ["add", "yarn", "bash"]
}
},
]
}
image: build.output
build: yarn.#Build & {
source: common.data
container: input: buildImage.output
}
}
}
}

View File

@ -9,6 +9,7 @@ import (
"universe.dagger.io/alpine"
"universe.dagger.io/bash"
"universe.dagger.io/docker"
)
// Build a Yarn package
@ -59,7 +60,7 @@ import (
// Run yarn in a docker container
container: bash.#Run & {
input: _buildImage.output
input: *_buildImage.output | docker.#Image
// FIXME: move shell script to its own file
script: contents: #"""