Merge pull request #1479 from aluzzardi/yarn-test-cleanup

test: clean up yarn test
This commit is contained in:
Andrea Luzzardi 2022-01-21 16:52:44 -08:00 committed by GitHub
commit a6330f8167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 29 deletions

View File

@ -8,6 +8,12 @@ import (
// This may safely be called from any package
#Source: engine.#Source
// A (best effort) persistent cache dir
#CacheDir: engine.#CacheDir
// A temporary directory for command execution
#TempDir: engine.#TempDir
// Select a subdirectory from a filesystem tree
#Subdir: {
// Input tree

View File

@ -2,11 +2,9 @@ package yarn
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/yarn"
// "universe.dagger.io/alpine"
// "universe.dagger.io/bash"
"universe.dagger.io/alpine"
"universe.dagger.io/bash"
)
dagger.#Plan & {
@ -16,8 +14,7 @@ dagger.#Plan & {
}
actions: {
TestReact: {
cache: engine.#CacheDir & {
cache: dagger.#CacheDir & {
id: "yarn cache"
}
@ -26,24 +23,19 @@ dagger.#Plan & {
"cache": cache
}
_image: engine.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
_image: alpine.#Build & {
packages: bash: {}
}
// FIXME: use bash.#Script
test: engine.#Exec & {
input: _image.output
test: bash.#Run & {
image: _image.output
mounts: build: {
dest: "/build"
contents: pkg.output
}
args: [
"sh", "-c",
#"""
script: #"""
test "$(cat /build/test)" = "output"
"""#,
]
}
"""#
}
// FIXME: re-enable?

View File

@ -190,7 +190,12 @@ func (t *execTask) mountTmp(_ *plancontext.Context, dest string, _ *compiler.Val
func (t *execTask) mountCache(_ *plancontext.Context, dest string, mnt *compiler.Value) (llb.RunOption, error) {
contents := mnt.Lookup("contents")
id, err := contents.Lookup("id").String()
idValue := contents.Lookup("id")
if !idValue.IsConcrete() {
return nil, fmt.Errorf("cache %q is not set", mnt.Path().String())
}
id, err := idValue.String()
if err != nil {
return nil, err
}