prepare the transition to #Plan.context
This change helps the transition between `dagger input` and `#Plan.context`. In summary, the codebase now relies on a *context* for execution with mapping to *IDs*. In the future, *context* will come from a `#Plan.context`. In the meantime, a bridge converts `dagger input` to a plan context. This allows both *old* and *new* style configurations to co-exist with the same underlying engine. - Implement `plancontext`. Context holds the execution context for a plan. Currently this includes the platform, local directories, secrets and services (e.g. unix/npipe). - Contextual data can be registered at any point. In the future, this will be done by `#Plan.context` - Migrated the `dagger input` codebase to register inputs in a `plancontext` - Migrated low-level types/operations to the *Context ID* pattern. - `dagger.#Stream` now only includes an `id` (instead of `unix` path) - `dagger.#Secret` still includes only an ID, but now it's based off `plancontext` - `op.#Local` now only includes an `id` (instead of `path`, `include`, `exclude`. Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/rs/zerolog/log"
|
||||
"go.dagger.io/dagger/plancontext"
|
||||
)
|
||||
|
||||
type Solver struct {
|
||||
@@ -27,12 +28,12 @@ type Solver struct {
|
||||
}
|
||||
|
||||
type Opts struct {
|
||||
Control *bk.Client
|
||||
Gateway bkgw.Client
|
||||
Events chan *bk.SolveStatus
|
||||
Auth *RegistryAuthProvider
|
||||
SecretsStore SecretsStore
|
||||
NoCache bool
|
||||
Control *bk.Client
|
||||
Gateway bkgw.Client
|
||||
Events chan *bk.SolveStatus
|
||||
Context *plancontext.Context
|
||||
Auth *RegistryAuthProvider
|
||||
NoCache bool
|
||||
}
|
||||
|
||||
func New(opts Opts) Solver {
|
||||
@@ -194,8 +195,8 @@ func (s Solver) Export(ctx context.Context, st llb.State, img *dockerfile2llb.Im
|
||||
Exports: []bk.ExportEntry{output},
|
||||
Session: []session.Attachable{
|
||||
s.opts.Auth,
|
||||
s.opts.SecretsStore.Secrets,
|
||||
NewDockerSocketProvider(),
|
||||
NewSecretsStoreProvider(s.opts.Context),
|
||||
NewDockerSocketProvider(s.opts.Context),
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user