From 729013ae9176c8b6bc3fadd6f49f2d936e2fce90 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Wed, 12 Jan 2022 14:00:39 -0700 Subject: [PATCH] rename engine.#Build to engine.#Dockerfile Signed-off-by: Richard Jones --- pkg/dagger.io/dagger/engine/image.cue | 5 ++--- plan/task/{build.go => dockerfile.go} | 10 +++++----- tests/tasks.bats | 6 +++--- tests/tasks/copy/cue.mod/pkg/.gitignore | 1 + tests/tasks/{build => dockerfile}/build_args.cue | 2 +- tests/tasks/{build => dockerfile}/build_auth.cue | 0 tests/tasks/{build => dockerfile}/cue.mod/module.cue | 0 .../tasks/{build => dockerfile}/cue.mod/pkg/.gitignore | 0 tests/tasks/{build => dockerfile}/dockerfile.cue | 2 +- tests/tasks/{build => dockerfile}/dockerfile_path.cue | 2 +- tests/tasks/{build => dockerfile}/image_config.cue | 2 +- .../tasks/{build => dockerfile}/inlined_dockerfile.cue | 2 +- tests/tasks/{build => dockerfile}/labels.cue | 2 +- tests/tasks/{build => dockerfile}/platform.cue | 2 +- tests/tasks/{build => dockerfile}/testdata/Dockerfile | 0 .../testdata/dockerfilepath/Dockerfile.custom | 0 tests/tasks/{build => dockerfile}/testdata/foo | 0 tests/tasks/exec/cue.mod/pkg/.gitignore | 1 + tests/tasks/mkdir/cue.mod/pkg/.gitignore | 1 + tests/tasks/pull/cue.mod/pkg/.gitignore | 1 + tests/tasks/readfile/cue.mod/pkg/.gitignore | 1 + tests/tasks/scratch/cue.mod/pkg/.gitignore | 1 + tests/tasks/writefile/cue.mod/pkg/.gitignore | 1 + 23 files changed, 24 insertions(+), 18 deletions(-) rename plan/task/{build.go => dockerfile.go} (90%) rename tests/tasks/{build => dockerfile}/build_args.cue (90%) rename tests/tasks/{build => dockerfile}/build_auth.cue (100%) rename tests/tasks/{build => dockerfile}/cue.mod/module.cue (100%) rename tests/tasks/{build => dockerfile}/cue.mod/pkg/.gitignore (100%) rename tests/tasks/{build => dockerfile}/dockerfile.cue (90%) rename tests/tasks/{build => dockerfile}/dockerfile_path.cue (91%) rename tests/tasks/{build => dockerfile}/image_config.cue (94%) rename tests/tasks/{build => dockerfile}/inlined_dockerfile.cue (98%) rename tests/tasks/{build => dockerfile}/labels.cue (92%) rename tests/tasks/{build => dockerfile}/platform.cue (92%) rename tests/tasks/{build => dockerfile}/testdata/Dockerfile (100%) rename tests/tasks/{build => dockerfile}/testdata/dockerfilepath/Dockerfile.custom (100%) rename tests/tasks/{build => dockerfile}/testdata/foo (100%) diff --git a/pkg/dagger.io/dagger/engine/image.cue b/pkg/dagger.io/dagger/engine/image.cue index 536e19b1..f0e9ac39 100644 --- a/pkg/dagger.io/dagger/engine/image.cue +++ b/pkg/dagger.io/dagger/engine/image.cue @@ -69,9 +69,8 @@ package engine } // Build a container image using buildkit -// FIXME: rename to #Dockerfile to clarify scope -#Build: { - $dagger: task: _name: "Build" +#Dockerfile: { + $dagger: task: _name: "Dockerfile" // Source directory to build source: #FS diff --git a/plan/task/build.go b/plan/task/dockerfile.go similarity index 90% rename from plan/task/build.go rename to plan/task/dockerfile.go index a7fe22f3..b7a9c3f7 100644 --- a/plan/task/build.go +++ b/plan/task/dockerfile.go @@ -22,13 +22,13 @@ import ( ) func init() { - Register("Build", func() Task { return &buildTask{} }) + Register("Dockerfile", func() Task { return &dockerfileTask{} }) } -type buildTask struct { +type dockerfileTask struct { } -func (t *buildTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { +func (t *dockerfileTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { frontend, err := v.Lookup("frontend").String() if err != nil { return nil, err @@ -42,7 +42,7 @@ func (t *buildTask) Run(ctx context.Context, pctx *plancontext.Context, s solver } } -func (t *buildTask) dockerfile(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { +func (t *dockerfileTask) dockerfile(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { lg := log.Ctx(ctx) // Read auth info @@ -144,7 +144,7 @@ func (t *buildTask) dockerfile(ctx context.Context, pctx *plancontext.Context, s }) } -func (t *buildTask) dockerBuildOpts(v *compiler.Value, pctx *plancontext.Context) (map[string]string, error) { +func (t *dockerfileTask) dockerBuildOpts(v *compiler.Value, pctx *plancontext.Context) (map[string]string, error) { opts := map[string]string{} if dockerfilePath := v.Lookup("dockerfile.path"); dockerfilePath.Exists() { diff --git a/tests/tasks.bats b/tests/tasks.bats index b7d942e9..26b3f76e 100644 --- a/tests/tasks.bats +++ b/tests/tasks.bats @@ -75,8 +75,8 @@ setup() { assert_failure } -@test "task: #Build" { - cd "$TESTDIR"/tasks/build +@test "task: #Dockerfile" { + cd "$TESTDIR"/tasks/dockerfile "$DAGGER" --europa up ./dockerfile.cue "$DAGGER" --europa up ./inlined_dockerfile.cue @@ -87,7 +87,7 @@ setup() { "$DAGGER" --europa up ./platform.cue cd "$TESTDIR" - "$DAGGER" --europa up ./tasks/build/build_auth.cue + "$DAGGER" --europa up ./tasks/dockerfile/build_auth.cue } @test "task: #Scratch" { cd "$TESTDIR"/tasks/scratch diff --git a/tests/tasks/copy/cue.mod/pkg/.gitignore b/tests/tasks/copy/cue.mod/pkg/.gitignore index 2d4dc1ae..4e3cac04 100644 --- a/tests/tasks/copy/cue.mod/pkg/.gitignore +++ b/tests/tasks/copy/cue.mod/pkg/.gitignore @@ -1,3 +1,4 @@ # generated by dagger alpha.dagger.io +dagger.io dagger.lock diff --git a/tests/tasks/build/build_args.cue b/tests/tasks/dockerfile/build_args.cue similarity index 90% rename from tests/tasks/build/build_args.cue rename to tests/tasks/dockerfile/build_args.cue index 952ff96c..7a0fa1df 100644 --- a/tests/tasks/build/build_args.cue +++ b/tests/tasks/dockerfile/build_args.cue @@ -7,7 +7,7 @@ import ( engine.#Plan & { inputs: directories: testdata: path: "./testdata" - actions: build: engine.#Build & { + actions: build: engine.#Dockerfile & { source: inputs.directories.testdata.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/build/build_auth.cue b/tests/tasks/dockerfile/build_auth.cue similarity index 100% rename from tests/tasks/build/build_auth.cue rename to tests/tasks/dockerfile/build_auth.cue diff --git a/tests/tasks/build/cue.mod/module.cue b/tests/tasks/dockerfile/cue.mod/module.cue similarity index 100% rename from tests/tasks/build/cue.mod/module.cue rename to tests/tasks/dockerfile/cue.mod/module.cue diff --git a/tests/tasks/build/cue.mod/pkg/.gitignore b/tests/tasks/dockerfile/cue.mod/pkg/.gitignore similarity index 100% rename from tests/tasks/build/cue.mod/pkg/.gitignore rename to tests/tasks/dockerfile/cue.mod/pkg/.gitignore diff --git a/tests/tasks/build/dockerfile.cue b/tests/tasks/dockerfile/dockerfile.cue similarity index 90% rename from tests/tasks/build/dockerfile.cue rename to tests/tasks/dockerfile/dockerfile.cue index 43d47457..cdaa6cf9 100644 --- a/tests/tasks/build/dockerfile.cue +++ b/tests/tasks/dockerfile/dockerfile.cue @@ -8,7 +8,7 @@ engine.#Plan & { inputs: directories: testdata: path: "./testdata" actions: { - build: engine.#Build & { + build: engine.#Dockerfile & { source: inputs.directories.testdata.contents } diff --git a/tests/tasks/build/dockerfile_path.cue b/tests/tasks/dockerfile/dockerfile_path.cue similarity index 91% rename from tests/tasks/build/dockerfile_path.cue rename to tests/tasks/dockerfile/dockerfile_path.cue index dcd5add4..c15a12fc 100644 --- a/tests/tasks/build/dockerfile_path.cue +++ b/tests/tasks/dockerfile/dockerfile_path.cue @@ -8,7 +8,7 @@ engine.#Plan & { inputs: directories: testdata: path: "./testdata" actions: { - build: engine.#Build & { + build: engine.#Dockerfile & { source: inputs.directories.testdata.contents dockerfile: path: "./dockerfilepath/Dockerfile.custom" } diff --git a/tests/tasks/build/image_config.cue b/tests/tasks/dockerfile/image_config.cue similarity index 94% rename from tests/tasks/build/image_config.cue rename to tests/tasks/dockerfile/image_config.cue index b163d44e..a9d399ad 100644 --- a/tests/tasks/build/image_config.cue +++ b/tests/tasks/dockerfile/image_config.cue @@ -9,7 +9,7 @@ engine.#Plan & { actions: { // FIXME: this doesn't test anything beside not crashing - build: engine.#Build & { + build: engine.#Dockerfile & { source: inputs.directories.testdata.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/build/inlined_dockerfile.cue b/tests/tasks/dockerfile/inlined_dockerfile.cue similarity index 98% rename from tests/tasks/build/inlined_dockerfile.cue rename to tests/tasks/dockerfile/inlined_dockerfile.cue index 5d3a5370..c14771fc 100644 --- a/tests/tasks/build/inlined_dockerfile.cue +++ b/tests/tasks/dockerfile/inlined_dockerfile.cue @@ -8,7 +8,7 @@ engine.#Plan & { inputs: directories: testdata: path: "./testdata" actions: { - build: engine.#Build & { + build: engine.#Dockerfile & { source: inputs.directories.testdata.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/build/labels.cue b/tests/tasks/dockerfile/labels.cue similarity index 92% rename from tests/tasks/build/labels.cue rename to tests/tasks/dockerfile/labels.cue index 9e74cb57..403314f9 100644 --- a/tests/tasks/build/labels.cue +++ b/tests/tasks/dockerfile/labels.cue @@ -9,7 +9,7 @@ engine.#Plan & { actions: { // FIXME: this doesn't test anything beside not crashing - build: engine.#Build & { + build: engine.#Dockerfile & { source: inputs.directories.testdata.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/build/platform.cue b/tests/tasks/dockerfile/platform.cue similarity index 92% rename from tests/tasks/build/platform.cue rename to tests/tasks/dockerfile/platform.cue index 8b28c174..eeddcb38 100644 --- a/tests/tasks/build/platform.cue +++ b/tests/tasks/dockerfile/platform.cue @@ -9,7 +9,7 @@ engine.#Plan & { actions: { // FIXME: this doesn't test anything beside not crashing - build: engine.#Build & { + build: engine.#Dockerfile & { source: inputs.directories.testdata.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/build/testdata/Dockerfile b/tests/tasks/dockerfile/testdata/Dockerfile similarity index 100% rename from tests/tasks/build/testdata/Dockerfile rename to tests/tasks/dockerfile/testdata/Dockerfile diff --git a/tests/tasks/build/testdata/dockerfilepath/Dockerfile.custom b/tests/tasks/dockerfile/testdata/dockerfilepath/Dockerfile.custom similarity index 100% rename from tests/tasks/build/testdata/dockerfilepath/Dockerfile.custom rename to tests/tasks/dockerfile/testdata/dockerfilepath/Dockerfile.custom diff --git a/tests/tasks/build/testdata/foo b/tests/tasks/dockerfile/testdata/foo similarity index 100% rename from tests/tasks/build/testdata/foo rename to tests/tasks/dockerfile/testdata/foo diff --git a/tests/tasks/exec/cue.mod/pkg/.gitignore b/tests/tasks/exec/cue.mod/pkg/.gitignore index 2d4dc1ae..4e3cac04 100644 --- a/tests/tasks/exec/cue.mod/pkg/.gitignore +++ b/tests/tasks/exec/cue.mod/pkg/.gitignore @@ -1,3 +1,4 @@ # generated by dagger alpha.dagger.io +dagger.io dagger.lock diff --git a/tests/tasks/mkdir/cue.mod/pkg/.gitignore b/tests/tasks/mkdir/cue.mod/pkg/.gitignore index 2d4dc1ae..4e3cac04 100644 --- a/tests/tasks/mkdir/cue.mod/pkg/.gitignore +++ b/tests/tasks/mkdir/cue.mod/pkg/.gitignore @@ -1,3 +1,4 @@ # generated by dagger alpha.dagger.io +dagger.io dagger.lock diff --git a/tests/tasks/pull/cue.mod/pkg/.gitignore b/tests/tasks/pull/cue.mod/pkg/.gitignore index 2d4dc1ae..4e3cac04 100644 --- a/tests/tasks/pull/cue.mod/pkg/.gitignore +++ b/tests/tasks/pull/cue.mod/pkg/.gitignore @@ -1,3 +1,4 @@ # generated by dagger alpha.dagger.io +dagger.io dagger.lock diff --git a/tests/tasks/readfile/cue.mod/pkg/.gitignore b/tests/tasks/readfile/cue.mod/pkg/.gitignore index 2d4dc1ae..4e3cac04 100644 --- a/tests/tasks/readfile/cue.mod/pkg/.gitignore +++ b/tests/tasks/readfile/cue.mod/pkg/.gitignore @@ -1,3 +1,4 @@ # generated by dagger alpha.dagger.io +dagger.io dagger.lock diff --git a/tests/tasks/scratch/cue.mod/pkg/.gitignore b/tests/tasks/scratch/cue.mod/pkg/.gitignore index 2d4dc1ae..4e3cac04 100644 --- a/tests/tasks/scratch/cue.mod/pkg/.gitignore +++ b/tests/tasks/scratch/cue.mod/pkg/.gitignore @@ -1,3 +1,4 @@ # generated by dagger alpha.dagger.io +dagger.io dagger.lock diff --git a/tests/tasks/writefile/cue.mod/pkg/.gitignore b/tests/tasks/writefile/cue.mod/pkg/.gitignore index 2d4dc1ae..4e3cac04 100644 --- a/tests/tasks/writefile/cue.mod/pkg/.gitignore +++ b/tests/tasks/writefile/cue.mod/pkg/.gitignore @@ -1,3 +1,4 @@ # generated by dagger alpha.dagger.io +dagger.io dagger.lock