mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-16 08:27:06 +08:00
protobuf: remove gogoproto
Removes gogo/protobuf from buildx and updates to a version of moby/buildkit where gogo is removed. This also changes how the proto files are generated. This is because newer versions of protobuf are more strict about name conflicts. If two files have the same name (even if they are relative paths) and are used in different protoc commands, they'll conflict in the registry. Since protobuf file generation doesn't work very well with `paths=source_relative`, this removes the `go:generate` expression and just relies on the dockerfile to perform the generation. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
@ -13,11 +13,11 @@ import (
|
||||
type ExecCmd struct {
|
||||
m types.Monitor
|
||||
|
||||
invokeConfig controllerapi.InvokeConfig
|
||||
invokeConfig *controllerapi.InvokeConfig
|
||||
stdout io.WriteCloser
|
||||
}
|
||||
|
||||
func NewExecCmd(m types.Monitor, invokeConfig controllerapi.InvokeConfig, stdout io.WriteCloser) types.Command {
|
||||
func NewExecCmd(m types.Monitor, invokeConfig *controllerapi.InvokeConfig, stdout io.WriteCloser) types.Command {
|
||||
return &ExecCmd{m, invokeConfig, stdout}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ func (cm *ExecCmd) Exec(ctx context.Context, args []string) error {
|
||||
if len(args) < 2 {
|
||||
return errors.Errorf("command must be passed")
|
||||
}
|
||||
cfg := controllerapi.InvokeConfig{
|
||||
cfg := &controllerapi.InvokeConfig{
|
||||
Entrypoint: []string{args[1]},
|
||||
Cmd: args[2:],
|
||||
NoCmd: false,
|
||||
|
@ -20,10 +20,10 @@ type ReloadCmd struct {
|
||||
progress *progress.Printer
|
||||
|
||||
options *controllerapi.BuildOptions
|
||||
invokeConfig controllerapi.InvokeConfig
|
||||
invokeConfig *controllerapi.InvokeConfig
|
||||
}
|
||||
|
||||
func NewReloadCmd(m types.Monitor, stdout io.WriteCloser, progress *progress.Printer, options *controllerapi.BuildOptions, invokeConfig controllerapi.InvokeConfig) types.Command {
|
||||
func NewReloadCmd(m types.Monitor, stdout io.WriteCloser, progress *progress.Printer, options *controllerapi.BuildOptions, invokeConfig *controllerapi.InvokeConfig) types.Command {
|
||||
return &ReloadCmd{m, stdout, progress, options, invokeConfig}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ func (cm *ReloadCmd) Exec(ctx context.Context, args []string) error {
|
||||
}
|
||||
var resultUpdated bool
|
||||
cm.progress.Unpause()
|
||||
ref, _, _, err := cm.m.Build(ctx, *bo, nil, cm.progress) // TODO: support stdin, hold build ref
|
||||
ref, _, _, err := cm.m.Build(ctx, bo, nil, cm.progress) // TODO: support stdin, hold build ref
|
||||
cm.progress.Pause()
|
||||
if err != nil {
|
||||
var be *controllererrors.BuildError
|
||||
|
@ -13,11 +13,11 @@ import (
|
||||
type RollbackCmd struct {
|
||||
m types.Monitor
|
||||
|
||||
invokeConfig controllerapi.InvokeConfig
|
||||
invokeConfig *controllerapi.InvokeConfig
|
||||
stdout io.WriteCloser
|
||||
}
|
||||
|
||||
func NewRollbackCmd(m types.Monitor, invokeConfig controllerapi.InvokeConfig, stdout io.WriteCloser) types.Command {
|
||||
func NewRollbackCmd(m types.Monitor, invokeConfig *controllerapi.InvokeConfig, stdout io.WriteCloser) types.Command {
|
||||
return &RollbackCmd{m, invokeConfig, stdout}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ type MonitorBuildResult struct {
|
||||
}
|
||||
|
||||
// RunMonitor provides an interactive session for running and managing containers via specified IO.
|
||||
func RunMonitor(ctx context.Context, curRef string, options *controllerapi.BuildOptions, invokeConfig controllerapi.InvokeConfig, c control.BuildxController, stdin io.ReadCloser, stdout io.WriteCloser, stderr console.File, progress *progress.Printer) (*MonitorBuildResult, error) {
|
||||
func RunMonitor(ctx context.Context, curRef string, options *controllerapi.BuildOptions, invokeConfig *controllerapi.InvokeConfig, c control.BuildxController, stdin io.ReadCloser, stdout io.WriteCloser, stderr console.File, progress *progress.Printer) (*MonitorBuildResult, error) {
|
||||
defer func() {
|
||||
if err := c.Disconnect(ctx, curRef); err != nil {
|
||||
logrus.Warnf("disconnect error: %v", err)
|
||||
@ -244,7 +244,7 @@ type monitor struct {
|
||||
lastBuildResult *MonitorBuildResult
|
||||
}
|
||||
|
||||
func (m *monitor) Build(ctx context.Context, options controllerapi.BuildOptions, in io.ReadCloser, progress progress.Writer) (ref string, resp *client.SolveResponse, input *build.Inputs, err error) {
|
||||
func (m *monitor) Build(ctx context.Context, options *controllerapi.BuildOptions, in io.ReadCloser, progress progress.Writer) (ref string, resp *client.SolveResponse, input *build.Inputs, err error) {
|
||||
ref, resp, _, err = m.BuildxController.Build(ctx, options, in, progress)
|
||||
m.lastBuildResult = &MonitorBuildResult{Resp: resp, Err: err} // Record build result
|
||||
return
|
||||
@ -262,19 +262,19 @@ func (m *monitor) AttachedSessionID() string {
|
||||
return m.ref.Load().(string)
|
||||
}
|
||||
|
||||
func (m *monitor) Rollback(ctx context.Context, cfg controllerapi.InvokeConfig) string {
|
||||
func (m *monitor) Rollback(ctx context.Context, cfg *controllerapi.InvokeConfig) string {
|
||||
pid := identity.NewID()
|
||||
cfg1 := cfg
|
||||
cfg1.Rollback = true
|
||||
return m.startInvoke(ctx, pid, cfg1)
|
||||
}
|
||||
|
||||
func (m *monitor) Exec(ctx context.Context, cfg controllerapi.InvokeConfig) string {
|
||||
func (m *monitor) Exec(ctx context.Context, cfg *controllerapi.InvokeConfig) string {
|
||||
return m.startInvoke(ctx, identity.NewID(), cfg)
|
||||
}
|
||||
|
||||
func (m *monitor) Attach(ctx context.Context, pid string) {
|
||||
m.startInvoke(ctx, pid, controllerapi.InvokeConfig{})
|
||||
m.startInvoke(ctx, pid, &controllerapi.InvokeConfig{})
|
||||
}
|
||||
|
||||
func (m *monitor) Detach() {
|
||||
@ -291,7 +291,7 @@ func (m *monitor) close() {
|
||||
m.Detach()
|
||||
}
|
||||
|
||||
func (m *monitor) startInvoke(ctx context.Context, pid string, cfg controllerapi.InvokeConfig) string {
|
||||
func (m *monitor) startInvoke(ctx context.Context, pid string, cfg *controllerapi.InvokeConfig) string {
|
||||
if m.invokeCancel != nil {
|
||||
m.invokeCancel() // Finish existing attach
|
||||
}
|
||||
@ -317,7 +317,7 @@ func (m *monitor) startInvoke(ctx context.Context, pid string, cfg controllerapi
|
||||
return pid
|
||||
}
|
||||
|
||||
func (m *monitor) invoke(ctx context.Context, pid string, cfg controllerapi.InvokeConfig) error {
|
||||
func (m *monitor) invoke(ctx context.Context, pid string, cfg *controllerapi.InvokeConfig) error {
|
||||
m.muxIO.Enable(1)
|
||||
defer m.muxIO.Disable(1)
|
||||
if err := m.muxIO.SwitchTo(1); err != nil {
|
||||
|
@ -12,10 +12,10 @@ type Monitor interface {
|
||||
control.BuildxController
|
||||
|
||||
// Rollback re-runs the interactive container with initial rootfs contents.
|
||||
Rollback(ctx context.Context, cfg controllerapi.InvokeConfig) string
|
||||
Rollback(ctx context.Context, cfg *controllerapi.InvokeConfig) string
|
||||
|
||||
// Rollback executes a process in the interactive container.
|
||||
Exec(ctx context.Context, cfg controllerapi.InvokeConfig) string
|
||||
Exec(ctx context.Context, cfg *controllerapi.InvokeConfig) string
|
||||
|
||||
// Attach attaches IO to a process in the container.
|
||||
Attach(ctx context.Context, pid string)
|
||||
@ -50,7 +50,6 @@ type CommandInfo struct {
|
||||
|
||||
// Command represents a command for debugging.
|
||||
type Command interface {
|
||||
|
||||
// Exec executes the command.
|
||||
Exec(ctx context.Context, args []string) error
|
||||
|
||||
|
Reference in New Issue
Block a user