From eade6bfcab52bf6314dde93ee38ebf1ecfd4754e Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 5 Jul 2022 18:36:20 +0900 Subject: [PATCH] llbsolver: support pinning sources Alternative to PR 2816 ("dockerfile: support Dockerfile.pin for pinning sources") This version is implemented on the llbsolver side and agnostic to the LLB frontends. See `solver/llbsolver/ops/source.go`. See `docs/build-repro.md` for the usage. Signed-off-by: Akihiro Suda --- api/services/control/control.pb.go | 879 ++++++++++++++++--- api/services/control/control.proto | 12 + client/client_test.go | 82 ++ client/solve.go | 16 + cmd/buildctl/build.go | 19 + control/control.go | 17 +- docs/build-repro.md | 33 + solver/llbsolver/bridge.go | 8 +- solver/llbsolver/ops/source.go | 5 + solver/llbsolver/solver.go | 37 +- solver/llbsolver/vertex.go | 18 + solver/types.go | 3 + util/sourcepolicy/pinner/pinner.go | 103 +++ util/sourcepolicy/types/sourcepolicytypes.go | 14 + 14 files changed, 1098 insertions(+), 148 deletions(-) create mode 100644 util/sourcepolicy/pinner/pinner.go create mode 100644 util/sourcepolicy/types/sourcepolicytypes.go diff --git a/api/services/control/control.pb.go b/api/services/control/control.pb.go index 98208cf7a7d9f..d6ab205e5ec31 100644 --- a/api/services/control/control.pb.go +++ b/api/services/control/control.pb.go @@ -347,6 +347,7 @@ type SolveRequest struct { Cache CacheOptions `protobuf:"bytes,8,opt,name=Cache,proto3" json:"Cache"` Entitlements []github_com_moby_buildkit_util_entitlements.Entitlement `protobuf:"bytes,9,rep,name=Entitlements,proto3,customtype=github.com/moby/buildkit/util/entitlements.Entitlement" json:"Entitlements,omitempty"` FrontendInputs map[string]*pb.Definition `protobuf:"bytes,10,rep,name=FrontendInputs,proto3" json:"FrontendInputs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SourcePolicy *SourcePolicy `protobuf:"bytes,11,opt,name=SourcePolicy,proto3" json:"SourcePolicy,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -448,6 +449,13 @@ func (m *SolveRequest) GetFrontendInputs() map[string]*pb.Definition { return nil } +func (m *SolveRequest) GetSourcePolicy() *SourcePolicy { + if m != nil { + return m.SourcePolicy + } + return nil +} + type CacheOptions struct { // ExportRefDeprecated is deprecated in favor or the new Exports since BuildKit v0.4.0. // When ExportRefDeprecated is set, the solver appends @@ -1326,6 +1334,124 @@ func (m *InfoResponse) GetBuildkitVersion() *types.BuildkitVersion { return nil } +type SourcePolicy struct { + Sources []*BuildInfoSource `protobuf:"bytes,1,rep,name=Sources,proto3" json:"Sources,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourcePolicy) Reset() { *m = SourcePolicy{} } +func (m *SourcePolicy) String() string { return proto.CompactTextString(m) } +func (*SourcePolicy) ProtoMessage() {} +func (*SourcePolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_0c5120591600887d, []int{19} +} +func (m *SourcePolicy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SourcePolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SourcePolicy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SourcePolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourcePolicy.Merge(m, src) +} +func (m *SourcePolicy) XXX_Size() int { + return m.Size() +} +func (m *SourcePolicy) XXX_DiscardUnknown() { + xxx_messageInfo_SourcePolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_SourcePolicy proto.InternalMessageInfo + +func (m *SourcePolicy) GetSources() []*BuildInfoSource { + if m != nil { + return m.Sources + } + return nil +} + +type BuildInfoSource struct { + Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` + Ref string `protobuf:"bytes,2,opt,name=Ref,proto3" json:"Ref,omitempty"` + Alias string `protobuf:"bytes,3,opt,name=Alias,proto3" json:"Alias,omitempty"` + Pin string `protobuf:"bytes,4,opt,name=Pin,proto3" json:"Pin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BuildInfoSource) Reset() { *m = BuildInfoSource{} } +func (m *BuildInfoSource) String() string { return proto.CompactTextString(m) } +func (*BuildInfoSource) ProtoMessage() {} +func (*BuildInfoSource) Descriptor() ([]byte, []int) { + return fileDescriptor_0c5120591600887d, []int{20} +} +func (m *BuildInfoSource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BuildInfoSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BuildInfoSource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BuildInfoSource) XXX_Merge(src proto.Message) { + xxx_messageInfo_BuildInfoSource.Merge(m, src) +} +func (m *BuildInfoSource) XXX_Size() int { + return m.Size() +} +func (m *BuildInfoSource) XXX_DiscardUnknown() { + xxx_messageInfo_BuildInfoSource.DiscardUnknown(m) +} + +var xxx_messageInfo_BuildInfoSource proto.InternalMessageInfo + +func (m *BuildInfoSource) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *BuildInfoSource) GetRef() string { + if m != nil { + return m.Ref + } + return "" +} + +func (m *BuildInfoSource) GetAlias() string { + if m != nil { + return m.Alias + } + return "" +} + +func (m *BuildInfoSource) GetPin() string { + if m != nil { + return m.Pin + } + return "" +} + func init() { proto.RegisterType((*PruneRequest)(nil), "moby.buildkit.v1.PruneRequest") proto.RegisterType((*DiskUsageRequest)(nil), "moby.buildkit.v1.DiskUsageRequest") @@ -1352,112 +1478,119 @@ func init() { proto.RegisterType((*ListWorkersResponse)(nil), "moby.buildkit.v1.ListWorkersResponse") proto.RegisterType((*InfoRequest)(nil), "moby.buildkit.v1.InfoRequest") proto.RegisterType((*InfoResponse)(nil), "moby.buildkit.v1.InfoResponse") + proto.RegisterType((*SourcePolicy)(nil), "moby.buildkit.v1.SourcePolicy") + proto.RegisterType((*BuildInfoSource)(nil), "moby.buildkit.v1.BuildInfoSource") } func init() { proto.RegisterFile("control.proto", fileDescriptor_0c5120591600887d) } var fileDescriptor_0c5120591600887d = []byte{ - // 1597 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcb, 0x6e, 0x1c, 0x45, - 0x17, 0x4e, 0xcf, 0x7d, 0xce, 0x8c, 0xfd, 0x3b, 0x95, 0xfc, 0x51, 0xab, 0x7f, 0xfd, 0xb6, 0xd3, - 0x09, 0xc2, 0x8a, 0x92, 0x1e, 0xc7, 0x10, 0x08, 0xe6, 0xa2, 0x64, 0x3c, 0x86, 0x38, 0x8a, 0x45, - 0x52, 0xce, 0x45, 0xca, 0x02, 0xa9, 0x67, 0xa6, 0x3c, 0x6e, 0xb9, 0xa7, 0xab, 0xa9, 0xaa, 0x76, - 0x62, 0x1e, 0x80, 0x35, 0x3b, 0x1e, 0x80, 0x05, 0x2b, 0x76, 0x48, 0x3c, 0x01, 0x52, 0x96, 0xac, - 0xb3, 0x30, 0x28, 0x0f, 0x80, 0x58, 0xb2, 0x44, 0x75, 0xe9, 0x71, 0xcf, 0xcd, 0xb7, 0xb0, 0x9a, - 0x3a, 0x55, 0xe7, 0x7c, 0x7d, 0x2e, 0x5f, 0x55, 0x9d, 0x1a, 0x98, 0xe9, 0xd0, 0x48, 0x30, 0x1a, - 0x7a, 0x31, 0xa3, 0x82, 0xa2, 0xb9, 0x3e, 0x6d, 0xef, 0x7b, 0xed, 0x24, 0x08, 0xbb, 0xbb, 0x81, - 0xf0, 0x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9c, 0xa0, 0x5b, 0x50, 0x62, 0xa4, 0x43, 0x59, 0x57, 0x29, 0xd7, - 0x56, 0xfe, 0xef, 0x8d, 0xd6, 0xc6, 0x33, 0x06, 0x52, 0x09, 0x1b, 0x65, 0xf7, 0xfb, 0x3c, 0xd4, - 0x32, 0xf3, 0x68, 0x16, 0x72, 0x1b, 0x2d, 0xdb, 0x5a, 0xb4, 0x96, 0xaa, 0x38, 0xb7, 0xd1, 0x42, - 0x36, 0x94, 0x37, 0x13, 0xe1, 0xb7, 0x43, 0x62, 0x62, 0x4f, 0x45, 0x74, 0x11, 0x8a, 0x1b, 0xd1, - 0x13, 0x4e, 0x54, 0xe0, 0x15, 0xac, 0x05, 0x84, 0xa0, 0xb0, 0x15, 0x7c, 0x43, 0x74, 0x98, 0x58, - 0x8d, 0x91, 0x03, 0xa5, 0x87, 0x3e, 0x23, 0x91, 0xb0, 0x8b, 0x12, 0xb7, 0x99, 0xb3, 0x2d, 0x6c, - 0x66, 0x50, 0x13, 0xaa, 0x6b, 0x8c, 0xf8, 0x82, 0x74, 0xef, 0x0a, 0xbb, 0xb4, 0x68, 0x2d, 0xd5, - 0x56, 0x1c, 0x4f, 0x93, 0xc2, 0x4b, 0x49, 0xe1, 0x3d, 0x4e, 0x49, 0xd1, 0xac, 0xbc, 0x3a, 0x58, - 0x38, 0xf7, 0xdd, 0xef, 0x32, 0x77, 0x03, 0x33, 0x74, 0x07, 0xe0, 0x81, 0xcf, 0xc5, 0x13, 0xae, - 0x40, 0xca, 0xc7, 0x82, 0x14, 0x14, 0x40, 0xc6, 0x06, 0xcd, 0x03, 0xa8, 0x24, 0xac, 0xd1, 0x24, - 0x12, 0x76, 0x45, 0xf9, 0x9e, 0x99, 0x41, 0x8b, 0x50, 0x6b, 0x11, 0xde, 0x61, 0x41, 0xac, 0x4a, - 0x5d, 0x55, 0xe9, 0xc9, 0x4e, 0x49, 0x04, 0x9d, 0xc1, 0xc7, 0xfb, 0x31, 0xb1, 0x41, 0x29, 0x64, - 0x66, 0x64, 0x2d, 0xb7, 0x76, 0x7c, 0x46, 0xba, 0x76, 0x4d, 0xa5, 0xcb, 0x48, 0x32, 0xbf, 0x3a, - 0x13, 0xdc, 0xae, 0xab, 0x22, 0xa7, 0xa2, 0xfb, 0x43, 0x09, 0xea, 0x5b, 0x92, 0xe3, 0x29, 0x1d, - 0xe6, 0x20, 0x8f, 0xc9, 0xb6, 0xa9, 0x8d, 0x1c, 0x22, 0x0f, 0xa0, 0x45, 0xb6, 0x83, 0x28, 0x50, - 0x5e, 0xe5, 0x54, 0xe0, 0xb3, 0x5e, 0xdc, 0xf6, 0x0e, 0x67, 0x71, 0x46, 0x03, 0x39, 0x50, 0x59, - 0x7f, 0x19, 0x53, 0x26, 0x29, 0x95, 0x57, 0x30, 0x03, 0x19, 0x3d, 0x83, 0x99, 0x74, 0x7c, 0x57, - 0x08, 0x26, 0x89, 0x2a, 0x69, 0x74, 0x73, 0x9c, 0x46, 0x59, 0xa7, 0xbc, 0x21, 0x9b, 0xf5, 0x48, - 0xb0, 0x7d, 0x3c, 0x8c, 0x23, 0x23, 0xdc, 0x22, 0x9c, 0x4b, 0x0f, 0x55, 0xf9, 0x71, 0x2a, 0x4a, - 0x77, 0x3e, 0x67, 0x34, 0x12, 0x24, 0xea, 0xaa, 0xd2, 0x57, 0xf1, 0x40, 0x96, 0xee, 0xa4, 0x63, - 0xed, 0x4e, 0xf9, 0x44, 0xee, 0x0c, 0xd9, 0x18, 0x77, 0x86, 0xe6, 0xd0, 0x2a, 0x14, 0xd7, 0xfc, - 0xce, 0x0e, 0x51, 0x55, 0xae, 0xad, 0xcc, 0x8f, 0x03, 0xaa, 0xe5, 0x2f, 0x55, 0x59, 0xb9, 0xda, - 0xa8, 0xe7, 0xb0, 0x36, 0x41, 0x5f, 0x41, 0x7d, 0x3d, 0x12, 0x81, 0x08, 0x49, 0x5f, 0x55, 0xac, - 0x2a, 0x2b, 0xd6, 0x5c, 0x7d, 0x7d, 0xb0, 0xf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, 0x00, 0x00, + // 1674 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x49, 0x6f, 0x1b, 0xc9, + 0x15, 0x76, 0x73, 0xe7, 0x23, 0x25, 0xcb, 0x65, 0xc5, 0x68, 0x74, 0x10, 0x49, 0x6e, 0x3b, 0x88, + 0x60, 0xd8, 0x4d, 0x59, 0x89, 0x13, 0x47, 0x4e, 0x02, 0x9b, 0xa2, 0x12, 0xcb, 0xb1, 0x10, 0xb9, + 0xe4, 0x05, 0xf0, 0x21, 0x41, 0x93, 0x2c, 0x51, 0x0d, 0x35, 0xbb, 0x3a, 0x55, 0xd5, 0xb2, 0x99, + 0x1f, 0x90, 0x73, 0x6e, 0xf9, 0x09, 0x39, 0xe5, 0x16, 0x20, 0xbf, 0x60, 0x00, 0x1f, 0xe7, 0xec, + 0x83, 0x66, 0xe0, 0xcb, 0xdc, 0x06, 0x73, 0x9c, 0xe3, 0xa0, 0x96, 0xa6, 0x9a, 0x9b, 0x36, 0xcf, + 0x89, 0xf5, 0xaa, 0xde, 0xfb, 0xfa, 0xed, 0xf5, 0x8a, 0x30, 0xd7, 0xa1, 0x91, 0x60, 0x34, 0xf4, + 0x62, 0x46, 0x05, 0x45, 0x0b, 0x7d, 0xda, 0x1e, 0x78, 0xed, 0x24, 0x08, 0xbb, 0x87, 0x81, 0xf0, + 0x8e, 0xee, 0x3b, 0xf7, 0x7a, 0x81, 0x38, 0x48, 0xda, 0x5e, 0x87, 0xf6, 0x1b, 0x3d, 0xda, 0xa3, + 0x0d, 0xc5, 0xd8, 0x4e, 0xf6, 0x15, 0xa5, 0x08, 0xb5, 0xd2, 0x00, 0xce, 0x72, 0x8f, 0xd2, 0x5e, + 0x48, 0x4e, 0xb8, 0x44, 0xd0, 0x27, 0x5c, 0xf8, 0xfd, 0xd8, 0x30, 0xdc, 0xcd, 0xe0, 0xc9, 0x8f, + 0x35, 0x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x02, 0xa5, + 0x55, 0x4e, 0x19, 0x3e, 0xef, 0xc5, 0x6d, 0xef, 0x64, 0x17, 0x67, 0x38, 0x90, 0x03, 0x95, 0xad, + 0xf7, 0x31, 0x65, 0x32, 0xa5, 0xf2, 0x0a, 0x66, 0x48, 0xa3, 0x37, 0x30, 0x97, 0xae, 0x9f, 0x08, + 0xc1, 0x64, 0xa2, 0xca, 0x34, 0xba, 0x3f, 0x99, 0x46, 0x59, 0xa5, 0xbc, 0x11, 0x99, 0xad, 0x48, + 0xb0, 0x01, 0x1e, 0xc5, 0x91, 0x16, 0xee, 0x11, 0xce, 0xa5, 0x86, 0x2a, 0xfc, 0x38, 0x25, 0xa5, + 0x3a, 0x7f, 0x64, 0x34, 0x12, 0x24, 0xea, 0xaa, 0xd0, 0x57, 0xf1, 0x90, 0x96, 0xea, 0xa4, 0x6b, + 0xad, 0x4e, 0xf9, 0x5c, 0xea, 0x8c, 0xc8, 0x18, 0x75, 0x46, 0xf6, 0xd0, 0x06, 0x14, 0x37, 0xfd, + 0xce, 0x01, 0x51, 0x51, 0xae, 0xad, 0x2f, 0x4d, 0x02, 0xaa, 0xe3, 0xbf, 0xa8, 0xb0, 0x72, 0x55, + 0xa8, 0x57, 0xb0, 0x16, 0x41, 0x7f, 0x85, 0xfa, 0x56, 0x24, 0x02, 0x11, 0x92, 0xbe, 0x8a, 0x58, + 0x55, 0x46, 0xac, 0xb9, 0xf1, 0xf1, 0x78, 0xf9, 0xd7, 0x33, 0x1b, 0x4f, 0x22, 0x82, 0xb0, 0x41, + 0x32, 0x52, 0x5e, 0x06, 0x02, 0x8f, 0xe0, 0xa1, 0xb7, 0x30, 0x9f, 0x2a, 0xbb, 0x1d, 0xc5, 0x89, + 0xe0, 0x36, 0x28, 0xab, 0xd7, 0xcf, 0x69, 0xb5, 0x16, 0xd2, 0x66, 0x8f, 0x21, 0xa1, 0xa6, 0xcc, + 0xa6, 0x84, 0x75, 0xc8, 0x2e, 0x0d, 0x83, 0xce, 0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53, 0x33, 0x5b, 0x37, 0xcd, 0xfa, 0x87, 0x4f, 0x4b, 0xd6, 0x97, + 0x9f, 0x96, 0xac, 0xaf, 0x3f, 0x2d, 0x59, 0xed, 0x92, 0xea, 0xac, 0xbf, 0xfc, 0x21, 0x00, 0x00, + 0xff, 0xff, 0xce, 0x4f, 0x37, 0x78, 0xe1, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2122,6 +2255,18 @@ func (m *SolveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.SourcePolicy != nil { + { + size, err := m.SourcePolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintControl(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } if len(m.FrontendInputs) > 0 { for k := range m.FrontendInputs { v := m.FrontendInputs[k] @@ -2598,22 +2743,22 @@ func (m *Vertex) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x3a } if m.Completed != nil { - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Completed, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Completed):]) - if err7 != nil { - return 0, err7 + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Completed, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Completed):]) + if err8 != nil { + return 0, err8 } - i -= n7 - i = encodeVarintControl(dAtA, i, uint64(n7)) + i -= n8 + i = encodeVarintControl(dAtA, i, uint64(n8)) i-- dAtA[i] = 0x32 } if m.Started != nil { - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Started, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Started):]) - if err8 != nil { - return 0, err8 + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Started, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Started):]) + if err9 != nil { + return 0, err9 } - i -= n8 - i = encodeVarintControl(dAtA, i, uint64(n8)) + i -= n9 + i = encodeVarintControl(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x2a } @@ -2678,31 +2823,31 @@ func (m *VertexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.XXX_unrecognized) } if m.Completed != nil { - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Completed, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Completed):]) - if err9 != nil { - return 0, err9 + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Completed, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Completed):]) + if err10 != nil { + return 0, err10 } - i -= n9 - i = encodeVarintControl(dAtA, i, uint64(n9)) + i -= n10 + i = encodeVarintControl(dAtA, i, uint64(n10)) i-- dAtA[i] = 0x42 } if m.Started != nil { - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Started, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Started):]) - if err10 != nil { - return 0, err10 + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Started, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Started):]) + if err11 != nil { + return 0, err11 } - i -= n10 - i = encodeVarintControl(dAtA, i, uint64(n10)) + i -= n11 + i = encodeVarintControl(dAtA, i, uint64(n11)) i-- dAtA[i] = 0x3a } - n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err11 != nil { - return 0, err11 + n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err12 != nil { + return 0, err12 } - i -= n11 - i = encodeVarintControl(dAtA, i, uint64(n11)) + i -= n12 + i = encodeVarintControl(dAtA, i, uint64(n12)) i-- dAtA[i] = 0x32 if m.Total != 0 { @@ -2775,12 +2920,12 @@ func (m *VertexLog) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err12 != nil { - return 0, err12 + n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err13 != nil { + return 0, err13 } - i -= n12 - i = encodeVarintControl(dAtA, i, uint64(n12)) + i -= n13 + i = encodeVarintControl(dAtA, i, uint64(n13)) i-- dAtA[i] = 0x12 if len(m.Vertex) > 0 { @@ -3058,6 +3203,102 @@ func (m *InfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *SourcePolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SourcePolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SourcePolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Sources) > 0 { + for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintControl(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *BuildInfoSource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BuildInfoSource) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BuildInfoSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Pin) > 0 { + i -= len(m.Pin) + copy(dAtA[i:], m.Pin) + i = encodeVarintControl(dAtA, i, uint64(len(m.Pin))) + i-- + dAtA[i] = 0x22 + } + if len(m.Alias) > 0 { + i -= len(m.Alias) + copy(dAtA[i:], m.Alias) + i = encodeVarintControl(dAtA, i, uint64(len(m.Alias))) + i-- + dAtA[i] = 0x1a + } + if len(m.Ref) > 0 { + i -= len(m.Ref) + copy(dAtA[i:], m.Ref) + i = encodeVarintControl(dAtA, i, uint64(len(m.Ref))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintControl(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintControl(dAtA []byte, offset int, v uint64) int { offset -= sovControl(v) base := offset @@ -3250,6 +3491,10 @@ func (m *SolveRequest) Size() (n int) { n += mapEntrySize + 1 + sovControl(uint64(mapEntrySize)) } } + if m.SourcePolicy != nil { + l = m.SourcePolicy.Size() + n += 1 + l + sovControl(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3627,6 +3872,52 @@ func (m *InfoResponse) Size() (n int) { return n } +func (m *SourcePolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Sources) > 0 { + for _, e := range m.Sources { + l = e.Size() + n += 1 + l + sovControl(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BuildInfoSource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovControl(uint64(l)) + } + l = len(m.Ref) + if l > 0 { + n += 1 + l + sovControl(uint64(l)) + } + l = len(m.Alias) + if l > 0 { + n += 1 + l + sovControl(uint64(l)) + } + l = len(m.Pin) + if l > 0 { + n += 1 + l + sovControl(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovControl(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4961,20 +5252,56 @@ func (m *SolveRequest) Unmarshal(dAtA []byte) error { } m.FrontendInputs[mapkey] = mapvalue iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipControl(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthControl - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourcePolicy", wireType) } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthControl + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SourcePolicy == nil { + m.SourcePolicy = &SourcePolicy{} + } + if err := m.SourcePolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipControl(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthControl + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } @@ -7378,6 +7705,270 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *SourcePolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := 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) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SourcePolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SourcePolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthControl + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sources = append(m.Sources, &BuildInfoSource{}) + if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipControl(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthControl + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BuildInfoSource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := 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) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BuildInfoSource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BuildInfoSource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthControl + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthControl + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ref = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Alias", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthControl + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Alias = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthControl + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipControl(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthControl + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipControl(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/api/services/control/control.proto b/api/services/control/control.proto index 6f5c976bce514..b984d026ea6b0 100644 --- a/api/services/control/control.proto +++ b/api/services/control/control.proto @@ -62,6 +62,7 @@ message SolveRequest { CacheOptions Cache = 8 [(gogoproto.nullable) = false]; repeated string Entitlements = 9 [(gogoproto.customtype) = "github.com/moby/buildkit/util/entitlements.Entitlement" ]; map FrontendInputs = 10; + SourcePolicy SourcePolicy = 11; } message CacheOptions { @@ -163,3 +164,14 @@ message InfoRequest {} message InfoResponse { moby.buildkit.v1.types.BuildkitVersion buildkitVersion = 1; } + +message SourcePolicy { + repeated BuildInfoSource Sources = 1; +} + +message BuildInfoSource { + string Type = 1; + string Ref = 2; + string Alias = 3; + string Pin = 4; +} diff --git a/client/client_test.go b/client/client_test.go index d501f37c99deb..8afc77a77b5d1 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -46,6 +46,7 @@ import ( binfotypes "github.com/moby/buildkit/util/buildinfo/types" "github.com/moby/buildkit/util/contentutil" "github.com/moby/buildkit/util/entitlements" + srcpoltypes "github.com/moby/buildkit/util/sourcepolicy/types" "github.com/moby/buildkit/util/testutil" "github.com/moby/buildkit/util/testutil/echoserver" "github.com/moby/buildkit/util/testutil/httpserver" @@ -167,6 +168,7 @@ func TestIntegration(t *testing.T) { testCallInfo, testPullWithLayerLimit, testExportAnnotations, + testSourcePolicy, ) tests = append(tests, diffOpTestCases()...) integration.Run(t, tests, mirrors) @@ -6325,3 +6327,83 @@ func fixedWriteCloser(wc io.WriteCloser) func(map[string]string) (io.WriteCloser return wc, nil } } + +func testSourcePolicy(t *testing.T, sb integration.Sandbox) { + requiresLinux(t) + c, err := New(sb.Context(), sb.Address()) + require.NoError(t, err) + defer c.Close() + + frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + st := llb.Image("busybox:1.34.1-uclibc").File( + llb.Copy(llb.HTTP("https://raw.githubusercontent.com/moby/buildkit/v0.10.1/README.md"), + "README.md", "README.md")) + def, err := st.Marshal(sb.Context()) + if err != nil { + return nil, err + } + return c.Solve(ctx, gateway.SolveRequest{ + Definition: def.ToPB(), + }) + } + + type testCase struct { + srcPol *srcpoltypes.SourcePolicy + expectedErr string + } + testCases := []testCase{ + { + // Valid + srcPol: &srcpoltypes.SourcePolicy{ + Sources: []srcpoltypes.Source{ + { + Type: "docker-image", + Ref: "docker.io/library/busybox:1.34.1-uclibc", + Pin: "sha256:3614ca5eacf0a3a1bcc361c939202a974b4902b9334ff36eb29ffe9011aaad83", + }, + { + Type: "http", + Ref: "https://raw.githubusercontent.com/moby/buildkit/v0.10.1/README.md", + Pin: "sha256:6e4b94fc270e708e1068be28bd3551dc6917a4fc5a61293d51bb36e6b75c4b53", + }, + }, + }, + expectedErr: "", + }, + { + // Invalid docker-image source + srcPol: &srcpoltypes.SourcePolicy{ + Sources: []srcpoltypes.Source{ + { + Type: "docker-image", + Ref: "docker.io/library/busybox:1.34.1-uclibc", + Pin: "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // invalid + }, + }, + }, + expectedErr: "docker.io/library/busybox:1.34.1-uclibc@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: not found", + }, + { + // Invalid http source + srcPol: &srcpoltypes.SourcePolicy{ + Sources: []srcpoltypes.Source{ + { + Type: "http", + Ref: "https://raw.githubusercontent.com/moby/buildkit/v0.10.1/README.md", + Pin: "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", // invalid + }, + }, + }, + expectedErr: "digest mismatch sha256:6e4b94fc270e708e1068be28bd3551dc6917a4fc5a61293d51bb36e6b75c4b53: sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + }, + } + for _, tc := range testCases { + _, err = c.Build(sb.Context(), SolveOpt{SourcePolicy: tc.srcPol}, "", frontend, nil) + if tc.expectedErr == "" { + require.NoError(t, err) + } else { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expectedErr) + } + } +} diff --git a/client/solve.go b/client/solve.go index 5d9f187e5b8f4..4b92da0adf1c6 100644 --- a/client/solve.go +++ b/client/solve.go @@ -22,6 +22,7 @@ import ( "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/entitlements" + srcpoltypes "github.com/moby/buildkit/util/sourcepolicy/types" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/tonistiigi/fsutil" @@ -44,6 +45,7 @@ type SolveOpt struct { AllowedEntitlements []entitlements.Entitlement SharedSession *session.Session // TODO: refactor to better session syncing SessionPreInitialized bool // TODO: refactor to better session syncing + SourcePolicy *srcpoltypes.SourcePolicy } type ExportEntry struct { @@ -198,6 +200,19 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG opt.FrontendAttrs[k] = v } + var srcPol *controlapi.SourcePolicy + if opt.SourcePolicy != nil && len(opt.SourcePolicy.Sources) > 0 { + srcPol = &controlapi.SourcePolicy{} + for _, f := range opt.SourcePolicy.Sources { + srcPol.Sources = append(srcPol.Sources, &controlapi.BuildInfoSource{ + Type: string(f.Type), + Alias: f.Alias, + Ref: f.Ref, + Pin: f.Pin, + }) + } + } + solveCtx, cancelSolve := context.WithCancel(ctx) var res *SolveResponse eg.Go(func() error { @@ -239,6 +254,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG FrontendInputs: frontendInputs, Cache: cacheOpt.options, Entitlements: opt.AllowedEntitlements, + SourcePolicy: srcPol, }) if err != nil { return errors.Wrap(err, "failed to solve") diff --git a/cmd/buildctl/build.go b/cmd/buildctl/build.go index 5b2d72ef76358..39e9823a8344d 100644 --- a/cmd/buildctl/build.go +++ b/cmd/buildctl/build.go @@ -18,6 +18,7 @@ import ( "github.com/moby/buildkit/session/sshforward/sshprovider" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/progress/progresswriter" + srcpoltypes "github.com/moby/buildkit/util/sourcepolicy/types" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -88,6 +89,10 @@ var buildCommand = cli.Command{ Name: "metadata-file", Usage: "Output build metadata (e.g., image digest) to a file as JSON", }, + cli.StringFlag{ + Name: "source-policy-file", + Usage: "Read source policy file from a JSON file", + }, }, } @@ -182,6 +187,19 @@ func buildAction(clicontext *cli.Context) error { return err } + var srcPol *srcpoltypes.SourcePolicy + if srcPolFile := clicontext.String("source-policy-file"); srcPolFile != "" { + b, err := os.ReadFile(srcPolFile) + if err != nil { + return err + } + var srcPolStruct srcpoltypes.SourcePolicy + if err := json.Unmarshal(b, &srcPolStruct); err != nil { + return errors.Wrapf(err, "failed to unmarshal source-policy-file %q", srcPolFile) + } + srcPol = &srcPolStruct + } + eg, ctx := errgroup.WithContext(bccommon.CommandContext(clicontext)) solveOpt := client.SolveOpt{ @@ -194,6 +212,7 @@ func buildAction(clicontext *cli.Context) error { CacheImports: cacheImports, Session: attachable, AllowedEntitlements: allowed, + SourcePolicy: srcPol, } solveOpt.FrontendAttrs, err = build.ParseOpt(clicontext.StringSlice("opt")) diff --git a/control/control.go b/control/control.go index f0dba193949bc..501889e547a8b 100644 --- a/control/control.go +++ b/control/control.go @@ -19,7 +19,9 @@ import ( "github.com/moby/buildkit/solver/llbsolver" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/bklog" + binfotypes "github.com/moby/buildkit/util/buildinfo/types" "github.com/moby/buildkit/util/imageutil" + srcpoltypes "github.com/moby/buildkit/util/sourcepolicy/types" "github.com/moby/buildkit/util/throttle" "github.com/moby/buildkit/util/tracing/transform" "github.com/moby/buildkit/version" @@ -306,6 +308,19 @@ func (c *Controller) Solve(ctx context.Context, req *controlapi.SolveRequest) (* Attrs: im.Attrs, }) } + var srcPol *srcpoltypes.SourcePolicy + if req.SourcePolicy != nil { + srcPol = &srcpoltypes.SourcePolicy{} + for _, f := range req.SourcePolicy.Sources { + s := srcpoltypes.Source{ + Type: binfotypes.SourceType(f.Type), + Ref: f.Ref, + Alias: f.Alias, + Pin: f.Pin, + } + srcPol.Sources = append(srcPol.Sources, s) + } + } resp, err := c.solver.Solve(ctx, req.Ref, req.Session, frontend.SolveRequest{ Frontend: req.Frontend, @@ -317,7 +332,7 @@ func (c *Controller) Solve(ctx context.Context, req *controlapi.SolveRequest) (* Exporter: expi, CacheExporter: cacheExporter, CacheExportMode: cacheExportMode, - }, req.Entitlements) + }, req.Entitlements, srcPol) if err != nil { return nil, err } diff --git a/docs/build-repro.md b/docs/build-repro.md index 4c11bd5755a1d..c75a1662c0bd6 100644 --- a/docs/build-repro.md +++ b/docs/build-repro.md @@ -127,3 +127,36 @@ jq '.' metadata.json "containerimage.digest": "sha256:..." } ``` + +### Reproducing the pinned dependencies + + +Reproducing the pinned dependencies is supported in the master branch of BuildKit. + +e.g., +```bash +buildctl build --frontend dockerfile.v0 --local dockerfile=. --local context=. --source-policy-file Dockerfile.pol +``` + +The content of the `Dockerfile.pol` is a subset of the `."containerimage.buildinfo".sources` property of the `metadata.json`: +```json +{ + "sources": [ + { + "type": "docker-image", + "ref": "docker.io/library/alpine:latest", + "pin": "sha256:4edbd2beb5f78b1014028f4fbb99f3237d9561100b6881aabbf5acce2c4f9454" + }, + { + "type": "http", + "ref": "https://raw.githubusercontent.com/moby/buildkit/v0.10.1/README.md", + "pin": "sha256:6e4b94fc270e708e1068be28bd3551dc6917a4fc5a61293d51bb36e6b75c4b53" + } + ] +} +``` + +Reproduction is currently supported for the following source types: +* `docker-image` +* `http` + diff --git a/solver/llbsolver/bridge.go b/solver/llbsolver/bridge.go index 0bf8ac905354b..57732c4fcbf4e 100644 --- a/solver/llbsolver/bridge.go +++ b/solver/llbsolver/bridge.go @@ -24,6 +24,7 @@ import ( "github.com/moby/buildkit/util/buildinfo" "github.com/moby/buildkit/util/flightcontrol" "github.com/moby/buildkit/util/progress" + "github.com/moby/buildkit/util/sourcepolicy/pinner" "github.com/moby/buildkit/worker" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" @@ -72,6 +73,11 @@ func (b *llbBridge) loadResult(ctx context.Context, def *pb.Definition, cacheImp if err != nil { return nil, nil, err } + srcPol, err := loadSourcePolicy(b.builder) + if err != nil { + return nil, nil, err + } + pinner := pinner.New(srcPol) var cms []solver.CacheManager for _, im := range cacheImports { cmID, err := cmKey(im) @@ -111,7 +117,7 @@ func (b *llbBridge) loadResult(ctx context.Context, def *pb.Definition, cacheImp } dpc := &detectPrunedCacheID{} - edge, err := Load(def, dpc.Load, ValidateEntitlements(ent), WithCacheSources(cms), NormalizeRuntimePlatforms(), WithValidateCaps()) + edge, err := Load(def, dpc.Load, ValidateEntitlements(ent), WithCacheSources(cms), NormalizeRuntimePlatforms(), WithValidateCaps(), WithPinner(pinner)) if err != nil { return nil, nil, errors.Wrap(err, "failed to load LLB") } diff --git a/solver/llbsolver/ops/source.go b/solver/llbsolver/ops/source.go index d24a902da570d..594585d2af801 100644 --- a/solver/llbsolver/ops/source.go +++ b/solver/llbsolver/ops/source.go @@ -54,6 +54,11 @@ func (s *sourceOp) instance(ctx context.Context) (source.SourceInstance, error) if err != nil { return nil, err } + if pinFunc := s.vtx.Options().PinFunc; pinFunc != nil { + if err = pinFunc(ctx, id); err != nil { + return nil, err + } + } src, err := s.sm.Resolve(ctx, id, s.sessM, s.vtx) if err != nil { return nil, err diff --git a/solver/llbsolver/solver.go b/solver/llbsolver/solver.go index 773e97c295628..7ee02c52dfb74 100644 --- a/solver/llbsolver/solver.go +++ b/solver/llbsolver/solver.go @@ -23,13 +23,17 @@ import ( "github.com/moby/buildkit/util/compression" "github.com/moby/buildkit/util/entitlements" "github.com/moby/buildkit/util/progress" + srcpoltypes "github.com/moby/buildkit/util/sourcepolicy/types" "github.com/moby/buildkit/worker" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) -const keyEntitlements = "llb.entitlements" +const ( + keyEntitlements = "llb.entitlements" + keySourcePolicy = "llb.sourcepolicy" +) type ExporterRequest struct { Exporter exporter.ExporterInstance @@ -104,7 +108,7 @@ func (s *Solver) Bridge(b solver.Builder) frontend.FrontendLLBBridge { } } -func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req frontend.SolveRequest, exp ExporterRequest, ent []entitlements.Entitlement) (*client.SolveResponse, error) { +func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req frontend.SolveRequest, exp ExporterRequest, ent []entitlements.Entitlement, srcPol *srcpoltypes.SourcePolicy) (*client.SolveResponse, error) { j, err := s.solver.NewJob(id) if err != nil { return nil, err @@ -118,6 +122,10 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro } j.SetValue(keyEntitlements, set) + if srcPol != nil { + j.SetValue(keySourcePolicy, *srcPol) + } + j.SessionID = sessionID var res *frontend.Result @@ -508,3 +516,28 @@ func loadEntitlements(b solver.Builder) (entitlements.Set, error) { } return ent, nil } + +func loadSourcePolicy(b solver.Builder) (*srcpoltypes.SourcePolicy, error) { + set := make(map[srcpoltypes.Source]struct{}, 0) + err := b.EachValue(context.TODO(), keySourcePolicy, func(v interface{}) error { + x, ok := v.(srcpoltypes.SourcePolicy) + if !ok { + return errors.Errorf("invalid source policy %T", v) + } + for _, f := range x.Sources { + set[f] = struct{}{} + } + return nil + }) + if err != nil { + return nil, err + } + var srcPol *srcpoltypes.SourcePolicy + if len(set) > 0 { + srcPol = &srcpoltypes.SourcePolicy{} + for k := range set { + srcPol.Sources = append(srcPol.Sources, k) + } + } + return srcPol, nil +} diff --git a/solver/llbsolver/vertex.go b/solver/llbsolver/vertex.go index 4f36c2eddbb30..48f1ddbe69188 100644 --- a/solver/llbsolver/vertex.go +++ b/solver/llbsolver/vertex.go @@ -1,6 +1,7 @@ package llbsolver import ( + "context" "fmt" "strings" @@ -9,6 +10,7 @@ import ( "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/source" "github.com/moby/buildkit/util/entitlements" + "github.com/moby/buildkit/util/sourcepolicy/pinner" digest "github.com/opencontainers/go-digest" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -375,3 +377,19 @@ func fileOpName(actions []*pb.FileAction) string { return strings.Join(names, ", ") } + +func WithPinner(pinner *pinner.Pinner) LoadOpt { + return func(op *pb.Op, _ *pb.OpMetadata, opt *solver.VertexOptions) error { + if _, ok := op.Op.(*pb.Op_Source); !ok { + return nil + } + opt.PinFunc = func(ctx context.Context, x interface{}) error { + ident, ok := x.(source.Identifier) + if !ok { + return fmt.Errorf("unknown identifier type %T", x) + } + return pinner.Pin(ctx, ident) + } + return nil + } +} diff --git a/solver/types.go b/solver/types.go index a20c1020f21ee..ba77f4cc7d7b6 100644 --- a/solver/types.go +++ b/solver/types.go @@ -56,6 +56,9 @@ type VertexOptions struct { ExportCache *bool // WorkerConstraint ProgressGroup *pb.ProgressGroup + // PinFunc takes a source.Identifier as the argument. + // Defined as func(interface{}) to avoid circular imports. + PinFunc func(context.Context, interface{}) error } // Result is an abstract return value for a solve diff --git a/util/sourcepolicy/pinner/pinner.go b/util/sourcepolicy/pinner/pinner.go new file mode 100644 index 0000000000000..fe76a4480e5e8 --- /dev/null +++ b/util/sourcepolicy/pinner/pinner.go @@ -0,0 +1,103 @@ +// Package pinner provides the pinner. +package pinner + +import ( + "context" + "fmt" + + "github.com/containerd/containerd/reference" + "github.com/moby/buildkit/source" + "github.com/moby/buildkit/util/bklog" + binfotypes "github.com/moby/buildkit/util/buildinfo/types" + srcpoltypes "github.com/moby/buildkit/util/sourcepolicy/types" + "github.com/moby/buildkit/util/urlutil" + digest "github.com/opencontainers/go-digest" +) + +func New(pin *srcpoltypes.SourcePolicy) *Pinner { + return &Pinner{pin: pin} +} + +type Pinner struct { + pin *srcpoltypes.SourcePolicy +} + +func (p *Pinner) Pin(ctx context.Context, ident source.Identifier) error { + bklog.G(ctx).Debugf("> Pin: ident=%+v", ident) + defer func() { + bklog.G(ctx).Debugf("< Pin: ident=%+v", ident) + }() + if p.pin == nil || len(p.pin.Sources) == 0 { + return nil + } + switch t := ident.(type) { + case *source.ImageIdentifier: + return p.pinImageIdentifier(ctx, t) + case *source.HTTPIdentifier: + return p.pinHTTPIdentifier(ctx, t) + case *source.GitIdentifier: + // TODO: waiting for https://github.com/moby/buildkit/pull/2799 to be merged for git ref parser + return nil + case *source.LocalIdentifier, *source.OCIIdentifier: + // NOP + return nil + default: + return fmt.Errorf("pinner: unknown source identifier type %T", ident) + } +} + +func (p *Pinner) pinImageIdentifier(ctx context.Context, ident *source.ImageIdentifier) error { + // Discard the existing digest that might have been resolved by the Dockerfile frontend's MetaResolver. + tag, _ := reference.SplitObject(ident.Reference.Object) + if tag == "@" || tag == "" { + tag = "latest" + } + refQuery := ident.Reference.Locator + ":" + tag + var hit *binfotypes.Source + for _, f := range p.pin.Sources { + f := f + if f.Type != binfotypes.SourceTypeDockerImage { + continue + } + if f.Ref != refQuery { + continue + } + if hit != nil { + return fmt.Errorf("found multiple pin entries for %q", refQuery) + } + hit = &f + } + if hit != nil && hit.Pin != "" { + newObj := tag + "@" + hit.Pin + bklog.G(ctx).Debugf("Pinning docker-image %q: %q", refQuery, newObj) + ident.Reference.Object = newObj + } + return nil +} + +func (p *Pinner) pinHTTPIdentifier(ctx context.Context, ident *source.HTTPIdentifier) error { + urlQuery := urlutil.RedactCredentials(ident.URL) + var hit *binfotypes.Source + for _, f := range p.pin.Sources { + f := f + if f.Type != binfotypes.SourceTypeHTTP { + continue + } + if f.Ref != urlQuery { + continue + } + if hit != nil { + return fmt.Errorf("found multiple pin entries for %q", urlQuery) + } + hit = &f + } + if hit != nil && hit.Pin != "" { + dgst, err := digest.Parse(hit.Pin) + if err != nil { + return err + } + bklog.G(ctx).Debugf("Pinning http %q: %q", urlQuery, dgst.String()) + ident.Checksum = dgst + } + return nil +} diff --git a/util/sourcepolicy/types/sourcepolicytypes.go b/util/sourcepolicy/types/sourcepolicytypes.go new file mode 100644 index 0000000000000..ba426cc782373 --- /dev/null +++ b/util/sourcepolicy/types/sourcepolicytypes.go @@ -0,0 +1,14 @@ +// Package srcpoltypes provides source policy types +package srcpoltypes + +import binfotypes "github.com/moby/buildkit/util/buildinfo/types" + +// Source corresponds to buildinfo Source. +type Source = binfotypes.Source + +// SourcePolicy provides pinning information to ensure determinism of sources. +type SourcePolicy struct { + // Sources do not need to cover all the sources. + // Sources may contain unreferenced sources too. + Sources []Source `json:"sources,omitempty"` +}