rename engine.#Build to engine.#Dockerfile

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones 2022-01-12 14:00:39 -07:00
parent ecc45543a0
commit 729013ae91
No known key found for this signature in database
GPG Key ID: CFB3A382EB166F4C
23 changed files with 24 additions and 18 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -1,3 +1,4 @@
# generated by dagger
alpha.dagger.io
dagger.io
dagger.lock

View File

@ -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

View File

@ -8,7 +8,7 @@ engine.#Plan & {
inputs: directories: testdata: path: "./testdata"
actions: {
build: engine.#Build & {
build: engine.#Dockerfile & {
source: inputs.directories.testdata.contents
}

View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,4 @@
# generated by dagger
alpha.dagger.io
dagger.io
dagger.lock

View File

@ -1,3 +1,4 @@
# generated by dagger
alpha.dagger.io
dagger.io
dagger.lock

View File

@ -1,3 +1,4 @@
# generated by dagger
alpha.dagger.io
dagger.io
dagger.lock

View File

@ -1,3 +1,4 @@
# generated by dagger
alpha.dagger.io
dagger.io
dagger.lock

View File

@ -1,3 +1,4 @@
# generated by dagger
alpha.dagger.io
dagger.io
dagger.lock

View File

@ -1,3 +1,4 @@
# generated by dagger
alpha.dagger.io
dagger.io
dagger.lock