solver: allow exporters to set data to solve results
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-18.09
parent
fabec29578
commit
b80f45955a
|
@ -275,7 +275,7 @@ func (m *CacheOptions) GetImportRef() string {
|
|||
}
|
||||
|
||||
type SolveResponse struct {
|
||||
Vtx []*Vertex `protobuf:"bytes,1,rep,name=vtx" json:"vtx,omitempty"`
|
||||
ExporterResponse map[string]string `protobuf:"bytes,1,rep,name=ExporterResponse" json:"ExporterResponse,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (m *SolveResponse) Reset() { *m = SolveResponse{} }
|
||||
|
@ -283,9 +283,9 @@ func (m *SolveResponse) String() string { return proto.CompactTextStr
|
|||
func (*SolveResponse) ProtoMessage() {}
|
||||
func (*SolveResponse) Descriptor() ([]byte, []int) { return fileDescriptorControl, []int{6} }
|
||||
|
||||
func (m *SolveResponse) GetVtx() []*Vertex {
|
||||
func (m *SolveResponse) GetExporterResponse() map[string]string {
|
||||
if m != nil {
|
||||
return m.Vtx
|
||||
return m.ExporterResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -1197,16 +1197,21 @@ func (m *SolveResponse) MarshalTo(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Vtx) > 0 {
|
||||
for _, msg := range m.Vtx {
|
||||
if len(m.ExporterResponse) > 0 {
|
||||
for k, _ := range m.ExporterResponse {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintControl(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
v := m.ExporterResponse[k]
|
||||
mapSize := 1 + len(k) + sovControl(uint64(len(k))) + 1 + len(v) + sovControl(uint64(len(v)))
|
||||
i = encodeVarintControl(dAtA, i, uint64(mapSize))
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintControl(dAtA, i, uint64(len(k)))
|
||||
i += copy(dAtA[i:], k)
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintControl(dAtA, i, uint64(len(v)))
|
||||
i += copy(dAtA[i:], v)
|
||||
}
|
||||
}
|
||||
return i, nil
|
||||
|
@ -1750,10 +1755,12 @@ func (m *CacheOptions) Size() (n int) {
|
|||
func (m *SolveResponse) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Vtx) > 0 {
|
||||
for _, e := range m.Vtx {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovControl(uint64(l))
|
||||
if len(m.ExporterResponse) > 0 {
|
||||
for k, v := range m.ExporterResponse {
|
||||
_ = k
|
||||
_ = v
|
||||
mapEntrySize := 1 + len(k) + sovControl(uint64(len(k))) + 1 + len(v) + sovControl(uint64(len(v)))
|
||||
n += mapEntrySize + 1 + sovControl(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
return n
|
||||
|
@ -3038,7 +3045,7 @@ func (m *SolveResponse) Unmarshal(dAtA []byte) error {
|
|||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Vtx", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ExporterResponse", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
|
@ -3062,10 +3069,97 @@ func (m *SolveResponse) Unmarshal(dAtA []byte) error {
|
|||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Vtx = append(m.Vtx, &Vertex{})
|
||||
if err := m.Vtx[len(m.Vtx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
if m.ExporterResponse == nil {
|
||||
m.ExporterResponse = make(map[string]string)
|
||||
}
|
||||
var mapkey string
|
||||
var mapvalue string
|
||||
for iNdEx < postIndex {
|
||||
entryPreIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowControl
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
if fieldNum == 1 {
|
||||
var stringLenmapkey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowControl
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapkey |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapkey := int(stringLenmapkey)
|
||||
if intStringLenmapkey < 0 {
|
||||
return ErrInvalidLengthControl
|
||||
}
|
||||
postStringIndexmapkey := iNdEx + intStringLenmapkey
|
||||
if postStringIndexmapkey > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapkey = string(dAtA[iNdEx:postStringIndexmapkey])
|
||||
iNdEx = postStringIndexmapkey
|
||||
} else if fieldNum == 2 {
|
||||
var stringLenmapvalue uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowControl
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapvalue |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapvalue := int(stringLenmapvalue)
|
||||
if intStringLenmapvalue < 0 {
|
||||
return ErrInvalidLengthControl
|
||||
}
|
||||
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
|
||||
if postStringIndexmapvalue > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue])
|
||||
iNdEx = postStringIndexmapvalue
|
||||
} else {
|
||||
iNdEx = entryPreIndex
|
||||
skippy, err := skipControl(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthControl
|
||||
}
|
||||
if (iNdEx + skippy) > postIndex {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
m.ExporterResponse[mapkey] = mapvalue
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
@ -4538,77 +4632,78 @@ var (
|
|||
func init() { proto.RegisterFile("control.proto", fileDescriptorControl) }
|
||||
|
||||
var fileDescriptorControl = []byte{
|
||||
// 1144 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6e, 0x23, 0xc5,
|
||||
0x13, 0xff, 0x8f, 0xed, 0x8c, 0xed, 0xb2, 0x13, 0xe5, 0xdf, 0xa0, 0xd5, 0x68, 0x00, 0xc7, 0x0c,
|
||||
0x20, 0x59, 0xd1, 0xee, 0x38, 0x1b, 0x3e, 0x04, 0x41, 0x42, 0xbb, 0x8e, 0x17, 0x91, 0x28, 0x11,
|
||||
0xab, 0xc9, 0x86, 0x95, 0xb8, 0x8d, 0xed, 0xce, 0xec, 0x28, 0xe3, 0xe9, 0xa1, 0xbb, 0x27, 0x4a,
|
||||
0x78, 0x0a, 0x0e, 0x5c, 0x79, 0x0a, 0x9e, 0x80, 0x03, 0xd2, 0x1e, 0x39, 0x73, 0x08, 0x28, 0x77,
|
||||
0x78, 0x06, 0xd4, 0x1f, 0x63, 0xb7, 0x63, 0xe7, 0x73, 0x4f, 0xd3, 0xd5, 0x5d, 0xf5, 0xeb, 0xea,
|
||||
0xfa, 0xd5, 0x54, 0x15, 0x2c, 0x0f, 0x49, 0xca, 0x29, 0x49, 0xfc, 0x8c, 0x12, 0x4e, 0xd0, 0xea,
|
||||
0x98, 0x0c, 0xce, 0xfc, 0x41, 0x1e, 0x27, 0xa3, 0xe3, 0x98, 0xfb, 0x27, 0x8f, 0xdd, 0x47, 0x51,
|
||||
0xcc, 0x5f, 0xe5, 0x03, 0x7f, 0x48, 0xc6, 0xdd, 0x88, 0x44, 0xa4, 0x2b, 0x15, 0x07, 0xf9, 0x91,
|
||||
0x94, 0xa4, 0x20, 0x57, 0x0a, 0xc0, 0x5d, 0x8b, 0x08, 0x89, 0x12, 0x3c, 0xd5, 0xe2, 0xf1, 0x18,
|
||||
0x33, 0x1e, 0x8e, 0x33, 0xad, 0xf0, 0xd0, 0xc0, 0x13, 0x97, 0x75, 0x8b, 0xcb, 0xba, 0x8c, 0x24,
|
||||
0x27, 0x98, 0x76, 0xb3, 0x41, 0x97, 0x64, 0x4c, 0x69, 0x7b, 0x2b, 0xd0, 0x7c, 0x4e, 0xf3, 0x14,
|
||||
0x07, 0xf8, 0x87, 0x1c, 0x33, 0xee, 0xad, 0xc3, 0x6a, 0x3f, 0x66, 0xc7, 0x87, 0x2c, 0x8c, 0x8a,
|
||||
0x3d, 0xf4, 0x00, 0xec, 0xa3, 0x38, 0xe1, 0x98, 0x3a, 0x56, 0xdb, 0xea, 0xd4, 0x03, 0x2d, 0x79,
|
||||
0xbb, 0xf0, 0x7f, 0x43, 0x97, 0x65, 0x24, 0x65, 0x18, 0x7d, 0x0a, 0x36, 0xc5, 0x43, 0x42, 0x47,
|
||||
0x8e, 0xd5, 0x2e, 0x77, 0x1a, 0x9b, 0xef, 0xf9, 0x97, 0x5f, 0xec, 0x6b, 0x03, 0xa1, 0x14, 0x68,
|
||||
0x65, 0xef, 0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||
0xc5, 0x69, 0x2c, 0x31, 0x4a, 0xd2, 0xcd, 0x15, 0x3f, 0x1b, 0xf8, 0xd3, 0xdd, 0xc0, 0xd0, 0x40,
|
||||
0x2e, 0xd4, 0x9e, 0x9d, 0x66, 0x84, 0x0a, 0xf2, 0xcb, 0x12, 0x66, 0x22, 0xa3, 0x97, 0xb0, 0x5c,
|
||||
0xac, 0x9f, 0x72, 0x4e, 0x99, 0x53, 0x91, 0x84, 0x3f, 0x9e, 0x27, 0xdc, 0x74, 0xca, 0x9f, 0xb1,
|
||||
0x79, 0x96, 0x72, 0x7a, 0x16, 0xcc, 0xe2, 0x08, 0xae, 0x0f, 0x30, 0x63, 0xc2, 0x43, 0x45, 0x54,
|
||||
0x21, 0x0a, 0x77, 0xbe, 0xa6, 0x24, 0xe5, 0x38, 0x1d, 0x49, 0xa2, 0xea, 0xc1, 0x44, 0x16, 0xee,
|
||||
0x14, 0x6b, 0xe5, 0x4e, 0xf5, 0x56, 0xee, 0xcc, 0xd8, 0x68, 0x77, 0x66, 0xf6, 0xd0, 0x16, 0x2c,
|
||||
0x6d, 0x87, 0xc3, 0x57, 0x58, 0x72, 0xd2, 0xd8, 0x6c, 0xcd, 0x03, 0xca, 0xe3, 0x6f, 0x25, 0x09,
|
||||
0xac, 0x57, 0x11, 0xe9, 0x11, 0x28, 0x13, 0xf7, 0x09, 0xa0, 0xf9, 0xf7, 0x0a, 0x5e, 0x8e, 0xf1,
|
||||
0x59, 0xc1, 0xcb, 0x31, 0x3e, 0x13, 0x49, 0x7c, 0x12, 0x26, 0xb9, 0x4a, 0xee, 0x7a, 0xa0, 0x84,
|
||||
0xad, 0xd2, 0xe7, 0x96, 0x40, 0x98, 0x77, 0xf1, 0x2e, 0x08, 0xde, 0x2e, 0x34, 0x4d, 0x07, 0xd1,
|
||||
0xbb, 0x50, 0x57, 0x3e, 0x4d, 0x73, 0x63, 0xba, 0x21, 0x4e, 0x77, 0xc6, 0xc5, 0xa9, 0xc2, 0x9a,
|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 0xff,
|
||||
0xef, 0x36, 0x85, 0xac, 0x30, 0x40, 0x5f, 0x41, 0x7d, 0x48, 0xc6, 0x59, 0x82, 0x85, 0xb5, 0x7d,
|
||||
0x4b, 0xeb, 0xa9, 0x89, 0x48, 0x63, 0x4c, 0x29, 0xa1, 0xb2, 0x84, 0xd6, 0x03, 0x25, 0x78, 0xff,
|
||||
0x96, 0xa0, 0x69, 0x92, 0x35, 0xd7, 0x1e, 0x76, 0xc1, 0x56, 0xd4, 0xab, 0x94, 0xbd, 0x5f, 0xa8,
|
||||
0x14, 0xc2, 0xc2, 0x50, 0x39, 0x50, 0x1d, 0xe6, 0x54, 0xf6, 0x0e, 0xd5, 0x51, 0x0a, 0x51, 0x38,
|
||||
0xcc, 0x09, 0x0f, 0x13, 0x19, 0xaa, 0x72, 0xa0, 0x04, 0xd1, 0x52, 0x26, 0x7d, 0xf9, 0x6e, 0x2d,
|
||||
0x65, 0x62, 0x66, 0xd2, 0x50, 0x7d, 0x23, 0x1a, 0x6a, 0x77, 0xa6, 0xc1, 0xfb, 0xdd, 0x82, 0xfa,
|
||||
0x24, 0xcb, 0x8d, 0xe8, 0x5a, 0x6f, 0x1c, 0xdd, 0x99, 0xc8, 0x94, 0xee, 0x17, 0x99, 0x07, 0x60,
|
||||
0x33, 0x4e, 0x71, 0x38, 0x96, 0x1c, 0x95, 0x03, 0x2d, 0x89, 0x7a, 0x32, 0x66, 0x91, 0x64, 0xa8,
|
||||
0x19, 0x88, 0xa5, 0xe7, 0x41, 0xb3, 0x77, 0xc6, 0x31, 0xdb, 0xc7, 0x4c, 0x74, 0x52, 0xc1, 0xed,
|
||||
0x28, 0xe4, 0xa1, 0x7c, 0x47, 0x33, 0x90, 0x6b, 0xef, 0x21, 0xa0, 0xbd, 0x98, 0xf1, 0x97, 0x84,
|
||||
0x1e, 0x63, 0xca, 0x16, 0x0d, 0x3d, 0x65, 0x63, 0xe8, 0xd9, 0x87, 0xb7, 0x66, 0xb4, 0x75, 0x95,
|
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00, 0xff, 0xff,
|
||||
0x67, 0x51, 0xef, 0xa3, 0xc5, 0x0c, 0x00, 0x00,
|
||||
// 1162 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4b, 0x6f, 0x23, 0xc5,
|
||||
0x13, 0xff, 0x8f, 0xed, 0xf8, 0x51, 0x76, 0xa2, 0xfc, 0x1b, 0x58, 0x8d, 0x06, 0x70, 0xcc, 0x00,
|
||||
0x92, 0x15, 0xed, 0x8e, 0xb3, 0x81, 0x45, 0x90, 0x03, 0xda, 0x75, 0xbc, 0x88, 0x44, 0x89, 0x58,
|
||||
0x4d, 0x36, 0xac, 0xc4, 0x6d, 0x6c, 0x77, 0x66, 0x47, 0x19, 0x4f, 0x0f, 0xdd, 0x3d, 0xd1, 0x86,
|
||||
0x4f, 0xc1, 0x81, 0x2b, 0x9f, 0x82, 0x03, 0x67, 0x0e, 0x48, 0x7b, 0xe4, 0xcc, 0x21, 0xa0, 0xdc,
|
||||
0xe1, 0x33, 0xa0, 0x7e, 0x8c, 0xdd, 0xce, 0x38, 0xcf, 0x3d, 0xb9, 0xab, 0xe6, 0x57, 0x3f, 0xd7,
|
||||
0xab, 0xab, 0x0b, 0x96, 0x47, 0x24, 0xe1, 0x94, 0xc4, 0x5e, 0x4a, 0x09, 0x27, 0x68, 0x75, 0x42,
|
||||
0x86, 0xa7, 0xde, 0x30, 0x8b, 0xe2, 0xf1, 0x71, 0xc4, 0xbd, 0x93, 0x87, 0xce, 0x83, 0x30, 0xe2,
|
||||
0x2f, 0xb3, 0xa1, 0x37, 0x22, 0x93, 0x5e, 0x48, 0x42, 0xd2, 0x93, 0xc0, 0x61, 0x76, 0x24, 0x25,
|
||||
0x29, 0xc8, 0x93, 0x22, 0x70, 0xd6, 0x42, 0x42, 0xc2, 0x18, 0xcf, 0x50, 0x3c, 0x9a, 0x60, 0xc6,
|
||||
0x83, 0x49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0b, 0xea, 0x4c, 0xf2, 0x60, 0x66,
|
||||
0x97, 0xa4, 0x55, 0xfb, 0x32, 0x2b, 0xfd, 0x7f, 0x53, 0x3c, 0xea, 0x41, 0x25, 0x26, 0x21, 0xb3,
|
||||
0xcb, 0xd2, 0xee, 0xdd, 0xcb, 0xec, 0xf6, 0x48, 0xe8, 0x4b, 0xa0, 0x7b, 0x56, 0x82, 0xaa, 0xd2,
|
||||
0xa1, 0x5d, 0xa8, 0x8e, 0xa3, 0x10, 0x33, 0xae, 0xa2, 0xea, 0x6f, 0x8a, 0x56, 0xfc, 0xf3, 0x6c,
|
||||
0x6d, 0xdd, 0x78, 0x12, 0x48, 0x8a, 0x13, 0xf1, 0x24, 0x05, 0x51, 0x82, 0x29, 0xeb, 0x85, 0xe4,
|
||||
0x81, 0x32, 0xf1, 0x06, 0xf2, 0xc7, 0xd7, 0x0c, 0x82, 0x2b, 0x4a, 0xd2, 0x8c, 0xab, 0x08, 0xee,
|
||||
0xc8, 0xa5, 0x18, 0xc4, 0x30, 0x4e, 0x82, 0x09, 0xd6, 0x13, 0x44, 0x9e, 0xc5, 0x30, 0x1e, 0x89,
|
||||
0xae, 0x1c, 0xcb, 0x11, 0x5d, 0xf7, 0xb5, 0x84, 0xb6, 0xa0, 0xc6, 0x78, 0x40, 0x39, 0x1e, 0xcb,
|
||||
0xcb, 0x7f, 0x93, 0x29, 0x9a, 0x1b, 0xa0, 0x2f, 0xa1, 0x31, 0x22, 0x93, 0x34, 0xc6, 0xc2, 0xba,
|
||||
0x7a, 0x43, 0xeb, 0x99, 0x89, 0xe8, 0x1e, 0x4c, 0x29, 0xa1, 0x72, 0x7e, 0x37, 0x7c, 0x25, 0xb8,
|
||||
0xff, 0x96, 0xa0, 0x65, 0x16, 0xab, 0xf0, 0x36, 0xed, 0x42, 0x55, 0x95, 0x5e, 0x75, 0xdd, 0xdd,
|
||||
0x52, 0xa5, 0x18, 0x16, 0xa6, 0xca, 0x86, 0xda, 0x28, 0xa3, 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 0xe8, 0x39, 0x34, 0xa6, 0xcb, 0x26, 0x72, 0x8b,
|
||||
0x7e, 0x5c, 0xdc, 0x5a, 0x9d, 0x0f, 0xaf, 0xc4, 0xe8, 0xcc, 0x7d, 0x0d, 0x4b, 0x72, 0xfd, 0x45,
|
||||
0x0b, 0x52, 0x66, 0xee, 0xc5, 0xce, 0xd5, 0x6b, 0xec, 0x86, 0x25, 0x98, 0xe4, 0xeb, 0xb6, 0x88,
|
||||
0xc9, 0x5c, 0x38, 0x9c, 0xb5, 0x6b, 0x9e, 0x45, 0xb4, 0x0f, 0x55, 0x3d, 0x68, 0x16, 0x41, 0xcd,
|
||||
0x37, 0xcc, 0xe9, 0x5c, 0x0e, 0x50, 0x64, 0x1b, 0x16, 0xda, 0x9f, 0x6e, 0x53, 0x8b, 0x5c, 0x33,
|
||||
0x1b, 0xd4, 0xb9, 0xe6, 0x7b, 0xd7, 0xda, 0xb0, 0xd0, 0x77, 0xd0, 0x34, 0x5a, 0x10, 0x7d, 0x54,
|
||||
0x34, 0x29, 0xf6, 0xb3, 0xf3, 0xf1, 0x35, 0x28, 0xe5, 0x6c, 0xbf, 0xf5, 0xfa, 0xbc, 0x6d, 0xfd,
|
||||
0x71, 0xde, 0xb6, 0xfe, 0x3e, 0x6f, 0x5b, 0xc3, 0xaa, 0xbc, 0x91, 0x9f, 0xfc, 0x17, 0x00, 0x00,
|
||||
0xff, 0xff, 0x35, 0x72, 0x8a, 0xf1, 0x42, 0x0d, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ message CacheOptions {
|
|||
}
|
||||
|
||||
message SolveResponse {
|
||||
repeated Vertex vtx = 1;
|
||||
map<string, string> ExporterResponse = 1;
|
||||
}
|
||||
|
||||
message StatusRequest {
|
||||
|
|
|
@ -74,7 +74,7 @@ func testBuildMultiMount(t *testing.T, sb integration.Sandbox) {
|
|||
def, err := cp.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
checkAllReleasable(t, c, sb, true)
|
||||
|
@ -106,7 +106,7 @@ func testBuildHTTPSource(t *testing.T, sb integration.Sandbox) {
|
|||
def, err := st.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), "invalid response status 404")
|
||||
|
||||
|
@ -116,7 +116,7 @@ func testBuildHTTPSource(t *testing.T, sb integration.Sandbox) {
|
|||
def, err = st.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, server.Stats("/foo").AllRequests, 1)
|
||||
|
@ -126,7 +126,7 @@ func testBuildHTTPSource(t *testing.T, sb integration.Sandbox) {
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tmpdir)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterLocal,
|
||||
ExporterOutputDir: tmpdir,
|
||||
}, nil)
|
||||
|
@ -145,7 +145,7 @@ func testBuildHTTPSource(t *testing.T, sb integration.Sandbox) {
|
|||
def, err = st.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterLocal,
|
||||
ExporterOutputDir: tmpdir,
|
||||
}, nil)
|
||||
|
@ -192,7 +192,7 @@ func testResolveAndHosts(t *testing.T, sb integration.Sandbox) {
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
}, nil)
|
||||
|
@ -236,7 +236,7 @@ func testUser(t *testing.T, sb integration.Sandbox) {
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
}, nil)
|
||||
|
@ -292,7 +292,7 @@ func testOCIExporter(t *testing.T, sb integration.Sandbox) {
|
|||
require.NoError(t, err)
|
||||
target := "example.com/buildkit/testoci:latest"
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: exp,
|
||||
ExporterAttrs: map[string]string{
|
||||
"name": target,
|
||||
|
@ -389,7 +389,7 @@ func testBuildPushAndValidate(t *testing.T, sb integration.Sandbox) {
|
|||
|
||||
target := registry + "/buildkit/testpush:latest"
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterImage,
|
||||
ExporterAttrs: map[string]string{
|
||||
"name": target,
|
||||
|
@ -408,7 +408,7 @@ func testBuildPushAndValidate(t *testing.T, sb integration.Sandbox) {
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
}, nil)
|
||||
|
@ -579,7 +579,7 @@ func testDuplicateWhiteouts(t *testing.T, sb integration.Sandbox) {
|
|||
outW, err := os.Create(out)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterOCI,
|
||||
ExporterOutput: outW,
|
||||
}, nil)
|
||||
|
@ -646,7 +646,7 @@ func testWhiteoutParentDir(t *testing.T, sb integration.Sandbox) {
|
|||
out := filepath.Join(destDir, "out.tar")
|
||||
outW, err := os.Create(out)
|
||||
require.NoError(t, err)
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterOCI,
|
||||
ExporterOutput: outW,
|
||||
}, nil)
|
||||
|
@ -693,7 +693,7 @@ func testSchema1Image(t *testing.T, sb integration.Sandbox) {
|
|||
def, err := st.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
checkAllReleasable(t, c, sb, true)
|
||||
|
@ -723,7 +723,7 @@ func testMountWithNoSource(t *testing.T, sb integration.Sandbox) {
|
|||
def, err := st.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), "has no input")
|
||||
|
||||
|
@ -749,7 +749,7 @@ func testReadonlyRootFS(t *testing.T, sb integration.Sandbox) {
|
|||
def, err := st.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
|
||||
require.Error(t, err)
|
||||
// Would prefer to detect more specifically "Read-only file
|
||||
// system" but that isn't exposed here (it is on the stdio
|
||||
|
@ -904,13 +904,13 @@ func testInvalidExporter(t *testing.T, sb integration.Sandbox) {
|
|||
"name": target,
|
||||
}
|
||||
for _, exp := range []string{ExporterOCI, ExporterDocker} {
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: exp,
|
||||
ExporterAttrs: attrs,
|
||||
}, nil)
|
||||
// output file writer is required
|
||||
require.Error(t, err)
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: exp,
|
||||
ExporterAttrs: attrs,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -919,7 +919,7 @@ func testInvalidExporter(t *testing.T, sb integration.Sandbox) {
|
|||
require.Error(t, err)
|
||||
}
|
||||
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterLocal,
|
||||
ExporterAttrs: attrs,
|
||||
}, nil)
|
||||
|
@ -929,7 +929,7 @@ func testInvalidExporter(t *testing.T, sb integration.Sandbox) {
|
|||
f, err := os.Create(filepath.Join(destDir, "a"))
|
||||
require.NoError(t, err)
|
||||
defer f.Close()
|
||||
err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: ExporterLocal,
|
||||
ExporterAttrs: attrs,
|
||||
ExporterOutput: f,
|
||||
|
|
|
@ -39,3 +39,7 @@ type SolveStatus struct {
|
|||
Statuses []*VertexStatus
|
||||
Logs []*VertexLog
|
||||
}
|
||||
|
||||
type SolveResponse struct {
|
||||
ExporterResponse map[string]string
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ type SolveOpt struct {
|
|||
|
||||
// Solve calls Solve on the controller.
|
||||
// def must be nil if (and only if) opt.Frontend is set.
|
||||
func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, statusChan chan *SolveStatus) error {
|
||||
func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, statusChan chan *SolveStatus) (*SolveResponse, error) {
|
||||
defer func() {
|
||||
if statusChan != nil {
|
||||
close(statusChan)
|
||||
|
@ -45,15 +45,15 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
|
|||
}()
|
||||
|
||||
if opt.Frontend == "" && def == nil {
|
||||
return errors.New("invalid empty definition")
|
||||
return nil, errors.New("invalid empty definition")
|
||||
}
|
||||
if opt.Frontend != "" && def != nil {
|
||||
return errors.Errorf("invalid definition for frontend %s", opt.Frontend)
|
||||
return nil, errors.Errorf("invalid definition for frontend %s", opt.Frontend)
|
||||
}
|
||||
|
||||
syncedDirs, err := prepareSyncedDirs(def, opt.LocalDirs)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ref := identity.NewID()
|
||||
|
@ -68,7 +68,7 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
|
|||
|
||||
s, err := session.NewSession(statusContext, defaultSessionName(), opt.SharedKey)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to create session")
|
||||
return nil, errors.Wrap(err, "failed to create session")
|
||||
}
|
||||
|
||||
if len(syncedDirs) > 0 {
|
||||
|
@ -82,26 +82,26 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
|
|||
switch opt.Exporter {
|
||||
case ExporterLocal:
|
||||
if opt.ExporterOutput != nil {
|
||||
return errors.New("output file writer is not supported by local exporter")
|
||||
return nil, errors.New("output file writer is not supported by local exporter")
|
||||
}
|
||||
if opt.ExporterOutputDir == "" {
|
||||
return errors.New("output directory is required for local exporter")
|
||||
return nil, errors.New("output directory is required for local exporter")
|
||||
}
|
||||
s.Allow(filesync.NewFSSyncTargetDir(opt.ExporterOutputDir))
|
||||
case ExporterOCI, ExporterDocker:
|
||||
if opt.ExporterOutputDir != "" {
|
||||
return errors.Errorf("output directory %s is not supported by %s exporter", opt.ExporterOutputDir, opt.Exporter)
|
||||
return nil, errors.Errorf("output directory %s is not supported by %s exporter", opt.ExporterOutputDir, opt.Exporter)
|
||||
}
|
||||
if opt.ExporterOutput == nil {
|
||||
return errors.Errorf("output file writer is required for %s exporter", opt.Exporter)
|
||||
return nil, errors.Errorf("output file writer is required for %s exporter", opt.Exporter)
|
||||
}
|
||||
s.Allow(filesync.NewFSSyncTarget(opt.ExporterOutput))
|
||||
default:
|
||||
if opt.ExporterOutput != nil {
|
||||
return errors.Errorf("output file writer is not supported by %s exporter", opt.Exporter)
|
||||
return nil, errors.Errorf("output file writer is not supported by %s exporter", opt.Exporter)
|
||||
}
|
||||
if opt.ExporterOutputDir != "" {
|
||||
return errors.Errorf("output directory %s is not supported by %s exporter", opt.ExporterOutputDir, opt.Exporter)
|
||||
return nil, errors.Errorf("output directory %s is not supported by %s exporter", opt.ExporterOutputDir, opt.Exporter)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,7 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
|
|||
return s.Run(statusContext, grpchijack.Dialer(c.controlClient()))
|
||||
})
|
||||
|
||||
var res *SolveResponse
|
||||
eg.Go(func() error {
|
||||
defer func() { // make sure the Status ends cleanly on build errors
|
||||
go func() {
|
||||
|
@ -122,7 +123,7 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
|
|||
if def != nil {
|
||||
pbd = def.ToPB()
|
||||
}
|
||||
_, err = c.controlClient().Solve(ctx, &controlapi.SolveRequest{
|
||||
resp, err := c.controlClient().Solve(ctx, &controlapi.SolveRequest{
|
||||
Ref: ref,
|
||||
Definition: pbd,
|
||||
Exporter: opt.Exporter,
|
||||
|
@ -138,6 +139,9 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "failed to solve")
|
||||
}
|
||||
res = &SolveResponse{
|
||||
ExporterResponse: resp.ExporterResponse,
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
|
@ -194,7 +198,10 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
|
|||
}
|
||||
})
|
||||
|
||||
return eg.Wait()
|
||||
if err := eg.Wait(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func prepareSyncedDirs(def *llb.Definition, localDirs map[string]string) ([]filesync.SyncedDir, error) {
|
||||
|
|
|
@ -164,7 +164,14 @@ func build(clicontext *cli.Context) error {
|
|||
}
|
||||
|
||||
eg.Go(func() error {
|
||||
return c.Solve(ctx, def, solveOpt, ch)
|
||||
resp, err := c.Solve(ctx, def, solveOpt, ch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for k, v := range resp.ExporterResponse {
|
||||
logrus.Debugf("solve response: %s=%s", k, v)
|
||||
}
|
||||
return err
|
||||
})
|
||||
|
||||
eg.Go(func() error {
|
||||
|
|
|
@ -177,17 +177,20 @@ func (c *Controller) Solve(ctx context.Context, req *controlapi.SolveRequest) (*
|
|||
importCacheRef = reference.TagNameOnly(parsed).String()
|
||||
}
|
||||
|
||||
if err := c.solver.Solve(ctx, req.Ref, solver.SolveRequest{
|
||||
resp, err := c.solver.Solve(ctx, req.Ref, solver.SolveRequest{
|
||||
Frontend: frontend,
|
||||
Definition: req.Definition,
|
||||
Exporter: expi,
|
||||
FrontendOpt: req.FrontendAttrs,
|
||||
ExportCacheRef: exportCacheRef,
|
||||
ImportCacheRef: importCacheRef,
|
||||
}); err != nil {
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &controlapi.SolveResponse{}, nil
|
||||
return &controlapi.SolveResponse{
|
||||
ExporterResponse: resp.ExporterResponse,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *Controller) Status(req *controlapi.StatusRequest, stream controlapi.Control_StatusServer) error {
|
||||
|
|
|
@ -81,7 +81,8 @@ func action(clicontext *cli.Context) error {
|
|||
ch := make(chan *client.SolveStatus)
|
||||
eg, ctx := errgroup.WithContext(appcontext.Context())
|
||||
eg.Go(func() error {
|
||||
return c.Solve(ctx, nil, *solveOpt, ch)
|
||||
_, err := c.Solve(ctx, nil, *solveOpt, ch)
|
||||
return err
|
||||
})
|
||||
eg.Go(func() error {
|
||||
if c, err := console.ConsoleFromFile(os.Stderr); err == nil {
|
||||
|
|
|
@ -30,6 +30,10 @@ type imageExporter struct {
|
|||
opt Opt
|
||||
}
|
||||
|
||||
// New returns a new containerimage exporter instance that supports exporting
|
||||
// to an image store and pushing the image to registry.
|
||||
// This exporter supports following values in returned kv map:
|
||||
// - containerimage.digest - The digest of the root manifest for the image.
|
||||
func New(opt Opt) (exporter.Exporter, error) {
|
||||
im := &imageExporter{opt: opt}
|
||||
return im, nil
|
||||
|
@ -66,13 +70,13 @@ func (e *imageExporterInstance) Name() string {
|
|||
return "exporting to image"
|
||||
}
|
||||
|
||||
func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableRef, opt map[string][]byte) error {
|
||||
func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableRef, opt map[string][]byte) (map[string]string, error) {
|
||||
if config, ok := opt[exporterImageConfig]; ok {
|
||||
e.config = config
|
||||
}
|
||||
desc, err := e.opt.ImageWriter.Commit(ctx, ref, e.config)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
|
@ -90,19 +94,23 @@ func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableR
|
|||
|
||||
if _, err := e.opt.Images.Update(ctx, img); err != nil {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
return tagDone(err)
|
||||
return nil, tagDone(err)
|
||||
}
|
||||
|
||||
if _, err := e.opt.Images.Create(ctx, img); err != nil {
|
||||
return tagDone(err)
|
||||
return nil, tagDone(err)
|
||||
}
|
||||
}
|
||||
tagDone(nil)
|
||||
}
|
||||
if e.push {
|
||||
return push.Push(ctx, e.opt.SessionManager, e.opt.ImageWriter.ContentStore(), desc.Digest, e.targetName, e.insecure)
|
||||
if err := push.Push(ctx, e.opt.SessionManager, e.opt.ImageWriter.ContentStore(), desc.Digest, e.targetName, e.insecure); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
return map[string]string{
|
||||
"containerimage.digest": desc.Digest.String(),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -12,5 +12,5 @@ type Exporter interface {
|
|||
|
||||
type ExporterInstance interface {
|
||||
Name() string
|
||||
Export(context.Context, cache.ImmutableRef, map[string][]byte) error
|
||||
Export(context.Context, cache.ImmutableRef, map[string][]byte) (map[string]string, error)
|
||||
}
|
||||
|
|
|
@ -57,32 +57,35 @@ func (e *localExporterInstance) Name() string {
|
|||
return "exporting to client"
|
||||
}
|
||||
|
||||
func (e *localExporterInstance) Export(ctx context.Context, ref cache.ImmutableRef, opt map[string][]byte) error {
|
||||
func (e *localExporterInstance) Export(ctx context.Context, ref cache.ImmutableRef, opt map[string][]byte) (map[string]string, error) {
|
||||
var src string
|
||||
var err error
|
||||
if ref == nil {
|
||||
src, err = ioutil.TempDir("", "buildkit")
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
defer os.RemoveAll(src)
|
||||
} else {
|
||||
mount, err := ref.Mount(ctx, true)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lm := snapshot.LocalMounter(mount)
|
||||
|
||||
src, err = lm.Mount()
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
defer lm.Unmount()
|
||||
}
|
||||
|
||||
progress := newProgressHandler(ctx, "copying files")
|
||||
return filesync.CopyToCaller(ctx, src, e.caller, progress)
|
||||
if err := filesync.CopyToCaller(ctx, src, e.caller, progress); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func newProgressHandler(ctx context.Context, id string) func(int, bool) {
|
||||
|
|
|
@ -86,13 +86,13 @@ func (e *imageExporterInstance) Name() string {
|
|||
return "exporting to oci image format"
|
||||
}
|
||||
|
||||
func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableRef, opt map[string][]byte) error {
|
||||
func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableRef, opt map[string][]byte) (map[string]string, error) {
|
||||
if config, ok := opt[exporterImageConfig]; ok {
|
||||
e.config = config
|
||||
}
|
||||
desc, err := e.opt.ImageWriter.Commit(ctx, ref, e.config)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
e.opt.ImageWriter.ContentStore().Delete(context.TODO(), desc.Digest)
|
||||
|
@ -104,19 +104,19 @@ func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableR
|
|||
|
||||
exp, err := getExporter(e.opt.Variant, e.name)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w, err := filesync.CopyFileWriter(ctx, e.caller)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
report := oneOffProgress(ctx, "sending tarball")
|
||||
if err := exp.Export(ctx, e.opt.ImageWriter.ContentStore(), *desc, w); err != nil {
|
||||
w.Close()
|
||||
return report(err)
|
||||
return nil, report(err)
|
||||
}
|
||||
return report(w.Close())
|
||||
return nil, report(w.Close())
|
||||
}
|
||||
|
||||
func oneOffProgress(ctx context.Context, id string) func(err error) error {
|
||||
|
|
|
@ -461,7 +461,7 @@ EXPOSE 5000
|
|||
defer c.Close()
|
||||
|
||||
target := "example.com/moby/dockerfileexpansion:test"
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterImage,
|
||||
ExporterAttrs: map[string]string{
|
||||
|
@ -550,7 +550,7 @@ Dockerfile
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -688,7 +688,7 @@ USER nobody
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -709,7 +709,7 @@ USER nobody
|
|||
|
||||
// test user in exported
|
||||
target := "example.com/moby/dockerfileuser:test"
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterImage,
|
||||
ExporterAttrs: map[string]string{
|
||||
|
@ -784,7 +784,7 @@ COPY --from=base /out /
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -836,7 +836,7 @@ COPY files dest
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -881,7 +881,7 @@ COPY $FOO baz
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -933,7 +933,7 @@ COPY sub/dir1 subdest6
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -1037,7 +1037,7 @@ COPY --from=build foo bar2
|
|||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
FrontendAttrs: map[string]string{
|
||||
"context": "git://" + server.URL + "/#first",
|
||||
|
@ -1060,7 +1060,7 @@ COPY --from=build foo bar2
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
FrontendAttrs: map[string]string{
|
||||
"context": "git://" + server.URL + "/",
|
||||
|
@ -1101,7 +1101,7 @@ COPY --from=busybox /etc/passwd test
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -1136,7 +1136,7 @@ COPY --from=golang /usr/bin/go go
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -1178,7 +1178,7 @@ COPY --from=stage1 baz bax
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(destDir)
|
||||
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
Exporter: client.ExporterLocal,
|
||||
ExporterOutputDir: destDir,
|
||||
|
@ -1219,7 +1219,7 @@ LABEL foo=bar
|
|||
defer os.RemoveAll(destDir)
|
||||
|
||||
target := "example.com/moby/dockerfilelabels:test"
|
||||
err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
|
||||
Frontend: "dockerfile.v0",
|
||||
FrontendAttrs: map[string]string{
|
||||
"label:bar": "baz",
|
||||
|
@ -1310,13 +1310,13 @@ RUN echo bar > bar
|
|||
},
|
||||
}
|
||||
|
||||
err = c.Solve(context.TODO(), nil, opt, nil)
|
||||
_, err = c.Solve(context.TODO(), nil, opt, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
target2 := "example.com/moby/dockerfileids2:test"
|
||||
opt.ExporterAttrs["name"] = target2
|
||||
|
||||
err = c.Solve(context.TODO(), nil, opt, nil)
|
||||
_, err = c.Solve(context.TODO(), nil, opt, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
var cdAddress string
|
||||
|
|
|
@ -80,7 +80,7 @@ func (s *Solver) llbBridge(j *job) *llbBridge {
|
|||
return &llbBridge{job: j, Solver: s, Worker: worker}
|
||||
}
|
||||
|
||||
func (s *Solver) Solve(ctx context.Context, id string, req SolveRequest) error {
|
||||
func (s *Solver) Solve(ctx context.Context, id string, req SolveRequest) (*client.SolveResponse, error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
|
@ -90,13 +90,13 @@ func (s *Solver) Solve(ctx context.Context, id string, req SolveRequest) error {
|
|||
// TODO: multiworker. This should take union cache of all workers
|
||||
defaultWorker, err := s.workerController.GetDefault()
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
mainCache := defaultWorker.InstructionCache()
|
||||
if importRef := req.ImportCacheRef; importRef != "" {
|
||||
cache, err := s.ci.Import(ctx, importRef)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
mainCache = instructioncache.Union(mainCache, cache)
|
||||
}
|
||||
|
@ -104,13 +104,13 @@ func (s *Solver) Solve(ctx context.Context, id string, req SolveRequest) error {
|
|||
// register a build job. vertex needs to be loaded to a job to run
|
||||
ctx, j, err := s.jobs.new(ctx, id, pr, mainCache)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ref, exporterOpt, err := s.solve(ctx, j, req)
|
||||
defer j.discard()
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
|
@ -124,18 +124,20 @@ func (s *Solver) Solve(ctx context.Context, id string, req SolveRequest) error {
|
|||
var ok bool
|
||||
immutable, ok = ToImmutableRef(ref)
|
||||
if !ok {
|
||||
return errors.Errorf("invalid reference for exporting: %T", ref)
|
||||
return nil, errors.Errorf("invalid reference for exporting: %T", ref)
|
||||
}
|
||||
if err := immutable.Finalize(ctx); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
var exporterResponse map[string]string
|
||||
if exp := req.Exporter; exp != nil {
|
||||
if err := inVertexContext(ctx, exp.Name(), func(ctx context.Context) error {
|
||||
return exp.Export(ctx, immutable, exporterOpt)
|
||||
}); err != nil {
|
||||
exporterResponse, err = exp.Export(ctx, immutable, exporterOpt)
|
||||
return err
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,11 +156,13 @@ func (s *Solver) Solve(ctx context.Context, id string, req SolveRequest) error {
|
|||
// TODO: multiworker
|
||||
return s.ce.Export(ctx, records, exportName)
|
||||
}); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
return &client.SolveResponse{
|
||||
ExporterResponse: exporterResponse,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Solver) Status(ctx context.Context, id string, statusChan chan *client.SolveStatus) error {
|
||||
|
|
Loading…
Reference in New Issue