Merge pull request #1290 from aluzzardi/plan-cleanup

engine: task naming consistency
This commit is contained in:
Sam Alba 2021-12-22 10:41:32 -08:00 committed by GitHub
commit 2ea6140ab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 34 deletions

View File

@ -11,13 +11,13 @@ import (
)
func init() {
Register("LocalDirectory", func() Task { return &localDirectoryTask{} })
Register("InputDirectory", func() Task { return &inputDirectoryTask{} })
}
type localDirectoryTask struct {
type inputDirectoryTask struct {
}
func (c localDirectoryTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
func (c *inputDirectoryTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
var dir struct {
Path string
Include []string

View File

@ -12,13 +12,13 @@ import (
)
func init() {
Register("SecretEnv", func() Task { return &secretEnvTask{} })
Register("InputSecretEnv", func() Task { return &inputSecretEnvTask{} })
}
type secretEnvTask struct {
type inputSecretEnvTask struct {
}
func (c secretEnvTask) Run(ctx context.Context, pctx *plancontext.Context, _ solver.Solver, v *compiler.Value) (*compiler.Value, error) {
func (c *inputSecretEnvTask) Run(ctx context.Context, pctx *plancontext.Context, _ solver.Solver, v *compiler.Value) (*compiler.Value, error) {
lg := log.Ctx(ctx)
var secretEnv struct {

View File

@ -12,13 +12,13 @@ import (
)
func init() {
Register("SecretExec", func() Task { return &secretExecTask{} })
Register("InputSecretExec", func() Task { return &inputSecretExecTask{} })
}
type secretExecTask struct {
type inputSecretExecTask struct {
}
func (c secretExecTask) Run(ctx context.Context, pctx *plancontext.Context, _ solver.Solver, v *compiler.Value) (*compiler.Value, error) {
func (c *inputSecretExecTask) Run(ctx context.Context, pctx *plancontext.Context, _ solver.Solver, v *compiler.Value) (*compiler.Value, error) {
var secretExec struct {
Command struct {
Name string

View File

@ -11,13 +11,13 @@ import (
)
func init() {
Register("SecretFile", func() Task { return &secretFileTask{} })
Register("InputSecretFile", func() Task { return &inputSecretFileTask{} })
}
type secretFileTask struct {
type inputSecretFileTask struct {
}
func (c secretFileTask) Run(ctx context.Context, pctx *plancontext.Context, _ solver.Solver, v *compiler.Value) (*compiler.Value, error) {
func (c *inputSecretFileTask) Run(ctx context.Context, pctx *plancontext.Context, _ solver.Solver, v *compiler.Value) (*compiler.Value, error) {
lg := log.Ctx(ctx)
var secretFile struct {

View File

@ -18,7 +18,7 @@ func init() {
type pipelineTask struct {
}
func (c pipelineTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
func (c *pipelineTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
p := environment.NewPipeline(v, s, pctx)
if err := p.Run(ctx); err != nil {
return nil, err

View File

@ -12,13 +12,13 @@ import (
)
func init() {
Register("Service", func() Task { return &serviceTask{} })
Register("ProxyEndpoint", func() Task { return &proxyEndpointTask{} })
}
type serviceTask struct {
type proxyEndpointTask struct {
}
func (c serviceTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
func (c *proxyEndpointTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
var unix, npipe string
var stringErr error

View File

@ -35,7 +35,7 @@ package engine
_#inputDirectory: {
// FIXME: rename to "InputDirectory" for consistency
$dagger: task: _name: "LocalDirectory"
$dagger: task: _name: "InputDirectory"
// Import from this path ON THE CLIENT MACHINE
// Example: "/Users/Alice/dev/todoapp/src"
@ -56,29 +56,44 @@ _#inputDirectory: {
// Securely receive a secret from the client
_#inputSecret: {
_#inputSecretEnv | _#inputSecretFile | _#inputSecretExec
// Reference to the secret contents
// Use this by securely mounting it into a container.
// See universe.dagger.io/docker.#Run.mounts
// FIXME: `contents` field name causes confusion (not actually the secret contents..)
contents: #Secret
}
{
// Read secret from a file ON THE CLIENT MACHINE
$dagger: task: _name: "SecretFile"
path: string
} | {
// Read secret from an environment variable ON THE CLIENT MACHINE
$dagger: task: _name: "SecretEnv"
envvar: string
} | {
// Get secret by executing a command ON THE CLIENT MACHINE
$dagger: task: _name: "SecretExec"
command: {
name: string
args: [...string]
interactive: true | *false @dagger(notimplemented) // FIXME: https://github.com/dagger/dagger/issues/1268
}
// Read secret from an environment variable ON THE CLIENT MACHINE
_#inputSecretEnv: {
$dagger: task: _name: "InputSecretEnv"
envvar: string
contents: #Secret
}
// Read secret from a file ON THE CLIENT MACHINE
_#inputSecretFile: {
$dagger: task: _name: "InputSecretFile"
path: string
contents: #Secret
}
// Get secret by executing a command ON THE CLIENT MACHINE
_#inputSecretExec: {
$dagger: task: _name: "InputSecretExec"
command: {
name: string
args: [...string]
interactive: true | *false @dagger(notimplemented) // FIXME: https://github.com/dagger/dagger/issues/1268
}
contents: #Secret
}
_#outputDirectory: {
@ -94,9 +109,10 @@ _#outputDirectory: {
// Forward a network endpoint to and from the client
_#proxyEndpoint: {
$dagger: task: _name: "ProxyEndpoint"
// Service endpoint can be proxied to action containers as unix sockets
// FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
$dagger: task: _name: "Service"
// FIXME: should be endpoint
service: #Service
endpoint: service