Merge pull request #1613 from shykes/yarn-image

yarn: enable image customization
This commit is contained in:
Solomon Hykes 2022-02-13 13:20:57 -08:00 committed by GitHub
commit eee71d0382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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: #"""