engine: task naming consistency
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
3e5ce6df26
commit
d82baa4c2d
@ -11,13 +11,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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 {
|
var dir struct {
|
||||||
Path string
|
Path string
|
||||||
Include []string
|
Include []string
|
@ -12,13 +12,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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)
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
var secretEnv struct {
|
var secretEnv struct {
|
@ -12,13 +12,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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 {
|
var secretExec struct {
|
||||||
Command struct {
|
Command struct {
|
||||||
Name string
|
Name string
|
@ -11,13 +11,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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)
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
var secretFile struct {
|
var secretFile struct {
|
@ -18,7 +18,7 @@ func init() {
|
|||||||
type pipelineTask struct {
|
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)
|
p := environment.NewPipeline(v, s, pctx)
|
||||||
if err := p.Run(ctx); err != nil {
|
if err := p.Run(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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 unix, npipe string
|
||||||
var stringErr error
|
var stringErr error
|
||||||
|
|
@ -35,7 +35,7 @@ package engine
|
|||||||
|
|
||||||
_#inputDirectory: {
|
_#inputDirectory: {
|
||||||
// FIXME: rename to "InputDirectory" for consistency
|
// FIXME: rename to "InputDirectory" for consistency
|
||||||
$dagger: task: _name: "LocalDirectory"
|
$dagger: task: _name: "InputDirectory"
|
||||||
|
|
||||||
// Import from this path ON THE CLIENT MACHINE
|
// Import from this path ON THE CLIENT MACHINE
|
||||||
// Example: "/Users/Alice/dev/todoapp/src"
|
// Example: "/Users/Alice/dev/todoapp/src"
|
||||||
@ -56,29 +56,44 @@ _#inputDirectory: {
|
|||||||
|
|
||||||
// Securely receive a secret from the client
|
// Securely receive a secret from the client
|
||||||
_#inputSecret: {
|
_#inputSecret: {
|
||||||
|
_#inputSecretEnv | _#inputSecretFile | _#inputSecretExec
|
||||||
|
|
||||||
// Reference to the secret contents
|
// Reference to the secret contents
|
||||||
// Use this by securely mounting it into a container.
|
// Use this by securely mounting it into a container.
|
||||||
// See universe.dagger.io/docker.#Run.mounts
|
// See universe.dagger.io/docker.#Run.mounts
|
||||||
// FIXME: `contents` field name causes confusion (not actually the secret contents..)
|
// FIXME: `contents` field name causes confusion (not actually the secret contents..)
|
||||||
contents: #Secret
|
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
|
// Read secret from an environment variable ON THE CLIENT MACHINE
|
||||||
$dagger: task: _name: "SecretEnv"
|
_#inputSecretEnv: {
|
||||||
|
$dagger: task: _name: "InputSecretEnv"
|
||||||
|
|
||||||
envvar: string
|
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
|
// Get secret by executing a command ON THE CLIENT MACHINE
|
||||||
$dagger: task: _name: "SecretExec"
|
_#inputSecretExec: {
|
||||||
|
$dagger: task: _name: "InputSecretExec"
|
||||||
|
|
||||||
command: {
|
command: {
|
||||||
name: string
|
name: string
|
||||||
args: [...string]
|
args: [...string]
|
||||||
interactive: true | *false @dagger(notimplemented) // FIXME: https://github.com/dagger/dagger/issues/1268
|
interactive: true | *false @dagger(notimplemented) // FIXME: https://github.com/dagger/dagger/issues/1268
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
contents: #Secret
|
||||||
}
|
}
|
||||||
|
|
||||||
_#outputDirectory: {
|
_#outputDirectory: {
|
||||||
@ -94,9 +109,10 @@ _#outputDirectory: {
|
|||||||
|
|
||||||
// Forward a network endpoint to and from the client
|
// Forward a network endpoint to and from the client
|
||||||
_#proxyEndpoint: {
|
_#proxyEndpoint: {
|
||||||
|
$dagger: task: _name: "ProxyEndpoint"
|
||||||
|
|
||||||
// Service endpoint can be proxied to action containers as unix sockets
|
// Service endpoint can be proxied to action containers as unix sockets
|
||||||
// FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
|
// FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
|
||||||
$dagger: task: _name: "Service"
|
|
||||||
// FIXME: should be endpoint
|
// FIXME: should be endpoint
|
||||||
service: #Service
|
service: #Service
|
||||||
endpoint: service
|
endpoint: service
|
||||||
|
Reference in New Issue
Block a user