@docker/github-builder-runtime 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +5 -0
- package/lib/buildkit/buildkit.d.ts +29 -0
- package/lib/buildkit/buildkit.js +95 -0
- package/lib/buildkit/buildkit.js.map +1 -0
- package/lib/buildkit/config.d.ts +20 -0
- package/lib/buildkit/config.js +37 -0
- package/lib/buildkit/config.js.map +1 -0
- package/lib/buildkit/git.d.ts +24 -0
- package/lib/buildkit/git.js +103 -0
- package/lib/buildkit/git.js.map +1 -0
- package/lib/buildx/bake.d.ts +64 -0
- package/lib/buildx/bake.js +387 -0
- package/lib/buildx/bake.js.map +1 -0
- package/lib/buildx/build.d.ts +63 -0
- package/lib/buildx/build.js +356 -0
- package/lib/buildx/build.js.map +1 -0
- package/lib/buildx/builder.d.ts +27 -0
- package/lib/buildx/builder.js +290 -0
- package/lib/buildx/builder.js.map +1 -0
- package/lib/buildx/buildx.d.ts +47 -0
- package/lib/buildx/buildx.js +374 -0
- package/lib/buildx/buildx.js.map +1 -0
- package/lib/buildx/history.d.ts +39 -0
- package/lib/buildx/history.js +144 -0
- package/lib/buildx/history.js.map +1 -0
- package/lib/buildx/imagetools.d.ts +47 -0
- package/lib/buildx/imagetools.js +205 -0
- package/lib/buildx/imagetools.js.map +1 -0
- package/lib/buildx/install.d.ts +47 -0
- package/lib/buildx/install.js +314 -0
- package/lib/buildx/install.js.map +1 -0
- package/lib/cache.d.ts +40 -0
- package/lib/cache.js +129 -0
- package/lib/cache.js.map +1 -0
- package/lib/compose/compose.d.ts +33 -0
- package/lib/compose/compose.js +91 -0
- package/lib/compose/compose.js.map +1 -0
- package/lib/compose/install.d.ts +34 -0
- package/lib/compose/install.js +190 -0
- package/lib/compose/install.js.map +1 -0
- package/lib/context.d.ts +22 -0
- package/lib/context.js +33 -0
- package/lib/context.js.map +1 -0
- package/lib/cosign/cosign.d.ts +40 -0
- package/lib/cosign/cosign.js +127 -0
- package/lib/cosign/cosign.js.map +1 -0
- package/lib/cosign/dockerfile.d.ts +16 -0
- package/lib/cosign/dockerfile.js +61 -0
- package/lib/cosign/dockerfile.js.map +1 -0
- package/lib/cosign/install.d.ts +45 -0
- package/lib/cosign/install.js +229 -0
- package/lib/cosign/install.js.map +1 -0
- package/lib/docker/assets.d.ts +21 -0
- package/lib/docker/assets.js +346 -0
- package/lib/docker/assets.js.map +1 -0
- package/lib/docker/docker.d.ts +35 -0
- package/lib/docker/docker.js +199 -0
- package/lib/docker/docker.js.map +1 -0
- package/lib/docker/install.d.ts +85 -0
- package/lib/docker/install.js +726 -0
- package/lib/docker/install.js.map +1 -0
- package/lib/dockerhub.d.ts +33 -0
- package/lib/dockerhub.js +111 -0
- package/lib/dockerhub.js.map +1 -0
- package/lib/exec.d.ts +20 -0
- package/lib/exec.js +28 -0
- package/lib/exec.js.map +1 -0
- package/lib/git.d.ts +33 -0
- package/lib/git.js +185 -0
- package/lib/git.js.map +1 -0
- package/lib/github/artifact.d.ts +19 -0
- package/lib/github/artifact.js +49 -0
- package/lib/github/artifact.js.map +1 -0
- package/lib/github/github.d.ts +39 -0
- package/lib/github/github.js +135 -0
- package/lib/github/github.js.map +1 -0
- package/lib/github/summary.d.ts +20 -0
- package/lib/github/summary.js +166 -0
- package/lib/github/summary.js.map +1 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.js +48 -0
- package/lib/index.js.map +1 -0
- package/lib/oci/oci.d.ts +11 -0
- package/lib/oci/oci.js +199 -0
- package/lib/oci/oci.js.map +1 -0
- package/lib/regclient/install.d.ts +30 -0
- package/lib/regclient/install.js +136 -0
- package/lib/regclient/install.js.map +1 -0
- package/lib/regclient/regctl.d.ts +39 -0
- package/lib/regclient/regctl.js +102 -0
- package/lib/regclient/regctl.js.map +1 -0
- package/lib/sigstore/sigstore.d.ts +41 -0
- package/lib/sigstore/sigstore.js +461 -0
- package/lib/sigstore/sigstore.js.map +1 -0
- package/lib/toolkit.d.ts +57 -0
- package/lib/toolkit.js +68 -0
- package/lib/toolkit.js.map +1 -0
- package/lib/types/buildkit/buildkit.d.ts +16 -0
- package/lib/types/buildkit/buildkit.js +18 -0
- package/lib/types/buildkit/buildkit.js.map +1 -0
- package/lib/types/buildkit/client.d.ts +61 -0
- package/lib/types/buildkit/client.js +17 -0
- package/lib/types/buildkit/client.js.map +1 -0
- package/lib/types/buildkit/control.d.ts +88 -0
- package/lib/types/buildkit/control.js +17 -0
- package/lib/types/buildkit/control.js.map +1 -0
- package/lib/types/buildkit/git.d.ts +40 -0
- package/lib/types/buildkit/git.js +17 -0
- package/lib/types/buildkit/git.js.map +1 -0
- package/lib/types/buildkit/ops.d.ts +60 -0
- package/lib/types/buildkit/ops.js +17 -0
- package/lib/types/buildkit/ops.js.map +1 -0
- package/lib/types/buildkit/rpc.d.ts +24 -0
- package/lib/types/buildkit/rpc.js +17 -0
- package/lib/types/buildkit/rpc.js.map +1 -0
- package/lib/types/buildx/bake.d.ts +70 -0
- package/lib/types/buildx/bake.js +17 -0
- package/lib/types/buildx/bake.js.map +1 -0
- package/lib/types/buildx/build.d.ts +19 -0
- package/lib/types/buildx/build.js +17 -0
- package/lib/types/buildx/build.js.map +1 -0
- package/lib/types/buildx/builder.d.ts +52 -0
- package/lib/types/buildx/builder.js +17 -0
- package/lib/types/buildx/builder.js.map +1 -0
- package/lib/types/buildx/buildx.d.ts +42 -0
- package/lib/types/buildx/buildx.js +17 -0
- package/lib/types/buildx/buildx.js.map +1 -0
- package/lib/types/buildx/history.d.ts +111 -0
- package/lib/types/buildx/history.js +17 -0
- package/lib/types/buildx/history.js.map +1 -0
- package/lib/types/buildx/imagetools.d.ts +52 -0
- package/lib/types/buildx/imagetools.js +17 -0
- package/lib/types/buildx/imagetools.js.map +1 -0
- package/lib/types/compose/compose.d.ts +22 -0
- package/lib/types/compose/compose.js +17 -0
- package/lib/types/compose/compose.js.map +1 -0
- package/lib/types/cosign/cosign.d.ts +21 -0
- package/lib/types/cosign/cosign.js +17 -0
- package/lib/types/cosign/cosign.js.map +1 -0
- package/lib/types/docker/docker.d.ts +82 -0
- package/lib/types/docker/docker.js +17 -0
- package/lib/types/docker/docker.js.map +1 -0
- package/lib/types/docker/mediatype.d.ts +18 -0
- package/lib/types/docker/mediatype.js +19 -0
- package/lib/types/docker/mediatype.js.map +1 -0
- package/lib/types/dockerhub.d.ts +104 -0
- package/lib/types/dockerhub.js +17 -0
- package/lib/types/dockerhub.js.map +1 -0
- package/lib/types/github/artifact.d.ts +26 -0
- package/lib/types/github/artifact.js +17 -0
- package/lib/types/github/artifact.js.map +1 -0
- package/lib/types/github/github.d.ts +43 -0
- package/lib/types/github/github.js +17 -0
- package/lib/types/github/github.js.map +1 -0
- package/lib/types/github/summary.d.ts +29 -0
- package/lib/types/github/summary.js +17 -0
- package/lib/types/github/summary.js.map +1 -0
- package/lib/types/intoto/intoto.d.ts +21 -0
- package/lib/types/intoto/intoto.js +19 -0
- package/lib/types/intoto/intoto.js.map +1 -0
- package/lib/types/intoto/slsa_provenance/v0.2/provenance.d.ts +55 -0
- package/lib/types/intoto/slsa_provenance/v0.2/provenance.js +18 -0
- package/lib/types/intoto/slsa_provenance/v0.2/provenance.js.map +1 -0
- package/lib/types/oci/config.d.ts +47 -0
- package/lib/types/oci/config.js +17 -0
- package/lib/types/oci/config.js.map +1 -0
- package/lib/types/oci/descriptor.d.ts +34 -0
- package/lib/types/oci/descriptor.js +23 -0
- package/lib/types/oci/descriptor.js.map +1 -0
- package/lib/types/oci/digest.d.ts +16 -0
- package/lib/types/oci/digest.js +17 -0
- package/lib/types/oci/digest.js.map +1 -0
- package/lib/types/oci/index.d.ts +24 -0
- package/lib/types/oci/index.js +17 -0
- package/lib/types/oci/index.js.map +1 -0
- package/lib/types/oci/layout.d.ts +22 -0
- package/lib/types/oci/layout.js +20 -0
- package/lib/types/oci/layout.js.map +1 -0
- package/lib/types/oci/manifest.d.ts +25 -0
- package/lib/types/oci/manifest.js +17 -0
- package/lib/types/oci/manifest.js.map +1 -0
- package/lib/types/oci/mediatype.d.ts +21 -0
- package/lib/types/oci/mediatype.js +22 -0
- package/lib/types/oci/mediatype.js.map +1 -0
- package/lib/types/oci/oci.d.ts +32 -0
- package/lib/types/oci/oci.js +17 -0
- package/lib/types/oci/oci.js.map +1 -0
- package/lib/types/oci/versioned.d.ts +18 -0
- package/lib/types/oci/versioned.js +17 -0
- package/lib/types/oci/versioned.js.map +1 -0
- package/lib/types/regclient/regclient.d.ts +21 -0
- package/lib/types/regclient/regclient.js +17 -0
- package/lib/types/regclient/regclient.js.map +1 -0
- package/lib/types/sigstore/sigstore.d.ts +80 -0
- package/lib/types/sigstore/sigstore.js +20 -0
- package/lib/types/sigstore/sigstore.js.map +1 -0
- package/lib/types/undock/undock.d.ts +21 -0
- package/lib/types/undock/undock.js +17 -0
- package/lib/types/undock/undock.js.map +1 -0
- package/lib/undock/install.d.ts +30 -0
- package/lib/undock/install.js +146 -0
- package/lib/undock/install.js.map +1 -0
- package/lib/undock/undock.d.ts +42 -0
- package/lib/undock/undock.js +121 -0
- package/lib/undock/undock.js.map +1 -0
- package/lib/util.d.ts +49 -0
- package/lib/util.js +218 -0
- package/lib/util.js.map +1 -0
- package/npm-shrinkwrap.json +2858 -0
- package/package.json +57 -0
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=oci.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oci.js","sourceRoot":"","sources":["../../../src/types/oci/oci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -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
|
+
export interface Versioned {
|
|
17
|
+
schemaVersion: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=versioned.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versioned.js","sourceRoot":"","sources":["../../../src/types/oci/versioned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 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
|
+
import { GitHubContentOpts } from '../github/github.js';
|
|
17
|
+
export interface DownloadVersion {
|
|
18
|
+
version: string;
|
|
19
|
+
downloadURL: string;
|
|
20
|
+
contentOpts: GitHubContentOpts;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 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
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=regclient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regclient.js","sourceRoot":"","sources":["../../../src/types/regclient/regclient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 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
|
+
import type { SerializedBundle } from '@sigstore/bundle';
|
|
17
|
+
import { Subject } from '../intoto/intoto.js';
|
|
18
|
+
import { Platform } from '../oci/descriptor.js';
|
|
19
|
+
export declare const FULCIO_URL = "https://fulcio.sigstore.dev";
|
|
20
|
+
export declare const REKOR_URL = "https://rekor.sigstore.dev";
|
|
21
|
+
export declare const TSASERVER_URL = "https://timestamp.sigstore.dev";
|
|
22
|
+
export declare const SEARCH_URL = "https://search.sigstore.dev";
|
|
23
|
+
export interface Endpoints {
|
|
24
|
+
fulcioURL: string;
|
|
25
|
+
rekorURL?: string;
|
|
26
|
+
tsaServerURL?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ParsedBundle {
|
|
29
|
+
payload: SerializedBundle;
|
|
30
|
+
certificate: string;
|
|
31
|
+
tlogID?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface SignAttestationManifestsOpts {
|
|
34
|
+
imageNames: Array<string>;
|
|
35
|
+
imageDigest: string;
|
|
36
|
+
noTransparencyLog?: boolean;
|
|
37
|
+
retryOnManifestUnknown?: boolean;
|
|
38
|
+
retryLimit?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface SignAttestationManifestsResult extends ParsedBundle {
|
|
41
|
+
imageName: string;
|
|
42
|
+
}
|
|
43
|
+
export interface VerifySignedManifestsOpts {
|
|
44
|
+
certificateIdentityRegexp: string;
|
|
45
|
+
platform?: Platform;
|
|
46
|
+
noTransparencyLog?: boolean;
|
|
47
|
+
retryOnManifestUnknown?: boolean;
|
|
48
|
+
retryLimit?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface VerifySignedManifestsResult {
|
|
51
|
+
cosignArgs: Array<string>;
|
|
52
|
+
signatureManifestDigest: string;
|
|
53
|
+
}
|
|
54
|
+
export interface SignProvenanceBlobsOpts {
|
|
55
|
+
localExportDir: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
noTransparencyLog?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface SignProvenanceBlobsResult extends ParsedBundle {
|
|
60
|
+
bundlePath: string;
|
|
61
|
+
subjects: Array<Subject>;
|
|
62
|
+
}
|
|
63
|
+
export interface VerifySignedArtifactsOpts {
|
|
64
|
+
predicateType?: string;
|
|
65
|
+
certificateIdentityRegexp: string;
|
|
66
|
+
noTransparencyLog?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface VerifySignedArtifactsResult {
|
|
69
|
+
bundlePath: string;
|
|
70
|
+
cosignArgs: Array<string>;
|
|
71
|
+
}
|
|
72
|
+
export interface VerifyArtifactOpts {
|
|
73
|
+
subjectAlternativeName: string | RegExp;
|
|
74
|
+
issuer?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface VerifyArtifactResult {
|
|
77
|
+
payload: SerializedBundle;
|
|
78
|
+
certificate: string;
|
|
79
|
+
tlogID?: string;
|
|
80
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 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
|
+
export const FULCIO_URL = 'https://fulcio.sigstore.dev';
|
|
17
|
+
export const REKOR_URL = 'https://rekor.sigstore.dev';
|
|
18
|
+
export const TSASERVER_URL = 'https://timestamp.sigstore.dev';
|
|
19
|
+
export const SEARCH_URL = 'https://search.sigstore.dev';
|
|
20
|
+
//# sourceMappingURL=sigstore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sigstore.js","sourceRoot":"","sources":["../../../src/types/sigstore/sigstore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,MAAM,CAAC,MAAM,UAAU,GAAG,6BAA6B,CAAC;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG,4BAA4B,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,gCAAgC,CAAC;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { GitHubContentOpts } from '../github/github.js';
|
|
17
|
+
export interface DownloadVersion {
|
|
18
|
+
version: string;
|
|
19
|
+
downloadURL: string;
|
|
20
|
+
contentOpts: GitHubContentOpts;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=undock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undock.js","sourceRoot":"","sources":["../../../src/types/undock/undock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import { GitHubRelease } from '../types/github/github.js';
|
|
17
|
+
import { DownloadVersion } from '../types/undock/undock.js';
|
|
18
|
+
export interface InstallOpts {
|
|
19
|
+
githubToken?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class Install {
|
|
22
|
+
private readonly githubToken;
|
|
23
|
+
constructor(opts?: InstallOpts);
|
|
24
|
+
download(v: string, ghaNoCache?: boolean): Promise<string>;
|
|
25
|
+
install(binPath: string, dest?: string): Promise<string>;
|
|
26
|
+
private filename;
|
|
27
|
+
private vspec;
|
|
28
|
+
static getDownloadVersion(v: string): Promise<DownloadVersion>;
|
|
29
|
+
static getRelease(version: DownloadVersion, githubToken?: string): Promise<GitHubRelease>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
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
|
+
import fs from 'fs';
|
|
17
|
+
import os from 'os';
|
|
18
|
+
import path from 'path';
|
|
19
|
+
import * as core from '@actions/core';
|
|
20
|
+
import * as tc from '@actions/tool-cache';
|
|
21
|
+
import * as semver from 'semver';
|
|
22
|
+
import * as util from 'util';
|
|
23
|
+
import { Cache } from '../cache.js';
|
|
24
|
+
import { Context } from '../context.js';
|
|
25
|
+
import { GitHub } from '../github/github.js';
|
|
26
|
+
export class Install {
|
|
27
|
+
githubToken;
|
|
28
|
+
constructor(opts) {
|
|
29
|
+
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
|
|
30
|
+
}
|
|
31
|
+
/*
|
|
32
|
+
* Download undock binary from GitHub release
|
|
33
|
+
* @param v: version semver version or latest
|
|
34
|
+
* @param ghaNoCache: disable binary caching in GitHub Actions cache backend
|
|
35
|
+
* @returns path to the undock binary
|
|
36
|
+
*/
|
|
37
|
+
async download(v, ghaNoCache) {
|
|
38
|
+
const version = await Install.getDownloadVersion(v);
|
|
39
|
+
core.debug(`Install.download version: ${version.version}`);
|
|
40
|
+
const release = await Install.getRelease(version, this.githubToken);
|
|
41
|
+
core.debug(`Install.download release tag name: ${release.tag_name}`);
|
|
42
|
+
const vspec = await this.vspec(release.tag_name);
|
|
43
|
+
core.debug(`Install.download vspec: ${vspec}`);
|
|
44
|
+
const c = semver.clean(vspec) || '';
|
|
45
|
+
if (!semver.valid(c)) {
|
|
46
|
+
throw new Error(`Invalid Undock version "${vspec}".`);
|
|
47
|
+
}
|
|
48
|
+
const installCache = new Cache({
|
|
49
|
+
htcName: 'undock-dl-bin',
|
|
50
|
+
htcVersion: vspec,
|
|
51
|
+
baseCacheDir: path.join(os.homedir(), '.bin'),
|
|
52
|
+
cacheFile: os.platform() == 'win32' ? 'undock.exe' : 'undock',
|
|
53
|
+
ghaNoCache: ghaNoCache
|
|
54
|
+
});
|
|
55
|
+
const cacheFoundPath = await installCache.find();
|
|
56
|
+
if (cacheFoundPath) {
|
|
57
|
+
core.info(`Undock binary found in ${cacheFoundPath}`);
|
|
58
|
+
return cacheFoundPath;
|
|
59
|
+
}
|
|
60
|
+
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
|
|
61
|
+
core.info(`Downloading ${downloadURL}`);
|
|
62
|
+
const htcDownloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
|
|
63
|
+
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
|
64
|
+
let htcExtPath;
|
|
65
|
+
if (os.platform() == 'win32') {
|
|
66
|
+
htcExtPath = await tc.extractZip(htcDownloadPath);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
htcExtPath = await tc.extractTar(htcDownloadPath);
|
|
70
|
+
}
|
|
71
|
+
core.info(`Extracted to ${htcExtPath}`);
|
|
72
|
+
const exePath = path.join(htcExtPath, os.platform() == 'win32' ? 'undock.exe' : 'undock');
|
|
73
|
+
core.debug(`Install.download exePath: ${exePath}`);
|
|
74
|
+
const cacheSavePath = await installCache.save(exePath);
|
|
75
|
+
core.info(`Cached to ${cacheSavePath}`);
|
|
76
|
+
return cacheSavePath;
|
|
77
|
+
}
|
|
78
|
+
async install(binPath, dest) {
|
|
79
|
+
dest = dest || Context.tmpDir();
|
|
80
|
+
const binDir = path.join(dest, 'undock-bin');
|
|
81
|
+
if (!fs.existsSync(binDir)) {
|
|
82
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
83
|
+
}
|
|
84
|
+
const binName = os.platform() == 'win32' ? 'undock.exe' : 'undock';
|
|
85
|
+
const undockPath = path.join(binDir, binName);
|
|
86
|
+
fs.copyFileSync(binPath, undockPath);
|
|
87
|
+
core.info('Fixing perms');
|
|
88
|
+
fs.chmodSync(undockPath, '0755');
|
|
89
|
+
core.addPath(binDir);
|
|
90
|
+
core.info('Added Undock to PATH');
|
|
91
|
+
core.info(`Binary path: ${undockPath}`);
|
|
92
|
+
return undockPath;
|
|
93
|
+
}
|
|
94
|
+
filename(version) {
|
|
95
|
+
let arch;
|
|
96
|
+
switch (os.arch()) {
|
|
97
|
+
case 'x64': {
|
|
98
|
+
arch = 'amd64';
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'ppc64': {
|
|
102
|
+
arch = 'ppc64le';
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case 'arm': {
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
+
const arm_version = process.config.variables.arm_version;
|
|
108
|
+
arch = arm_version ? 'armv' + arm_version : 'arm';
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
default: {
|
|
112
|
+
arch = os.arch();
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const platform = os.platform() == 'win32' ? 'windows' : os.platform();
|
|
117
|
+
const ext = os.platform() == 'win32' ? '.zip' : '.tar.gz';
|
|
118
|
+
return util.format('undock_%s_%s_%s%s', version, platform, arch, ext);
|
|
119
|
+
}
|
|
120
|
+
async vspec(version) {
|
|
121
|
+
const v = version.replace(/^v+|v+$/g, '');
|
|
122
|
+
core.info(`Use ${v} version spec cache key for ${version}`);
|
|
123
|
+
return v;
|
|
124
|
+
}
|
|
125
|
+
static async getDownloadVersion(v) {
|
|
126
|
+
return {
|
|
127
|
+
version: v,
|
|
128
|
+
downloadURL: 'https://github.com/crazy-max/undock/releases/download/v%s/%s',
|
|
129
|
+
contentOpts: {
|
|
130
|
+
owner: 'docker',
|
|
131
|
+
repo: 'actions-toolkit',
|
|
132
|
+
ref: 'main',
|
|
133
|
+
path: '.github/undock-releases.json'
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
static async getRelease(version, githubToken) {
|
|
138
|
+
const github = new GitHub({ token: githubToken });
|
|
139
|
+
const releases = await github.releases('Undock', version.contentOpts);
|
|
140
|
+
if (!releases[version.version]) {
|
|
141
|
+
throw new Error(`Cannot find Undock release ${version.version} in releases JSON`);
|
|
142
|
+
}
|
|
143
|
+
return releases[version.version];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/undock/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAS3C,MAAM,OAAO,OAAO;IACD,WAAW,CAAqB;IAEjD,YAAY,IAAkB;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,EAAE,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,QAAQ,CAAC,CAAS,EAAE,UAAoB;QACnD,MAAM,OAAO,GAAoB,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,KAAK,CAAC,6BAA6B,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAE3D,MAAM,OAAO,GAAkB,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACnF,IAAI,CAAC,KAAK,CAAC,sCAAsC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAErE,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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
|
+
export interface UndockOpts {
|
|
17
|
+
binPath?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface UndockRunOpts {
|
|
20
|
+
source: string;
|
|
21
|
+
dist: string;
|
|
22
|
+
logLevel?: string;
|
|
23
|
+
logCaller?: boolean;
|
|
24
|
+
cacheDir?: string;
|
|
25
|
+
platform?: string;
|
|
26
|
+
all?: boolean;
|
|
27
|
+
include?: Array<string>;
|
|
28
|
+
insecure?: boolean;
|
|
29
|
+
rmDist?: boolean;
|
|
30
|
+
wrap?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare class Undock {
|
|
33
|
+
private readonly binPath;
|
|
34
|
+
private _version;
|
|
35
|
+
private _versionOnce;
|
|
36
|
+
constructor(opts?: UndockOpts);
|
|
37
|
+
run(opts: UndockRunOpts): Promise<void>;
|
|
38
|
+
isAvailable(): Promise<boolean>;
|
|
39
|
+
version(): Promise<string>;
|
|
40
|
+
printVersion(): Promise<void>;
|
|
41
|
+
versionSatisfies(range: string, version?: string): Promise<boolean>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
import * as core from '@actions/core';
|
|
17
|
+
import * as semver from 'semver';
|
|
18
|
+
import { Exec } from '../exec.js';
|
|
19
|
+
export class Undock {
|
|
20
|
+
binPath;
|
|
21
|
+
_version;
|
|
22
|
+
_versionOnce;
|
|
23
|
+
constructor(opts) {
|
|
24
|
+
this.binPath = opts?.binPath || 'undock';
|
|
25
|
+
this._version = '';
|
|
26
|
+
this._versionOnce = false;
|
|
27
|
+
}
|
|
28
|
+
async run(opts) {
|
|
29
|
+
if (!opts.source) {
|
|
30
|
+
throw new Error('source is required');
|
|
31
|
+
}
|
|
32
|
+
if (!opts.dist) {
|
|
33
|
+
throw new Error('dist is required');
|
|
34
|
+
}
|
|
35
|
+
const args = [];
|
|
36
|
+
if (opts.logLevel) {
|
|
37
|
+
args.push(`--log-level=${opts.logLevel}`);
|
|
38
|
+
}
|
|
39
|
+
if (opts.logCaller) {
|
|
40
|
+
args.push('--log-caller');
|
|
41
|
+
}
|
|
42
|
+
if (opts.cacheDir) {
|
|
43
|
+
args.push(`--cachedir=${opts.cacheDir}`);
|
|
44
|
+
}
|
|
45
|
+
if (opts.platform) {
|
|
46
|
+
args.push(`--platform=${opts.platform}`);
|
|
47
|
+
}
|
|
48
|
+
if (opts.all) {
|
|
49
|
+
args.push('--all');
|
|
50
|
+
}
|
|
51
|
+
if (opts.include) {
|
|
52
|
+
opts.include.forEach(i => {
|
|
53
|
+
args.push(`--include=${i}`);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (opts.insecure) {
|
|
57
|
+
args.push('--insecure');
|
|
58
|
+
}
|
|
59
|
+
if (opts.rmDist) {
|
|
60
|
+
args.push('--rm-dist');
|
|
61
|
+
}
|
|
62
|
+
if (opts.wrap) {
|
|
63
|
+
args.push('--wrap');
|
|
64
|
+
}
|
|
65
|
+
args.push(opts.source, opts.dist);
|
|
66
|
+
await Exec.exec(this.binPath, args, {
|
|
67
|
+
failOnStdErr: false
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async isAvailable() {
|
|
71
|
+
const ok = await Exec.getExecOutput(this.binPath, [], {
|
|
72
|
+
ignoreReturnCode: true,
|
|
73
|
+
silent: true
|
|
74
|
+
})
|
|
75
|
+
.then(res => {
|
|
76
|
+
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
77
|
+
core.debug(`Undock.isAvailable cmd err: ${res.stderr.trim()}`);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return res.exitCode == 0;
|
|
81
|
+
})
|
|
82
|
+
.catch(error => {
|
|
83
|
+
core.debug(`Undock.isAvailable error: ${error}`);
|
|
84
|
+
return false;
|
|
85
|
+
});
|
|
86
|
+
core.debug(`Undock.isAvailable: ${ok}`);
|
|
87
|
+
return ok;
|
|
88
|
+
}
|
|
89
|
+
async version() {
|
|
90
|
+
if (this._versionOnce) {
|
|
91
|
+
return this._version;
|
|
92
|
+
}
|
|
93
|
+
this._versionOnce = true;
|
|
94
|
+
this._version = await Exec.getExecOutput(this.binPath, ['--version'], {
|
|
95
|
+
ignoreReturnCode: true,
|
|
96
|
+
silent: true
|
|
97
|
+
}).then(res => {
|
|
98
|
+
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
99
|
+
throw new Error(res.stderr.trim());
|
|
100
|
+
}
|
|
101
|
+
return res.stdout.trim();
|
|
102
|
+
});
|
|
103
|
+
return this._version;
|
|
104
|
+
}
|
|
105
|
+
async printVersion() {
|
|
106
|
+
await Exec.exec(this.binPath, ['--version'], {
|
|
107
|
+
failOnStdErr: false
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async versionSatisfies(range, version) {
|
|
111
|
+
const ver = version ?? (await this.version());
|
|
112
|
+
if (!ver) {
|
|
113
|
+
core.debug(`Undock.versionSatisfies false: undefined version`);
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const res = semver.satisfies(ver, range) || /^[0-9a-f]{7}$/.exec(ver) !== null;
|
|
117
|
+
core.debug(`Undock.versionSatisfies ${ver} statisfies ${range}: ${res}`);
|
|
118
|
+
return res;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=undock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undock.js","sourceRoot":"","sources":["../../src/undock/undock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAoBhC,MAAM,OAAO,MAAM;IACA,OAAO,CAAS;IACzB,QAAQ,CAAS;IACjB,YAAY,CAAU;IAE9B,YAAY,IAAiB;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,QAAQ,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAmB;QAClC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,IAAI,GAAkB,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,QAAQ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