Skip to content

Commit dde9860

Browse files
committed
buildkit: add types
Signed-off-by: CrazyMax <[email protected]>
1 parent ee6e7bb commit dde9860

5 files changed

Lines changed: 317 additions & 0 deletions

File tree

src/types/buildkit/buildkit.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright 2024 actions-toolkit authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/llbsolver/history.go#L672
18+
export const MEDIATYPE_STATUS_V0 = 'application/vnd.buildkit.status.v0';

src/types/buildkit/client.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Copyright 2024 actions-toolkit authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import {Digest} from '../oci/digest';
18+
import {ProgressGroup, Range, SourceInfo} from './ops';
19+
20+
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L10-L19
21+
export interface Vertex {
22+
digest?: Digest;
23+
inputs?: Array<Digest>;
24+
name?: string;
25+
started?: Date;
26+
completed?: Date;
27+
cached?: boolean;
28+
error?: string;
29+
progressGroup?: ProgressGroup;
30+
}
31+
32+
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L21-L30
33+
export interface VertexStatus {
34+
id: string;
35+
vertex?: Digest;
36+
name?: string;
37+
total?: number;
38+
current: number;
39+
timestamp?: Date;
40+
started?: Date;
41+
completed?: Date;
42+
}
43+
44+
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L32-L37
45+
export interface VertexLog {
46+
vertex?: Digest;
47+
stream?: number;
48+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49+
data: any;
50+
timestamp: Date;
51+
}
52+
53+
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L39-L48
54+
export interface VertexWarning {
55+
vertex?: Digest;
56+
level?: number;
57+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
58+
short?: any;
59+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
60+
detail?: Array<any>;
61+
url?: string;
62+
63+
sourceInfo?: SourceInfo;
64+
range?: Array<Range>;
65+
}
66+
67+
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L50-L55
68+
export interface SolveStatus {
69+
vertexes?: Array<Vertex>;
70+
statuses?: Array<VertexStatus>;
71+
logs?: Array<VertexLog>;
72+
warnings?: Array<VertexWarning>;
73+
}
74+
75+
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L57-L60
76+
export interface SolveResponse {
77+
exporterResponse: Record<string, string>;
78+
}

src/types/buildkit/control.ts

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/**
2+
* Copyright 2024 actions-toolkit authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import {Descriptor} from '../oci/descriptor';
18+
import {Digest} from '../oci/digest';
19+
import {ProgressGroup, Range, SourceInfo} from './ops';
20+
import {RpcStatus} from './rpc';
21+
22+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L1504-L1525
23+
export interface BuildHistoryRecord {
24+
Ref: string;
25+
Frontend: string;
26+
FrontendAttrs: Record<string, string>;
27+
Exporters: Array<Exporter>;
28+
error?: RpcStatus;
29+
CreatedAt?: Date;
30+
CompletedAt?: Date;
31+
logs?: Descriptor;
32+
ExporterResponse: Record<string, string>;
33+
Result?: BuildResultInfo;
34+
Results: Record<string, BuildResultInfo>;
35+
Generation: number;
36+
trace?: Descriptor;
37+
pinned: boolean;
38+
numCachedSteps: number;
39+
numTotalSteps: number;
40+
numCompletedSteps: number;
41+
}
42+
43+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L1909-L1917
44+
export interface Exporter {
45+
Type: string;
46+
Attrs: Record<string, string>;
47+
}
48+
49+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L1845-L1852
50+
export interface BuildResultInfo {
51+
ResultDeprecated?: Descriptor;
52+
Attestations?: Array<Descriptor>;
53+
Results?: Record<number, Descriptor>;
54+
}
55+
56+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L751-L759
57+
export interface StatusResponse {
58+
vertexes?: Array<Vertex>;
59+
statuses?: Array<VertexStatus>;
60+
logs?: Array<VertexLog>;
61+
warnings?: Array<VertexWarning>;
62+
}
63+
64+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L822-L834
65+
export interface Vertex {
66+
digest: Digest;
67+
inputs: Array<Digest>;
68+
name?: string;
69+
cached?: boolean;
70+
started?: Date;
71+
completed?: Date;
72+
error?: string;
73+
progressGroup?: ProgressGroup;
74+
}
75+
76+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L911-L923
77+
export interface VertexStatus {
78+
ID?: string;
79+
vertex: Digest;
80+
name?: string;
81+
current?: number;
82+
total?: number;
83+
timestamp: Date;
84+
started?: Date;
85+
completed?: Date;
86+
}
87+
88+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L1007-L1015
89+
export interface VertexLog {
90+
vertex: Digest;
91+
timestamp: Date;
92+
stream?: number;
93+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
94+
msg?: any;
95+
}
96+
97+
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L1071-L1082
98+
export interface VertexWarning {
99+
vertex: Digest;
100+
level?: number;
101+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
102+
short?: any;
103+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
104+
detail?: Array<any>;
105+
url?: string;
106+
info?: SourceInfo;
107+
ranges?: Array<Range>;
108+
}

src/types/buildkit/ops.ts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* Copyright 2024 actions-toolkit authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1901-L1909
18+
export interface Definition {
19+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
20+
def?: Array<any>;
21+
metadata: Record<string, OpMetadata>;
22+
Source?: Source;
23+
}
24+
25+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1313-L1323
26+
export interface OpMetadata {
27+
ignore_cache?: boolean;
28+
description?: Record<string, string>;
29+
export_cache?: ExportCache;
30+
caps: Record<string, boolean>;
31+
progress_group?: ProgressGroup;
32+
}
33+
34+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1390-L1393
35+
export interface Source {
36+
locations?: Record<string, Locations>;
37+
infos?: Array<SourceInfo>;
38+
}
39+
40+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1439-L1441
41+
export interface Locations {
42+
locations?: Array<Location>;
43+
}
44+
45+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1545-L1548
46+
export interface Location {
47+
sourceIndex?: number;
48+
ranges?: Array<Range>;
49+
}
50+
51+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1594-L1597
52+
export interface Range {
53+
start: Position;
54+
end: Position;
55+
}
56+
57+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1643-L1646
58+
export interface Position {
59+
line: number;
60+
character: number;
61+
}
62+
63+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1480-L1485
64+
export interface SourceInfo {
65+
filename?: string;
66+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
67+
data?: any;
68+
definition?: Definition;
69+
language?: string;
70+
}
71+
72+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1691-L1693
73+
export interface ExportCache {
74+
Value?: boolean;
75+
}
76+
77+
// https://github.com/moby/buildkit/blob/v0.14.0/solver/pb/ops.pb.go#L1731-L1735
78+
export interface ProgressGroup {
79+
id?: string;
80+
name?: string;
81+
weak?: boolean;
82+
}

src/types/buildkit/rpc.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Copyright 2024 actions-toolkit authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// https://github.com/moby/buildkit/blob/v0.14.0/vendor/github.com/gogo/googleapis/google/rpc/status.pb.go#L36-L49
18+
export interface RpcStatus {
19+
code: number;
20+
message: string;
21+
details: Array<RpcAny>;
22+
}
23+
24+
// https://github.com/moby/buildkit/blob/v0.14.0/vendor/github.com/gogo/protobuf/types/any.pb.go#L108-L143
25+
// Define properties based on google.protobuf.Any. For simplicity, assuming it
26+
// has at least a type_url and a value.
27+
export interface RpcAny {
28+
type_url: string;
29+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
30+
value: any;
31+
}

0 commit comments

Comments
 (0)