@balena/compose 0.1.0-import-modules-d457c16709fa5260df6ff68da79c0f0e92f7aaa5

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +201 -0
  3. package/README.md +200 -0
  4. package/dist/build/builder.d.ts +18 -0
  5. package/dist/build/builder.js +127 -0
  6. package/dist/build/builder.js.map +1 -0
  7. package/dist/build/index.d.ts +4 -0
  8. package/dist/build/index.js +7 -0
  9. package/dist/build/index.js.map +1 -0
  10. package/dist/build/plugin.d.ts +11 -0
  11. package/dist/build/plugin.js +3 -0
  12. package/dist/build/plugin.js.map +1 -0
  13. package/dist/build/utils.d.ts +8 -0
  14. package/dist/build/utils.js +60 -0
  15. package/dist/build/utils.js.map +1 -0
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.js +6 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/multibuild/build-metadata.d.ts +24 -0
  20. package/dist/multibuild/build-metadata.js +166 -0
  21. package/dist/multibuild/build-metadata.js.map +1 -0
  22. package/dist/multibuild/build-secrets/Dockerfile +3 -0
  23. package/dist/multibuild/build-secrets/Dockerfile.remove +3 -0
  24. package/dist/multibuild/build-secrets/index.d.ts +43 -0
  25. package/dist/multibuild/build-secrets/index.js +140 -0
  26. package/dist/multibuild/build-secrets/index.js.map +1 -0
  27. package/dist/multibuild/build-task.d.ts +36 -0
  28. package/dist/multibuild/build-task.js +3 -0
  29. package/dist/multibuild/build-task.js.map +1 -0
  30. package/dist/multibuild/build.d.ts +6 -0
  31. package/dist/multibuild/build.js +167 -0
  32. package/dist/multibuild/build.js.map +1 -0
  33. package/dist/multibuild/constants.d.ts +1 -0
  34. package/dist/multibuild/constants.js +5 -0
  35. package/dist/multibuild/constants.js.map +1 -0
  36. package/dist/multibuild/contracts.d.ts +6 -0
  37. package/dist/multibuild/contracts.js +55 -0
  38. package/dist/multibuild/contracts.js.map +1 -0
  39. package/dist/multibuild/errors.d.ts +43 -0
  40. package/dist/multibuild/errors.js +71 -0
  41. package/dist/multibuild/errors.js.map +1 -0
  42. package/dist/multibuild/external.d.ts +5 -0
  43. package/dist/multibuild/external.js +62 -0
  44. package/dist/multibuild/external.js.map +1 -0
  45. package/dist/multibuild/index.d.ts +33 -0
  46. package/dist/multibuild/index.js +187 -0
  47. package/dist/multibuild/index.js.map +1 -0
  48. package/dist/multibuild/local-image.d.ts +25 -0
  49. package/dist/multibuild/local-image.js +29 -0
  50. package/dist/multibuild/local-image.js.map +1 -0
  51. package/dist/multibuild/manifests.d.ts +19 -0
  52. package/dist/multibuild/manifests.js +27 -0
  53. package/dist/multibuild/manifests.js.map +1 -0
  54. package/dist/multibuild/path-utils.d.ts +4 -0
  55. package/dist/multibuild/path-utils.js +28 -0
  56. package/dist/multibuild/path-utils.js.map +1 -0
  57. package/dist/multibuild/registry-secrets.d.ts +16 -0
  58. package/dist/multibuild/registry-secrets.js +75 -0
  59. package/dist/multibuild/registry-secrets.js.map +1 -0
  60. package/dist/multibuild/resolve.d.ts +5 -0
  61. package/dist/multibuild/resolve.js +63 -0
  62. package/dist/multibuild/resolve.js.map +1 -0
  63. package/dist/multibuild/utils.d.ts +10 -0
  64. package/dist/multibuild/utils.js +61 -0
  65. package/dist/multibuild/utils.js.map +1 -0
  66. package/dist/multibuild/validation-types/varlist.d.ts +7 -0
  67. package/dist/multibuild/validation-types/varlist.js +52 -0
  68. package/dist/multibuild/validation-types/varlist.js.map +1 -0
  69. package/package.json +91 -0
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runBuildTask = void 0;
4
+ const _ = require("lodash");
5
+ const semver = require("semver");
6
+ const build_1 = require("../build");
7
+ const errors_1 = require("./errors");
8
+ const external_1 = require("./external");
9
+ const local_image_1 = require("./local-image");
10
+ const manifests_1 = require("./manifests");
11
+ function taskHooks(task, docker, resolve) {
12
+ let startTime;
13
+ const setImageProperties = (image, layers, fromTags) => {
14
+ image.layers = layers;
15
+ image.baseImageTags = fromTags;
16
+ image.startTime = startTime;
17
+ image.endTime = Date.now();
18
+ image.dockerfile = task.dockerfile;
19
+ image.projectType = task.projectType;
20
+ };
21
+ return {
22
+ buildSuccess: (imageId, layers, fromTags) => {
23
+ const tag = task.tag != null ? task.tag : imageId;
24
+ const image = new local_image_1.LocalImage(docker, tag, task.serviceName, {
25
+ external: false,
26
+ successful: true,
27
+ });
28
+ setImageProperties(image, layers, fromTags);
29
+ resolve(image);
30
+ },
31
+ buildFailure: (error, layers, fromTags) => {
32
+ const image = new local_image_1.LocalImage(docker, layers[layers.length - 1], task.serviceName, { external: false, successful: false });
33
+ setImageProperties(image, layers, fromTags);
34
+ image.error = error;
35
+ resolve(image);
36
+ },
37
+ buildStream: (stream) => {
38
+ startTime = Date.now();
39
+ if (_.isFunction(task.streamHook)) {
40
+ task.streamHook(stream);
41
+ }
42
+ task.buildStream.pipe(stream);
43
+ },
44
+ };
45
+ }
46
+ const generateBuildArgs = (task, userArgs) => {
47
+ return {
48
+ buildargs: { ...task.args, ...userArgs },
49
+ };
50
+ };
51
+ const generateLabels = (task) => {
52
+ return {
53
+ labels: task.labels,
54
+ };
55
+ };
56
+ async function runBuildTask(task, docker, registrySecrets, secrets, buildArgs) {
57
+ const usePlatformOption = !!task.dockerPlatform &&
58
+ semver.satisfies(semver.coerce((await docker.version()).ApiVersion) || '0.0.0', '>=1.38.0') &&
59
+ (await checkAllowDockerPlatformHandling(task, docker));
60
+ task.dockerOpts = _.merge(usePlatformOption ? { platform: task.dockerPlatform } : {}, task.dockerOpts, { registryconfig: registrySecrets });
61
+ if (task.external) {
62
+ return (0, external_1.pullExternal)(task, docker);
63
+ }
64
+ const taskResolved = task.resolvedPromise || Promise.resolve();
65
+ return new Promise((resolve, reject) => {
66
+ taskResolved.then(() => {
67
+ if (task.buildStream == null) {
68
+ reject(new errors_1.BuildProcessError('Null build stream on non-external image'));
69
+ return;
70
+ }
71
+ let dockerOpts = task.dockerOpts || {};
72
+ dockerOpts = _.merge(dockerOpts, generateBuildArgs(task, buildArgs), generateLabels(task));
73
+ if (secrets != null && task.serviceName in secrets) {
74
+ if (dockerOpts.volumes == null) {
75
+ dockerOpts.volumes = [];
76
+ }
77
+ dockerOpts.volumes.push(`${secrets[task.serviceName].tmpDirectory}:/run/secrets:ro`);
78
+ }
79
+ if (task.tag != null) {
80
+ dockerOpts = _.merge(dockerOpts, { t: task.tag });
81
+ }
82
+ if (task.dockerfilePath != null) {
83
+ dockerOpts = _.merge(dockerOpts, {
84
+ dockerfile: task.dockerfilePath,
85
+ });
86
+ }
87
+ const builder = build_1.Builder.fromDockerode(docker);
88
+ const hooks = taskHooks(task, docker, resolve);
89
+ builder.createBuildStream(dockerOpts, hooks, reject);
90
+ });
91
+ });
92
+ }
93
+ exports.runBuildTask = runBuildTask;
94
+ async function checkAllowDockerPlatformHandling(task, docker) {
95
+ const imageReferences = [];
96
+ const debug = task.logger ? task.logger.debug : () => undefined;
97
+ const warn = task.logger ? task.logger.warn : () => undefined;
98
+ const checkHasPlatformInfo = async (repository) => {
99
+ try {
100
+ const manifest = await (0, manifests_1.getManifest)(docker.modem, repository);
101
+ return manifest.Descriptor.mediaType === manifests_1.MEDIATYPE_MANIFEST_LIST_V2;
102
+ }
103
+ catch {
104
+ }
105
+ debug(`${task.serviceName}: Image manifest data unavailable for ${repository}`);
106
+ return false;
107
+ };
108
+ if (task.imageName) {
109
+ imageReferences.push(task.imageName);
110
+ }
111
+ else {
112
+ if (!task.dockerfile) {
113
+ debug(`${task.serviceName}: Build task does not have an associated Dockerfile`);
114
+ return false;
115
+ }
116
+ const { DockerfileParser } = await Promise.resolve().then(() => require('dockerfile-ast'));
117
+ const parsedDockerfile = DockerfileParser.parse(task.dockerfile);
118
+ const dockerInstructions = parsedDockerfile.getInstructions();
119
+ const fromInstructions = dockerInstructions.filter((inst) => inst.getKeyword() === 'FROM');
120
+ if (fromInstructions.length === 0) {
121
+ debug(`${task.serviceName}: Dockerfile does not reference any images`);
122
+ return false;
123
+ }
124
+ for (const inst of fromInstructions) {
125
+ for (const arg of inst.getArguments()) {
126
+ const val = arg.getValue();
127
+ if (!val.startsWith('--')) {
128
+ imageReferences.push(val);
129
+ break;
130
+ }
131
+ }
132
+ }
133
+ }
134
+ const imagesWithoutPlatformSupport = [];
135
+ const imagesWithPlatformSupport = [];
136
+ await Promise.all(imageReferences.map(async (r) => {
137
+ const hasPlatformSupport = await checkHasPlatformInfo(r);
138
+ if (hasPlatformSupport) {
139
+ imagesWithPlatformSupport.push(r);
140
+ }
141
+ else {
142
+ imagesWithoutPlatformSupport.push(r);
143
+ }
144
+ }));
145
+ if (imagesWithoutPlatformSupport.length === 0) {
146
+ return true;
147
+ }
148
+ else if (imagesWithPlatformSupport.length > 0) {
149
+ warn(`\
150
+ Service '${task.serviceName}':
151
+ Multi-stage Dockerfile found with a mix of base images that require
152
+ CPU architecture selection and base images that do not support it.
153
+ The following base images do not support CPU architecture selection:
154
+ - ${imagesWithoutPlatformSupport.join('\n - ')}
155
+ The following base images require CPU architecture selection:
156
+ - ${imagesWithPlatformSupport.join('\n - ')}
157
+ As a result, the CPU architecture of the machine where the Docker Engine
158
+ is running will be used by default to select base images that require
159
+ architecture selection. This may result in incorrect architecture selection
160
+ and "exec format error" at runtime. It is usually possible to override the
161
+ architecture in the FROM line with e.g. "FROM --platform=linux/arm/v7",
162
+ or by adding the sha256 digest of the image for a specific architecture
163
+ with e.g. "FROM debian@sha256:094f57...".`);
164
+ }
165
+ return false;
166
+ }
167
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../lib/multibuild/build.ts"],"names":[],"mappings":";;;AAkBA,4BAA4B;AAC5B,iCAAiC;AAGjC,oCAA4D;AAI5D,qCAA6C;AAC7C,yCAA0C;AAC1C,+CAA2C;AAE3C,2CAAsE;AAEtE,SAAS,SAAS,CACjB,IAAe,E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AI,CAAC,CAAC,CAAC,CAAC;SACrC;IACF,CAAC,CAAC,CACF,CAAC;IAEF,IAAI,4BAA4B,CAAC,MAAM,KAAK,CAAC,EAAE;QAE9C,OAAO,IAAI,CAAC;KACZ;SAAM,IAAI,yBAAyB,CAAC,MAAM,GAAG,CAAC,EAAE;QAMhD,IAAI,CAAC;WACI,IAAI,CAAC,WAAW;;;;MAIrB,4BAA4B,CAAC,IAAI,CAAC,QAAQ,CAAC;;MAE3C,yBAAyB,CAAC,IAAI,CAAC,QAAQ,CAAC;;;;;;;4CAOF,CAAC,CAAC;KAC5C;IAGD,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const CANONICAL_HUB_URL = "https://index.docker.io/v1/";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CANONICAL_HUB_URL = void 0;
4
+ exports.CANONICAL_HUB_URL = 'https://index.docker.io/v1/';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../lib/multibuild/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,6BAA6B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ import type { BuildTask } from './build-task';
3
+ export declare const CONTRACT_TYPE = "sw.container";
4
+ export declare function isContractFile(filename: string): boolean;
5
+ export declare function processContract(buffer: Buffer): Dictionary<unknown>;
6
+ export declare function checkContractNamesUnique(tasks: BuildTask[]): void;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkContractNamesUnique = exports.processContract = exports.isContractFile = exports.CONTRACT_TYPE = void 0;
4
+ const jsYaml = require("js-yaml");
5
+ const _ = require("lodash");
6
+ const TarUtils = require("tar-utils");
7
+ const errors_1 = require("./errors");
8
+ exports.CONTRACT_TYPE = 'sw.container';
9
+ function isContractFile(filename) {
10
+ const normalized = TarUtils.normalizeTarEntry(filename);
11
+ return normalized === 'contract.yml' || normalized === 'contract.yaml';
12
+ }
13
+ exports.isContractFile = isContractFile;
14
+ function processContract(buffer) {
15
+ const parsedBuffer = jsYaml.load(buffer.toString('utf8'));
16
+ if (parsedBuffer == null || typeof parsedBuffer !== 'object') {
17
+ throw new errors_1.ContractValidationError('Container contract must be an object');
18
+ }
19
+ const contractObj = parsedBuffer;
20
+ if (contractObj.name == null) {
21
+ throw new errors_1.ContractValidationError('Container contract must have a name field');
22
+ }
23
+ if (contractObj.type == null) {
24
+ throw new errors_1.ContractValidationError('Container contract must have a type field');
25
+ }
26
+ if (contractObj.type !== exports.CONTRACT_TYPE) {
27
+ throw new errors_1.ContractValidationError(`Container contract must have a type of ${exports.CONTRACT_TYPE}`);
28
+ }
29
+ if (contractObj.slug == null) {
30
+ throw new errors_1.ContractValidationError('Container contract must have a slug field');
31
+ }
32
+ return contractObj;
33
+ }
34
+ exports.processContract = processContract;
35
+ function checkContractNamesUnique(tasks) {
36
+ const foundNames = {};
37
+ let unique = true;
38
+ tasks.forEach((t) => {
39
+ if (t.contract != null) {
40
+ const name = t.contract.name;
41
+ if (name in foundNames) {
42
+ foundNames[name].push(t.serviceName);
43
+ unique = false;
44
+ }
45
+ else {
46
+ foundNames[name] = [t.serviceName];
47
+ }
48
+ }
49
+ });
50
+ if (!unique) {
51
+ throw new errors_1.NonUniqueContractNameError(_.pickBy(foundNames, (names) => names.length > 1));
52
+ }
53
+ }
54
+ exports.checkContractNamesUnique = checkContractNamesUnique;
55
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../lib/multibuild/contracts.ts"],"names":[],"mappings":";;;AAgBA,kCAAkC;AAClC,4BAA4B;AAC5B,sCAAsC;AAGtC,qCAA+E;AAElE,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,SAAgB,cAAc,CAAC,QAAgB;IAC9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IAAI,UAAU,EAAE;gBACvB,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;gBACrC,MAAM,GAAG,KAAK,CAAC;aACf;iBAAM;gBACN,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;aACnC;SACD;IACF,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE;QACZ,MAAM,IAAI,mCAA0B,CACnC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CACjD,CAAC;KACF;AACF,CAAC;AApBD,4DAoBC"}
@@ -0,0 +1,43 @@
1
+ import { TypedError } from 'typed-error';
2
+ export declare class ImageRemovalError extends TypedError {
3
+ }
4
+ export declare class TarError extends TypedError {
5
+ }
6
+ export declare class BuildProcessError extends TypedError {
7
+ }
8
+ export declare class DockerCommunicationError extends TypedError {
9
+ }
10
+ export declare class RegistrySecretValidationError extends TypedError {
11
+ }
12
+ export declare class BalenaYMLValidationError extends TypedError {
13
+ }
14
+ export declare class BuildSecretMissingError extends TypedError {
15
+ }
16
+ export declare class SecretPopulationError extends TypedError {
17
+ }
18
+ export declare class SecretRemovalError extends TypedError {
19
+ }
20
+ export declare class UnsupportedDockerArchError extends TypedError {
21
+ }
22
+ export declare class MultipleMetadataDirectoryError extends TypedError {
23
+ }
24
+ export declare class MultipleBalenaConfigFilesError extends TypedError {
25
+ filesFound: string[];
26
+ constructor(filesFound: string[]);
27
+ }
28
+ export declare class ContractError extends TypedError {
29
+ }
30
+ export declare class MultipleContractsForService extends ContractError {
31
+ serviceName: string;
32
+ constructor(serviceName: string);
33
+ }
34
+ export declare class NonUniqueContractNameError extends ContractError {
35
+ nonUniqueNames: {
36
+ [contractName: string]: string[];
37
+ };
38
+ constructor(nonUniqueNames: {
39
+ [contractName: string]: string[];
40
+ });
41
+ }
42
+ export declare class ContractValidationError extends ContractError {
43
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContractValidationError = exports.NonUniqueContractNameError = exports.MultipleContractsForService = exports.ContractError = exports.MultipleBalenaConfigFilesError = exports.MultipleMetadataDirectoryError = exports.UnsupportedDockerArchError = exports.SecretRemovalError = exports.SecretPopulationError = exports.BuildSecretMissingError = exports.BalenaYMLValidationError = exports.RegistrySecretValidationError = exports.DockerCommunicationError = exports.BuildProcessError = exports.TarError = exports.ImageRemovalError = void 0;
4
+ const _ = require("lodash");
5
+ const typed_error_1 = require("typed-error");
6
+ class ImageRemovalError extends typed_error_1.TypedError {
7
+ }
8
+ exports.ImageRemovalError = ImageRemovalError;
9
+ class TarError extends typed_error_1.TypedError {
10
+ }
11
+ exports.TarError = TarError;
12
+ class BuildProcessError extends typed_error_1.TypedError {
13
+ }
14
+ exports.BuildProcessError = BuildProcessError;
15
+ class DockerCommunicationError extends typed_error_1.TypedError {
16
+ }
17
+ exports.DockerCommunicationError = DockerCommunicationError;
18
+ class RegistrySecretValidationError extends typed_error_1.TypedError {
19
+ }
20
+ exports.RegistrySecretValidationError = RegistrySecretValidationError;
21
+ class BalenaYMLValidationError extends typed_error_1.TypedError {
22
+ }
23
+ exports.BalenaYMLValidationError = BalenaYMLValidationError;
24
+ class BuildSecretMissingError extends typed_error_1.TypedError {
25
+ }
26
+ exports.BuildSecretMissingError = BuildSecretMissingError;
27
+ class SecretPopulationError extends typed_error_1.TypedError {
28
+ }
29
+ exports.SecretPopulationError = SecretPopulationError;
30
+ class SecretRemovalError extends typed_error_1.TypedError {
31
+ }
32
+ exports.SecretRemovalError = SecretRemovalError;
33
+ class UnsupportedDockerArchError extends typed_error_1.TypedError {
34
+ }
35
+ exports.UnsupportedDockerArchError = UnsupportedDockerArchError;
36
+ class MultipleMetadataDirectoryError extends typed_error_1.TypedError {
37
+ }
38
+ exports.MultipleMetadataDirectoryError = MultipleMetadataDirectoryError;
39
+ class MultipleBalenaConfigFilesError extends typed_error_1.TypedError {
40
+ constructor(filesFound) {
41
+ super();
42
+ this.filesFound = filesFound;
43
+ }
44
+ }
45
+ exports.MultipleBalenaConfigFilesError = MultipleBalenaConfigFilesError;
46
+ class ContractError extends typed_error_1.TypedError {
47
+ }
48
+ exports.ContractError = ContractError;
49
+ class MultipleContractsForService extends ContractError {
50
+ constructor(serviceName) {
51
+ super(`Multiple contracts found for service ${serviceName}`);
52
+ this.serviceName = serviceName;
53
+ }
54
+ }
55
+ exports.MultipleContractsForService = MultipleContractsForService;
56
+ class NonUniqueContractNameError extends ContractError {
57
+ constructor(nonUniqueNames) {
58
+ super();
59
+ this.nonUniqueNames = nonUniqueNames;
60
+ let message = 'Some services have the same contract name, which must be unique:\n';
61
+ _.each(nonUniqueNames, (serviceNames, name) => {
62
+ message += ` ${name}: ${serviceNames.join(', ')}`;
63
+ });
64
+ this.message = message;
65
+ }
66
+ }
67
+ exports.NonUniqueContractNameError = NonUniqueContractNameError;
68
+ class ContractValidationError extends ContractError {
69
+ }
70
+ exports.ContractValidationError = ContractValidationError;
71
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/multibuild/errors.ts"],"names":[],"mappings":";;;AAiBA,4BAA4B;AAC5B,6CAAyC;AAMzC,MAAa,iBAAkB,SAAQ,wBAAU;CAAG;AAApD,8CAAoD;AAMpD,MAAa,QAAS,SAAQ,wBAAU;CAAG;AAA3C,4BAA2C;AAS3C,MAAa,iBAAkB,SAAQ,wBAAU;CAAG;AAApD,8CAAoD;AAMpD,MAAa,wBAAyB,SAAQ,wBAAU;CAAG;AAA3D,4DAA2D;AAK3D,MAAa,6BAA8B,SAAQ,wBAAU;CAAG;AAAhE,sEAAgE;AAKhE,MAAa,wBAAyB,SAAQ,wBAAU;CAAG;AAA3D,4DAA2D;AAO3D,MAAa,uBAAwB,SAAQ,wBAAU;CAAG;AAA1D,0DAA0D;AAM1D,MAAa,qBAAsB,SAAQ,wBAAU;CAAG;AAAxD,sDAAwD;AAKxD,MAAa,kBAAmB,SAAQ,wBAAU;CAAG;AAArD,gDAAqD;AAIrD,MAAa,0BAA2B,SAAQ,wBAAU;CAAG;AAA7D,gEAA6D;AAE7D,MAAa,8BAA+B,SAAQ,wBAAU;CAAG;AAAjE,wEAAiE;AAEjE,MAAa,8BAA+B,SAAQ,wBAAU;IAC7D,YAA0B,UAAoB;QAC7C,KAAK,EAAE,CAAC;QADiB,eAAU,GAAV,UAAU,CAAU;IAE9C,CAAC;CACD;AAJD,wEAIC;AAKD,MAAa,aAAc,SAAQ,wBAAU;CAAG;AAAhD,sCAAgD;AAEhD,MAAa,2BAA4B,SAAQ,aAAa;IAC7D,YAA0B,WAAmB;QAC5C,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QADpC,gBAAW,GAAX,WAAW,CAAQ;IAE7C,CAAC;CACD;AAJD,kEAIC;AAED,MAAa,0BAA2B,SAAQ,aAAa;IAC5D,YACQ,cAAoD;QAE3D,KAAK,EAAE,CAAC;QAFD,mBAAc,GAAd,cAAc,CAAsC;QAG3D,IAAI,OAAO,GACV,oEAAoE,CAAC;QACtE,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE;YAC7C,OAAO,IAAI,KAAK,IAAI,KAAK,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD;AAZD,gEAYC;AAED,MAAa,uBAAwB,SAAQ,aAAa;CAAG;AAA7D,0DAA6D"}
@@ -0,0 +1,5 @@
1
+ import * as Bluebird from 'bluebird';
2
+ import type * as Dockerode from 'dockerode';
3
+ import type { BuildTask } from './build-task';
4
+ import { LocalImage } from './local-image';
5
+ export declare function pullExternal(task: BuildTask, docker: Dockerode): Bluebird<LocalImage>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pullExternal = void 0;
4
+ const Bluebird = require("bluebird");
5
+ const docker_progress_1 = require("docker-progress");
6
+ const _ = require("lodash");
7
+ const errors_1 = require("./errors");
8
+ const local_image_1 = require("./local-image");
9
+ const registry_secrets_1 = require("./registry-secrets");
10
+ const hasImageTag = (name) => {
11
+ const tagRegex = /^.+:[^/]+$/;
12
+ return tagRegex.test(name);
13
+ };
14
+ function pullExternal(task, docker) {
15
+ const dockerProgress = new docker_progress_1.DockerProgress({ docker });
16
+ const progressHook = _.isFunction(task.progressHook)
17
+ ? task.progressHook
18
+ : _.noop;
19
+ if (task.imageName == null) {
20
+ throw new errors_1.BuildProcessError('No image name given for an external image');
21
+ }
22
+ let imageName = task.imageName;
23
+ if (!hasImageTag(imageName)) {
24
+ imageName += ':latest';
25
+ }
26
+ const opts = task.dockerOpts || {};
27
+ let authConfigPromise = {};
28
+ if (opts.registryconfig) {
29
+ authConfigPromise = (0, registry_secrets_1.getAuthConfigObj)(imageName, opts.registryconfig);
30
+ }
31
+ const startTime = Date.now();
32
+ return Bluebird.resolve(authConfigPromise)
33
+ .then((authConfig) => {
34
+ if (authConfig && Object.keys(authConfig).length > 0) {
35
+ opts.authconfig = authConfig;
36
+ }
37
+ return dockerProgress.pull(imageName, progressHook, opts);
38
+ })
39
+ .then(() => {
40
+ const image = new local_image_1.LocalImage(docker, imageName, task.serviceName, {
41
+ external: true,
42
+ successful: true,
43
+ });
44
+ image.startTime = startTime;
45
+ image.endTime = Date.now();
46
+ image.projectType = 'external service';
47
+ return image;
48
+ })
49
+ .catch((e) => {
50
+ const image = new local_image_1.LocalImage(docker, null, task.serviceName, {
51
+ external: true,
52
+ successful: false,
53
+ });
54
+ image.error = e;
55
+ image.startTime = startTime;
56
+ image.endTime = Date.now();
57
+ image.projectType = 'external service';
58
+ return image;
59
+ });
60
+ }
61
+ exports.pullExternal = pullExternal;
62
+ //# sourceMappingURL=external.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external.js","sourceRoot":"","sources":["../../lib/multibuild/external.ts"],"names":[],"mappings":";;;AAgBA,qCAAqC;AACrC,qDAAiD;AAEjD,4BAA4B;AAG5B,qCAA6C;AAC7C,+CAA2C;AAC3C,yDAAsD;AAEtD,MAAM,WAAW,GAAG,CAAC,IAAY,EAAW,EAAE;IAC7C,MAAM,QAAQ,GAAG,YAAY,CAAC;IAC9B,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC;AAOF,SAAgB,YAAY,CAC3B,IAAe,EACf,MAAiB;IAEjB,MAAM,cAAc,GAAG,IAAI,gCAAc,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;QACnD,CAAC,CAAC,IAAI,CAAC,YAAY;QACnB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEV,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;QAC3B,MAAM,IAAI,0BAAiB,CAAC,2CAA2C,CAAC,CAAC;KACzE;IACD,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;IAE/B,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;QAC5B,SAAS,IAAI,SAAS,CAAC;KACvB;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;IACnC,IAAI,iBAAiB,GAAsC,EAAE,CAAC;IAC9D,IAAI,IAAI,CAAC,cAAc,EAAE;QACxB,iBAAiB,GAAG,IAAA,mCAAgB,EAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;KACrE;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,OAAO,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC;SACxC,IAAI,CAAC,CAAC,UAA+B,EAAE,EAAE;QACzC,IAAI,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAC7B;QACD,OAAO,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACV,MAAM,KAAK,GAAG,IAAI,wBAAU,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE;YACjE,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;QAC5B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,GAAG,kBAAkB,CAAC;QACvC,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,IAAI,wBAAU,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5D,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QAChB,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;QAC5B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,GAAG,kBAAkB,CAAC;QACvC,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAtDD,oCAsDC"}
@@ -0,0 +1,33 @@
1
+ /// <reference types="node" />
2
+ import type * as Dockerode from 'dockerode';
3
+ import * as Compose from '@balena/compose-parse';
4
+ import type * as Stream from 'stream';
5
+ import { BalenaYml, ParsedBalenaYml, SecretsPopulationMap } from './build-secrets';
6
+ import type { BuildTask } from './build-task';
7
+ import type { LocalImage } from './local-image';
8
+ import * as PathUtils from './path-utils';
9
+ import type { RegistrySecrets } from './registry-secrets';
10
+ import { ResolveListeners } from './resolve';
11
+ export { QEMU_BIN_NAME } from './build-metadata';
12
+ export * from './build-task';
13
+ export * from './errors';
14
+ export * from './local-image';
15
+ export * from './registry-secrets';
16
+ export { resolveDockerPlatform } from './resolve';
17
+ export { getRegistryAndName } from './utils';
18
+ export { BalenaYml, ParsedBalenaYml };
19
+ export { PathUtils };
20
+ export { ResolveListeners };
21
+ export { CANONICAL_HUB_URL } from './constants';
22
+ export declare function splitBuildStream(composition: Compose.Composition, buildStream: Stream.Readable): Promise<BuildTask[]>;
23
+ export declare function fromImageDescriptors(images: Compose.ImageDescriptor[], buildStream: Stream.Readable, metadataDirectories?: string[]): Promise<BuildTask[]>;
24
+ export declare function buildHasSecrets(tasks: BuildTask[]): boolean;
25
+ export declare function performResolution(tasks: BuildTask[], architecture: string, deviceType: string, resolveListeners: ResolveListeners, additionalTemplateVars?: Dictionary<string>, dockerfilePreprocessHook?: (dockerfile: string) => string): BuildTask[];
26
+ export declare function performSingleResolution(task: BuildTask, architecture: string, deviceType: string, resolveListeners: ResolveListeners, additionalTemplateVars?: Dictionary<string>, dockerfilePreprocessHook?: (dockerfile: string) => string): BuildTask;
27
+ export declare function performBuilds(tasks: BuildTask[], docker: Dockerode, tmpDir: string): Promise<LocalImage[]>;
28
+ export declare function initializeBuildMetadata(tasks: BuildTask[], docker: Dockerode, tmpDir: string): Promise<{
29
+ secrets: SecretsPopulationMap;
30
+ regSecrets: RegistrySecrets;
31
+ architecture: string;
32
+ }>;
33
+ export declare function performSingleBuild(task: BuildTask, docker: Dockerode, registrySecrets: RegistrySecrets, secretMap?: SecretsPopulationMap, buildArgs?: Dictionary<string>): Promise<LocalImage>;