Skip to content

Commit

Permalink
Rename OutputIDs to MountIDs
Browse files Browse the repository at this point in the history
Signed-off-by: Edgar Lee <edgarl@netflix.com>
  • Loading branch information
hinshun committed Nov 14, 2020
1 parent bcff7ba commit c33bcd6
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 58 deletions.
12 changes: 6 additions & 6 deletions client/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
var se *errdefs.SolveError
require.True(t, errors.As(solveErr, &se))
require.Len(t, se.InputIDs, tt.NumMounts)
require.Len(t, se.OutputIDs, tt.NumMounts)
require.Len(t, se.MountIDs, tt.NumMounts)

op := se.Solve.Op
require.NotNil(t, op)
Expand All @@ -1151,7 +1151,7 @@ func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
mounts = append(mounts, client.Mount{
Selector: mnt.Selector,
Dest: mnt.Dest,
ResultID: se.Solve.OutputIDs[i],
ResultID: se.Solve.MountIDs[i],
Readonly: mnt.Readonly,
MountType: mnt.MountType,
CacheOpt: mnt.CacheOpt,
Expand Down Expand Up @@ -1262,7 +1262,7 @@ func testClientGatewaySlowCacheExecError(t *testing.T, sb integration.Sandbox) {
require.True(t, ok)
// Slow cache errors should only have exactly one input and no outputs.
require.Len(t, se.Solve.InputIDs, 1)
require.Len(t, se.Solve.OutputIDs, 0)
require.Len(t, se.Solve.MountIDs, 0)

st := llb.Image("busybox:latest")
def, err := st.Marshal(ctx)
Expand Down Expand Up @@ -1390,7 +1390,7 @@ func testClientGatewayExecFileActionError(t *testing.T, sb integration.Sandbox)
require.Len(t, se.Solve.InputIDs, tt.NumInputs)

// There is one output for every action in the fileop that failed.
require.Len(t, se.Solve.OutputIDs, tt.NumOutputs)
require.Len(t, se.Solve.MountIDs, tt.NumOutputs)

op, ok := se.Solve.Op.Op.(*pb.Op_File)
require.True(t, ok)
Expand All @@ -1404,7 +1404,7 @@ func testClientGatewayExecFileActionError(t *testing.T, sb integration.Sandbox)
action := op.File.Actions[idx]

// The output for a file action is mapped by its index.
inputID := se.OutputIDs[idx]
inputID := se.MountIDs[idx]

var secondaryID string
if action.SecondaryInput != -1 {
Expand All @@ -1414,7 +1414,7 @@ func testClientGatewayExecFileActionError(t *testing.T, sb integration.Sandbox)
if int(action.SecondaryInput) < len(se.InputIDs) {
secondaryID = se.InputIDs[action.SecondaryInput]
} else {
secondaryID = se.OutputIDs[int(action.SecondaryInput)-len(se.InputIDs)]
secondaryID = se.MountIDs[int(action.SecondaryInput)-len(se.InputIDs)]
}
}

Expand Down
16 changes: 8 additions & 8 deletions frontend/gateway/forwarder/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,20 @@ func (c *bridgeClient) Inputs(ctx context.Context) (map[string]llb.State, error)

func (c *bridgeClient) wrapSolveError(solveErr error) error {
var (
ee *llberrdefs.ExecError
fae *llberrdefs.FileActionError
sce *solver.SlowCacheError
inputIDs []string
outputIDs []string
subject errdefs.IsSolve_Subject
ee *llberrdefs.ExecError
fae *llberrdefs.FileActionError
sce *solver.SlowCacheError
inputIDs []string
mountIDs []string
subject errdefs.IsSolve_Subject
)
if errors.As(solveErr, &ee) {
var err error
inputIDs, err = c.registerResultIDs(ee.Inputs...)
if err != nil {
return err
}
outputIDs, err = c.registerResultIDs(ee.Outputs...)
mountIDs, err = c.registerResultIDs(ee.Outputs...)
if err != nil {
return err
}
Expand All @@ -148,7 +148,7 @@ func (c *bridgeClient) wrapSolveError(solveErr error) error {
}
subject = sce.ToSubject()
}
return errdefs.WithSolveError(solveErr, subject, inputIDs, outputIDs)
return errdefs.WithSolveError(solveErr, subject, inputIDs, mountIDs)
}

func (c *bridgeClient) registerResultIDs(results ...solver.Result) (ids []string, err error) {
Expand Down
16 changes: 8 additions & 8 deletions frontend/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,20 +500,20 @@ func translateLegacySolveRequest(req *pb.SolveRequest) error {

func (lbf *llbBridgeForwarder) wrapSolveError(solveErr error) error {
var (
ee *llberrdefs.ExecError
fae *llberrdefs.FileActionError
sce *solver.SlowCacheError
inputIDs []string
outputIDs []string
subject errdefs.IsSolve_Subject
ee *llberrdefs.ExecError
fae *llberrdefs.FileActionError
sce *solver.SlowCacheError
inputIDs []string
mountIDs []string
subject errdefs.IsSolve_Subject
)
if errors.As(solveErr, &ee) {
var err error
inputIDs, err = lbf.registerResultIDs(ee.Inputs...)
if err != nil {
return err
}
outputIDs, err = lbf.registerResultIDs(ee.Outputs...)
mountIDs, err = lbf.registerResultIDs(ee.Outputs...)
if err != nil {
return err
}
Expand All @@ -529,7 +529,7 @@ func (lbf *llbBridgeForwarder) wrapSolveError(solveErr error) error {
}
subject = sce.ToSubject()
}
return errdefs.WithSolveError(solveErr, subject, inputIDs, outputIDs)
return errdefs.WithSolveError(solveErr, subject, inputIDs, mountIDs)
}

func (lbf *llbBridgeForwarder) registerResultIDs(results ...solver.Result) (ids []string, err error) {
Expand Down
54 changes: 27 additions & 27 deletions solver/errdefs/errdefs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion solver/errdefs/errdefs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ message Subrequest {

message Solve {
repeated string inputIDs = 1;
repeated string outputIDs = 2;
repeated string mountIDs = 2;
pb.Op op = 3;

oneof subject {
Expand Down
10 changes: 5 additions & 5 deletions solver/errdefs/solve.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (e *SolveError) ToProto() grpcerrors.TypedErrorProto {
return &e.Solve
}

func WithSolveError(err error, subject IsSolve_Subject, inputIDs, outputIDs []string) error {
func WithSolveError(err error, subject IsSolve_Subject, inputIDs, mountIDs []string) error {
if err == nil {
return nil
}
Expand All @@ -50,10 +50,10 @@ func WithSolveError(err error, subject IsSolve_Subject, inputIDs, outputIDs []st
return &SolveError{
Err: err,
Solve: Solve{
InputIDs: inputIDs,
OutputIDs: outputIDs,
Op: op,
Subject: subject,
InputIDs: inputIDs,
MountIDs: mountIDs,
Op: op,
Subject: subject,
},
}
}
Expand Down
6 changes: 3 additions & 3 deletions solver/llbsolver/ops/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ func (e *execOp) Exec(ctx context.Context, g session.Group, inputs []solver.Resu
}
execInputs[i] = inputs[m.Input]
}
execOutputs := make([]solver.Result, len(e.op.Mounts))
execMounts := make([]solver.Result, len(e.op.Mounts))
for i, res := range results {
execOutputs[p.OutputRefs[i].MountIndex] = res
execMounts[p.OutputRefs[i].MountIndex] = res
}
err = errdefs.WithExecError(err, execInputs, execOutputs)
err = errdefs.WithExecError(err, execInputs, execMounts)
}
}()
if err != nil {
Expand Down

0 comments on commit c33bcd6

Please sign in to comment.