apify-test-tools 0.8.7-beta.0 → 0.8.7-beta.2
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/CHANGELOG.md +5 -0
- package/README.md +83 -13
- package/bin/build-from-local.ts +35 -34
- package/bin/build.ts +55 -59
- package/bin/diff-changes.ts +166 -125
- package/bin/dockerignore.ts +50 -0
- package/bin/main.ts +7 -7
- package/bin/path-utils.ts +13 -0
- package/bin/test-report.ts +5 -5
- package/bin/types.ts +17 -5
- package/bin/utils.ts +122 -95
- package/dist/bin/build-from-local.d.ts +2 -2
- package/dist/bin/build-from-local.d.ts.map +1 -1
- package/dist/bin/build-from-local.js +33 -28
- package/dist/bin/build-from-local.js.map +1 -1
- package/dist/bin/build.d.ts +5 -8
- package/dist/bin/build.d.ts.map +1 -1
- package/dist/bin/build.js +49 -56
- package/dist/bin/build.js.map +1 -1
- package/dist/bin/diff-changes.d.ts +0 -6
- package/dist/bin/diff-changes.d.ts.map +1 -1
- package/dist/bin/diff-changes.js +129 -89
- package/dist/bin/diff-changes.js.map +1 -1
- package/dist/bin/dockerignore.d.ts +17 -0
- package/dist/bin/dockerignore.d.ts.map +1 -0
- package/dist/bin/dockerignore.js +41 -0
- package/dist/bin/dockerignore.js.map +1 -0
- package/dist/bin/main.js +7 -7
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/path-utils.d.ts +4 -0
- package/dist/bin/path-utils.d.ts.map +1 -0
- package/dist/bin/path-utils.js +9 -0
- package/dist/bin/path-utils.js.map +1 -0
- package/dist/bin/test-report.js +3 -3
- package/dist/bin/test-report.js.map +1 -1
- package/dist/bin/types.d.ts +15 -4
- package/dist/bin/types.d.ts.map +1 -1
- package/dist/bin/utils.d.ts +2 -19
- package/dist/bin/utils.d.ts.map +1 -1
- package/dist/bin/utils.js +82 -81
- package/dist/bin/utils.js.map +1 -1
- package/dist/lib/consts.d.ts +6 -0
- package/dist/lib/consts.d.ts.map +1 -1
- package/dist/lib/consts.js +6 -0
- package/dist/lib/consts.js.map +1 -1
- package/dist/lib/lib.d.ts +10 -4
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +31 -25
- package/dist/lib/lib.js.map +1 -1
- package/dist/lib/types.d.ts +2 -2
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -4
- package/dist/lib/utils.js.map +1 -1
- package/dist/test/unit/bin/build-from-local.test.js +55 -86
- package/dist/test/unit/bin/build-from-local.test.js.map +1 -1
- package/dist/test/unit/bin/diff-changes.test.js +358 -36
- package/dist/test/unit/bin/diff-changes.test.js.map +1 -1
- package/dist/test/unit/bin/dockerignore.test.d.ts +2 -0
- package/dist/test/unit/bin/dockerignore.test.d.ts.map +1 -0
- package/dist/test/unit/bin/dockerignore.test.js +102 -0
- package/dist/test/unit/bin/dockerignore.test.js.map +1 -0
- package/dist/test/unit/bin/path-utils.test.d.ts +2 -0
- package/dist/test/unit/bin/path-utils.test.d.ts.map +1 -0
- package/dist/test/unit/bin/path-utils.test.js +14 -0
- package/dist/test/unit/bin/path-utils.test.js.map +1 -0
- package/dist/test/unit/bin/utils.test.d.ts +2 -0
- package/dist/test/unit/bin/utils.test.d.ts.map +1 -0
- package/dist/test/unit/bin/utils.test.js +293 -0
- package/dist/test/unit/bin/utils.test.js.map +1 -0
- package/dist/test/unit/should-built-and-test.test.js +83 -32
- package/dist/test/unit/should-built-and-test.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/consts.ts +7 -0
- package/lib/lib.ts +31 -25
- package/lib/types.ts +2 -2
- package/lib/utils.ts +4 -4
- package/package.json +6 -5
- package/test/unit/bin/build-from-local.test.ts +62 -121
- package/test/unit/bin/diff-changes.test.ts +397 -41
- package/test/unit/bin/dockerignore.test.ts +123 -0
- package/test/unit/bin/path-utils.test.ts +17 -0
- package/test/unit/bin/utils.test.ts +343 -0
- package/test/unit/should-built-and-test.test.ts +89 -32
package/bin/utils.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import fsSync from 'node:fs';
|
|
3
2
|
import fs from 'node:fs/promises';
|
|
4
|
-
import os from 'node:os';
|
|
5
3
|
import path from 'node:path';
|
|
6
4
|
|
|
7
5
|
import type { ActorVersionSourceFile } from 'apify-client';
|
|
8
6
|
|
|
9
7
|
import { SOURCE_FILE_FORMATS } from '@apify/consts';
|
|
10
8
|
|
|
11
|
-
import
|
|
9
|
+
import { isPathWithinScope } from './path-utils.js';
|
|
10
|
+
import type { ActorConfig, ActorConfigFile } from './types.js';
|
|
12
11
|
|
|
13
12
|
// Returns true when `childPath` is not inside `parentPath`.
|
|
14
13
|
// Used to detect monorepo actors whose dockerContextDir escapes the actor directory.
|
|
@@ -59,65 +58,6 @@ export const getGitignoredPaths = (relativePaths: string[]): Set<string> => {
|
|
|
59
58
|
return new Set(result.stdout.toString().split('\n').filter(Boolean));
|
|
60
59
|
};
|
|
61
60
|
|
|
62
|
-
// Docker normalizes each pattern before matching, so a leading "./" (as in the common "./node_modules"
|
|
63
|
-
// style) is a no-op for Docker. git's ignore engine has no such normalization — it treats "./" as
|
|
64
|
-
// literal pattern text that can never match a real path, so a .dockerignore written in that style
|
|
65
|
-
// would otherwise silently match nothing under git. Strip it here (after any negation prefix) so
|
|
66
|
-
// git sees the same effective pattern Docker would.
|
|
67
|
-
const normalizeDockerignorePattern = (line: string): string => line.replace(/^(!?)(?:\.\/)+/, '$1');
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Given paths relative to `rootDir`, returns the subset that a `.dockerignore` file sitting at
|
|
71
|
-
* `rootDir` would exclude — mirroring getGitignoredPaths, but for Docker's own ignore file. `git
|
|
72
|
-
* check-ignore` has no built-in notion of .dockerignore, but pointing `core.excludesFile` at a
|
|
73
|
-
* normalized copy of it for a single invocation makes git apply its patterns exactly like a
|
|
74
|
-
* .gitignore, without re-implementing gitignore-style pattern matching ourselves. A missing
|
|
75
|
-
* .dockerignore is a no-op (empty set), so there's no need to check for its existence first.
|
|
76
|
-
*
|
|
77
|
-
* Crucially this passes `--no-index`: by default git never reports an already-tracked file as
|
|
78
|
-
* ignored (that's how real .gitignore semantics work — tracked files aren't affected by ignore
|
|
79
|
-
* rules), but Docker excludes a matching path from the build context unconditionally, regardless
|
|
80
|
-
* of git tracking. `--no-index` makes git apply the patterns uniformly, matching Docker's behavior.
|
|
81
|
-
*/
|
|
82
|
-
export const getDockerignoredPaths = (rootDir: string, relativePaths: string[]): Set<string> => {
|
|
83
|
-
if (relativePaths.length === 0) return new Set();
|
|
84
|
-
|
|
85
|
-
let dockerignoreContent: string;
|
|
86
|
-
try {
|
|
87
|
-
dockerignoreContent = fsSync.readFileSync(path.join(rootDir, '.dockerignore'), 'utf8');
|
|
88
|
-
} catch {
|
|
89
|
-
return new Set();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const normalizedContent = dockerignoreContent.split('\n').map(normalizeDockerignorePattern).join('\n');
|
|
93
|
-
|
|
94
|
-
const tempDir = fsSync.mkdtempSync(path.join(os.tmpdir(), 'apify-dockerignore-'));
|
|
95
|
-
try {
|
|
96
|
-
const normalizedPath = path.join(tempDir, '.dockerignore');
|
|
97
|
-
fsSync.writeFileSync(normalizedPath, normalizedContent);
|
|
98
|
-
|
|
99
|
-
const result = spawnSync(
|
|
100
|
-
'git',
|
|
101
|
-
['-c', `core.excludesFile=${normalizedPath}`, 'check-ignore', '--no-index', '--stdin'],
|
|
102
|
-
{
|
|
103
|
-
cwd: rootDir,
|
|
104
|
-
input: relativePaths.join('\n'),
|
|
105
|
-
maxBuffer: 100 * 1024 * 1024,
|
|
106
|
-
},
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
// Exit code 1 means none of the given paths are ignored - not an error. Anything else
|
|
110
|
-
// (e.g. 128 for "not a git repository") is a real failure.
|
|
111
|
-
if (result.status !== 0 && result.status !== 1) {
|
|
112
|
-
throw new Error(`[Command failed]: git check-ignore (dockerignore)\n${result.stderr.toString()}`);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return new Set(result.stdout.toString().split('\n').filter(Boolean));
|
|
116
|
-
} finally {
|
|
117
|
-
fsSync.rmSync(tempDir, { recursive: true, force: true });
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
61
|
const isBinary = (buffer: Buffer): boolean => buffer.includes(0);
|
|
122
62
|
|
|
123
63
|
export const toActorVersionSourceFile = async (absPath: string, rootDir: string): Promise<ActorVersionSourceFile> => {
|
|
@@ -154,50 +94,137 @@ export const getEnvVar = (varName: string, defaultValue?: string): string => {
|
|
|
154
94
|
return value;
|
|
155
95
|
};
|
|
156
96
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
97
|
+
export const CONFIG_FILE_NAME = 'apify-test-tools.config.json';
|
|
98
|
+
|
|
99
|
+
// Strips a trailing slash so config-declared paths ("actors/shopify/" vs "actors/shopify") compare equal.
|
|
100
|
+
const stripTrailingSlash = (pathValue: string): string => pathValue.replace(/\/+$/, '');
|
|
101
|
+
|
|
102
|
+
const findOverlappingContextPaths = (contextPaths: string[]): [string, string] | undefined => {
|
|
103
|
+
for (let i = 0; i < contextPaths.length; i++) {
|
|
104
|
+
for (let j = i + 1; j < contextPaths.length; j++) {
|
|
105
|
+
if (
|
|
106
|
+
isPathWithinScope(contextPaths[i], contextPaths[j]) ||
|
|
107
|
+
isPathWithinScope(contextPaths[j], contextPaths[i])
|
|
108
|
+
) {
|
|
109
|
+
return [contextPaths[i], contextPaths[j]];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const readConfigFile = async (): Promise<ActorConfig[]> => {
|
|
117
|
+
let raw: string;
|
|
163
118
|
try {
|
|
164
|
-
|
|
119
|
+
raw = await fs.readFile(CONFIG_FILE_NAME, 'utf-8');
|
|
165
120
|
} catch {
|
|
166
|
-
|
|
167
|
-
|
|
121
|
+
throw new Error(
|
|
122
|
+
`Config file "${CONFIG_FILE_NAME}" not found in the current directory. ` +
|
|
123
|
+
`Please create one with the required actor entries.`,
|
|
124
|
+
);
|
|
168
125
|
}
|
|
169
|
-
|
|
126
|
+
|
|
127
|
+
let config: ActorConfigFile;
|
|
170
128
|
try {
|
|
171
|
-
|
|
129
|
+
config = JSON.parse(raw);
|
|
172
130
|
} catch {
|
|
173
|
-
|
|
174
|
-
|
|
131
|
+
throw new Error(`Config file "${CONFIG_FILE_NAME}" contains invalid JSON.`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (!Array.isArray(config.actors)) {
|
|
135
|
+
throw new Error(`Config file "${CONFIG_FILE_NAME}" must have an "actors" array at the top level.`);
|
|
175
136
|
}
|
|
137
|
+
|
|
138
|
+
const seenFolders = new Set<string>();
|
|
176
139
|
const actorConfigs: ActorConfig[] = [];
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (
|
|
180
|
-
throw new Error(
|
|
140
|
+
|
|
141
|
+
for (const [index, entry] of config.actors.entries()) {
|
|
142
|
+
if (typeof entry.folder !== 'string') {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`Invalid "folder" for actor entry at index ${index} in "${CONFIG_FILE_NAME}". ` +
|
|
145
|
+
`Must be a string (use "." for a single-actor repo).`,
|
|
146
|
+
);
|
|
181
147
|
}
|
|
182
|
-
|
|
148
|
+
|
|
149
|
+
const folder = entry.folder === '.' ? '' : stripTrailingSlash(entry.folder);
|
|
150
|
+
|
|
151
|
+
if (seenFolders.has(folder)) {
|
|
152
|
+
throw new Error(
|
|
153
|
+
`Duplicate folder "${entry.folder}" in "${CONFIG_FILE_NAME}". Each actor must have a unique folder.`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
seenFolders.add(folder);
|
|
157
|
+
|
|
158
|
+
const nameParts = entry.actorFullName?.split('/');
|
|
159
|
+
if (!nameParts || nameParts.length !== 2 || !nameParts[0] || !nameParts[1]) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Invalid "actorFullName" for folder "${entry.folder}" in "${CONFIG_FILE_NAME}". ` +
|
|
162
|
+
`Must be in "owner/name" format (e.g. "apify/web-scraper").`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (entry.overrideActorContext !== undefined) {
|
|
167
|
+
if (
|
|
168
|
+
!Array.isArray(entry.overrideActorContext) ||
|
|
169
|
+
!entry.overrideActorContext.every((p) => typeof p === 'string')
|
|
170
|
+
) {
|
|
171
|
+
throw new Error(
|
|
172
|
+
`Invalid "overrideActorContext" for folder "${entry.folder}" in "${CONFIG_FILE_NAME}". ` +
|
|
173
|
+
`Must be an array of strings.`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const actorJsonPath = folder ? `${folder}/.actor/actor.json` : '.actor/actor.json';
|
|
179
|
+
|
|
180
|
+
let actorJson: { dockerContextDir?: string };
|
|
181
|
+
try {
|
|
182
|
+
actorJson = JSON.parse(await fs.readFile(actorJsonPath, 'utf-8'));
|
|
183
|
+
} catch {
|
|
184
|
+
throw new Error(
|
|
185
|
+
`Cannot read "${actorJsonPath}". Every actor entry in "${CONFIG_FILE_NAME}" ` +
|
|
186
|
+
`must have a corresponding .actor/actor.json file.`,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const actorDotDir = folder ? `${folder}/.actor` : '.actor';
|
|
191
|
+
const rawDockerContextDir = actorJson.dockerContextDir ?? '..';
|
|
192
|
+
const resolved = path.resolve(process.cwd(), actorDotDir, rawDockerContextDir);
|
|
193
|
+
const dockerContextDir = path.relative(process.cwd(), resolved);
|
|
194
|
+
|
|
195
|
+
if (dockerContextDir.startsWith('..')) {
|
|
196
|
+
throw new Error(
|
|
197
|
+
`"dockerContextDir" for folder "${entry.folder}" resolves outside the repository root. ` +
|
|
198
|
+
`Resolved path: "${dockerContextDir}".`,
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const normalizedDockerContextDir = dockerContextDir === '.' ? '' : dockerContextDir;
|
|
203
|
+
const contextPaths = (entry.overrideActorContext ?? [normalizedDockerContextDir]).map(stripTrailingSlash);
|
|
204
|
+
|
|
205
|
+
// The actor's own folder is always part of its context. When an explicit "overrideActorContext"
|
|
206
|
+
// doesn't already cover it, add it automatically instead of failing the workflow.
|
|
207
|
+
if (!contextPaths.some((contextPath) => isPathWithinScope(folder, contextPath))) {
|
|
208
|
+
contextPaths.push(folder);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const overlap = findOverlappingContextPaths(contextPaths);
|
|
212
|
+
if (overlap) {
|
|
213
|
+
throw new Error(
|
|
214
|
+
`Invalid context paths for folder "${entry.folder}" in "${CONFIG_FILE_NAME}": ` +
|
|
215
|
+
`"${overlap[0]}" and "${overlap[1]}" overlap. Context paths must not be prefixes of one another.`,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
183
219
|
actorConfigs.push({
|
|
184
|
-
|
|
185
|
-
folder
|
|
186
|
-
|
|
220
|
+
actorFullName: entry.actorFullName,
|
|
221
|
+
folder,
|
|
222
|
+
tokenEnvVar: entry.tokenEnvVar,
|
|
223
|
+
dockerContextDir: normalizedDockerContextDir,
|
|
224
|
+
contextPaths,
|
|
187
225
|
});
|
|
188
226
|
}
|
|
189
|
-
|
|
190
|
-
`Actors in repo: ${actorConfigs
|
|
191
|
-
.filter(({ isStandalone }) => !isStandalone)
|
|
192
|
-
.map(({ actorName }) => actorName)
|
|
193
|
-
.join(', ')}`,
|
|
194
|
-
);
|
|
195
|
-
console.error(
|
|
196
|
-
`Standalone actors in repo: ${actorConfigs
|
|
197
|
-
.filter(({ isStandalone }) => !!isStandalone)
|
|
198
|
-
.map(({ actorName }) => actorName)
|
|
199
|
-
.join(', ')}`,
|
|
200
|
-
);
|
|
227
|
+
|
|
201
228
|
return actorConfigs;
|
|
202
229
|
};
|
|
203
230
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ActorVersionSourceFile } from 'apify-client';
|
|
2
2
|
import type { ActorConfig, BuildData } from './types.js';
|
|
3
3
|
export declare const collectSourceFiles: (actorName: string, actorDir: string) => Promise<ActorVersionSourceFile[]>;
|
|
4
|
-
export declare const collectNonIgnoredFiles: (
|
|
5
|
-
export declare const flattenMonorepoContext: (actorName: string, absActorDir: string, contextAbsDir: string, actorJson: Record<string, unknown>, keptContextFiles: string[]
|
|
4
|
+
export declare const collectNonIgnoredFiles: (dockerContextDir: string, repoRoot: string) => string[];
|
|
5
|
+
export declare const flattenMonorepoContext: (actorName: string, absActorDir: string, contextAbsDir: string, actorJson: Record<string, unknown>, keptContextFiles: string[]) => Promise<{
|
|
6
6
|
tempDir: string;
|
|
7
7
|
filePaths: string[];
|
|
8
8
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-from-local.d.ts","sourceRoot":"","sources":["../../bin/build-from-local.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"build-from-local.d.ts","sourceRoot":"","sources":["../../bin/build-from-local.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAK3D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAUzD,eAAO,MAAM,kBAAkB,GAAU,WAAW,MAAM,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,sBAAsB,EAAE,CAmC9G,CAAC;AAWF,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,MAAM,EAAE,UAAU,MAAM,KAAG,MAAM,EAoBzF,CAAC;AAaF,eAAO,MAAM,sBAAsB,GAC/B,WAAW,MAAM,EACjB,aAAa,MAAM,EACnB,eAAe,MAAM,EACrB,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,kBAAkB,MAAM,EAAE,KAC3B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAyClD,CAAC;AAcF,eAAO,MAAM,qBAAqB,GAC9B,aAAa,MAAM,EACnB,eAAe,MAAM,EACrB,SAAS,MAAM,EACf,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACnC,OAAO,CAAC,IAAI,CAqBd,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,2BAGtC;IACC,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;CACnB,KAAG,OAAO,CAAC,SAAS,EAAE,CA4BtB,CAAC"}
|
|
@@ -2,7 +2,9 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { ApifyBuilder, waitAndSummarizeBuilds } from './build.js';
|
|
5
|
-
import {
|
|
5
|
+
import { buildDockerIgnoreMatcher } from './dockerignore.js';
|
|
6
|
+
import { isPathWithinScope } from './path-utils.js';
|
|
7
|
+
import { getGitignoredPaths, isOutsideDir, listRepoFilePaths, toActorVersionSourceFile } from './utils.js';
|
|
6
8
|
// JUST IN CASE. File patterns that commonly hold credentials — never ship these into a build, regardless
|
|
7
9
|
// of sourceType or of whether the repo's .gitignore happens to list them. Everything else that should be
|
|
8
10
|
// excluded (build output, local overrides, project-specific secret files, ...) is expected to already be
|
|
@@ -20,12 +22,12 @@ export const collectSourceFiles = async (actorName, actorDir) => {
|
|
|
20
22
|
const rawContextDir = actorJson.dockerContextDir;
|
|
21
23
|
const contextAbsDir = rawContextDir ? path.resolve(absActorDir, '.actor', rawContextDir) : undefined;
|
|
22
24
|
const isMonorepoActor = !!contextAbsDir && isOutsideDir(contextAbsDir, absActorDir);
|
|
23
|
-
const
|
|
24
|
-
const keptFilePaths = collectNonIgnoredFiles(
|
|
25
|
+
const dockerContextDirAbs = isMonorepoActor ? contextAbsDir : absActorDir;
|
|
26
|
+
const keptFilePaths = collectNonIgnoredFiles(dockerContextDirAbs, repoRoot);
|
|
25
27
|
if (!isMonorepoActor) {
|
|
26
|
-
return Promise.all(keptFilePaths.map(async (filePath) => toActorVersionSourceFile(filePath,
|
|
28
|
+
return Promise.all(keptFilePaths.map(async (filePath) => toActorVersionSourceFile(filePath, dockerContextDirAbs)));
|
|
27
29
|
}
|
|
28
|
-
const { tempDir, filePaths } = await flattenMonorepoContext(actorName, absActorDir, contextAbsDir, actorJson, keptFilePaths
|
|
30
|
+
const { tempDir, filePaths } = await flattenMonorepoContext(actorName, absActorDir, contextAbsDir, actorJson, keptFilePaths);
|
|
29
31
|
try {
|
|
30
32
|
return await Promise.all(filePaths.map(async (filePath) => toActorVersionSourceFile(filePath, tempDir)));
|
|
31
33
|
}
|
|
@@ -38,19 +40,19 @@ export const collectSourceFiles = async (actorName, actorDir) => {
|
|
|
38
40
|
// manual directory walk — nested .gitignore files, `.git/info/exclude`, and global excludes are
|
|
39
41
|
// all honored since this delegates to git itself instead of re-implementing gitignore matching,
|
|
40
42
|
// and .git/ is never walked because git never lists its own internals here. `.dockerignore` at
|
|
41
|
-
// `
|
|
42
|
-
// reach a real Docker build either. `.actor/` (the Actor specification folder) is always kept
|
|
43
|
+
// `dockerContextDir` (the Docker build context) is honored the same way, since those files would
|
|
44
|
+
// never reach a real Docker build either. `.actor/` (the Actor specification folder) is always kept
|
|
43
45
|
// regardless of .gitignore/.dockerignore, matching Apify CLI's own behavior. Files matching the
|
|
44
46
|
// hardcoded secret-pattern backstop (keys, certs, .env variants) are dropped unconditionally,
|
|
45
47
|
// .actor/ included, since those should never ship regardless of what the ignore files say.
|
|
46
|
-
export const collectNonIgnoredFiles = (
|
|
47
|
-
const relativePaths = listRepoFilePaths(repoRoot,
|
|
48
|
+
export const collectNonIgnoredFiles = (dockerContextDir, repoRoot) => {
|
|
49
|
+
const relativePaths = listRepoFilePaths(repoRoot, dockerContextDir);
|
|
48
50
|
const ignoredPaths = getGitignoredPaths(relativePaths);
|
|
49
51
|
const rootRelativePaths = new Map(relativePaths.map((relPath) => [
|
|
50
52
|
relPath,
|
|
51
|
-
path.relative(
|
|
53
|
+
path.relative(dockerContextDir, path.join(repoRoot, relPath)).split(path.sep).join('/'),
|
|
52
54
|
]));
|
|
53
|
-
const
|
|
55
|
+
const isDockerIgnored = buildDockerIgnoreMatcher(dockerContextDir);
|
|
54
56
|
return relativePaths
|
|
55
57
|
.filter((relPath) => {
|
|
56
58
|
if (isSecretFile(path.basename(relPath)))
|
|
@@ -60,7 +62,7 @@ export const collectNonIgnoredFiles = (rootDir, repoRoot) => {
|
|
|
60
62
|
return true;
|
|
61
63
|
if (ignoredPaths.has(relPath))
|
|
62
64
|
return false;
|
|
63
|
-
return !
|
|
65
|
+
return !isDockerIgnored(rootRelativePaths.get(relPath));
|
|
64
66
|
})
|
|
65
67
|
.map((relPath) => path.join(repoRoot, relPath));
|
|
66
68
|
};
|
|
@@ -68,14 +70,14 @@ export const collectNonIgnoredFiles = (rootDir, repoRoot) => {
|
|
|
68
70
|
// collect the actor directory of a monorepo actor — the platform would reject any path
|
|
69
71
|
// escaping it. Fix: create a temporary "flattened" directory where:
|
|
70
72
|
// - the Docker context's non-ignored files (repo root) are copied to the temp dir root
|
|
71
|
-
// - the actor's .actor/ directory
|
|
72
|
-
//
|
|
73
|
+
// - the actor's own .actor/ directory (already present within those same non-ignored files)
|
|
74
|
+
// is overlaid at the temp dir root instead of its original nested position
|
|
73
75
|
// - actor.json path fields are rewritten to be relative to the new location
|
|
74
76
|
//
|
|
75
77
|
// Result: the collected root IS the Docker context, .actor/ is at that root, and
|
|
76
78
|
// all relative paths (dockerfile, dockerContextDir, changelog) are exactly one
|
|
77
79
|
// level up ("..") instead of three ("../../..").
|
|
78
|
-
export const flattenMonorepoContext = async (actorName, absActorDir, contextAbsDir, actorJson, keptContextFiles
|
|
80
|
+
export const flattenMonorepoContext = async (actorName, absActorDir, contextAbsDir, actorJson, keptContextFiles) => {
|
|
79
81
|
console.error(`[${actorName}]: monorepo actor detected — flattening from Docker context`);
|
|
80
82
|
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), `apify-build-${actorName.replace('/', '_')}-`));
|
|
81
83
|
const filePaths = [];
|
|
@@ -88,11 +90,13 @@ export const flattenMonorepoContext = async (actorName, absActorDir, contextAbsD
|
|
|
88
90
|
await fs.copyFile(absFilePath, destPath);
|
|
89
91
|
filePaths.push(destPath);
|
|
90
92
|
}));
|
|
91
|
-
// Step 2: overlay the actor's .actor/ directory at the temp dir root.
|
|
92
|
-
//
|
|
93
|
-
//
|
|
93
|
+
// Step 2: overlay the actor's own .actor/ directory at the temp dir root. Its files are already
|
|
94
|
+
// present in keptContextFiles (collectNonIgnoredFiles keeps .actor/ paths unconditionally — see
|
|
95
|
+
// step 1 above) — pick out this actor's own subset (ignoring any sibling actors' .actor/ folders
|
|
96
|
+
// that might also appear in the broader context) and hoist each to its position relative to
|
|
97
|
+
// .actor/ itself, so it lands under tempDir/.actor/ instead of its original nested location.
|
|
94
98
|
const actorMetaDir = path.join(absActorDir, '.actor');
|
|
95
|
-
const keptActorFiles =
|
|
99
|
+
const keptActorFiles = keptContextFiles.filter((absFilePath) => isPathWithinScope(absFilePath, actorMetaDir));
|
|
96
100
|
await Promise.all(keptActorFiles.map(async (absFilePath) => {
|
|
97
101
|
const relPath = path.relative(actorMetaDir, absFilePath);
|
|
98
102
|
const destPath = path.join(tempDir, '.actor', relPath);
|
|
@@ -142,23 +146,24 @@ export const rewriteActorJsonPaths = async (absActorDir, contextAbsDir, tempDir,
|
|
|
142
146
|
export const runBuildsFromLocal = async ({ actorConfigs, dryRun, }) => {
|
|
143
147
|
if (dryRun) {
|
|
144
148
|
console.error('[DRY RUN] Would build from local source:');
|
|
145
|
-
for (const {
|
|
146
|
-
console.error(` ${
|
|
149
|
+
for (const { actorFullName, folder } of actorConfigs) {
|
|
150
|
+
console.error(` ${actorFullName} (${folder})`);
|
|
147
151
|
}
|
|
148
|
-
return actorConfigs.map(({
|
|
152
|
+
return actorConfigs.map(({ actorFullName }) => ({
|
|
149
153
|
buildId: 'dry-run',
|
|
150
|
-
|
|
154
|
+
actorRawId: 'dry-run',
|
|
151
155
|
buildNumber: '0.98.0',
|
|
152
|
-
|
|
156
|
+
actorFullName,
|
|
153
157
|
}));
|
|
154
158
|
}
|
|
155
159
|
console.error('=========================================');
|
|
156
160
|
console.error('STARTED LOCAL BUILDS:');
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const
|
|
161
|
+
const buildersByActorFullName = new Map(actorConfigs.map((actorConfig) => [actorConfig.actorFullName, ApifyBuilder.fromActorConfig(actorConfig)]));
|
|
162
|
+
const startedBuilds = await Promise.all(actorConfigs.map(async ({ actorFullName, folder }) => {
|
|
163
|
+
const builder = buildersByActorFullName.get(actorFullName);
|
|
164
|
+
const sourceFiles = await collectSourceFiles(actorFullName, folder);
|
|
160
165
|
return builder.startActorBuildFromSourceFiles(sourceFiles);
|
|
161
166
|
}));
|
|
162
|
-
return waitAndSummarizeBuilds(startedBuilds, 'LOCAL BUILDS');
|
|
167
|
+
return waitAndSummarizeBuilds(startedBuilds, buildersByActorFullName, 'LOCAL BUILDS');
|
|
163
168
|
};
|
|
164
169
|
//# sourceMappingURL=build-from-local.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-from-local.js","sourceRoot":"","sources":["../../bin/build-from-local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"build-from-local.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ig;
|
|
8
8
|
useDockerCache: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare class ApifyBuilder {
|
|
11
11
|
private readonly apifyClient;
|
|
12
|
-
private readonly
|
|
12
|
+
private readonly actorFullName;
|
|
13
13
|
private constructor();
|
|
14
14
|
getDefaultVersionAndTag: () => Promise<{
|
|
15
15
|
defaultBuildNumber: string;
|
|
@@ -18,18 +18,15 @@ export declare class ApifyBuilder {
|
|
|
18
18
|
}>;
|
|
19
19
|
startActorBuild: ({ buildTag, versionNumber, gitRepoUrl, useDockerCache, }: BuildPrActorOptions) => Promise<BuildData>;
|
|
20
20
|
startActorBuildFromSourceFiles: (sourceFiles: ActorVersionSourceFile[]) => Promise<BuildData>;
|
|
21
|
-
waitForBuildToFinish: (buildId: string
|
|
22
|
-
|
|
23
|
-
* Create ApifyBuilder with actor owner's token
|
|
24
|
-
*/
|
|
25
|
-
static fromActorName: (actorName: string) => ApifyBuilder;
|
|
21
|
+
waitForBuildToFinish: (buildId: string) => Promise<Build>;
|
|
22
|
+
static fromActorConfig: (actorConfig: ActorConfig) => ApifyBuilder;
|
|
26
23
|
/**
|
|
27
24
|
* Deletes build of all versions. Apify API doesn't allow to delete default build and we explicitly skip it
|
|
28
25
|
* We delete devel builds faster because we used the for every PR until recently so just to get rid of them faster
|
|
29
26
|
*/
|
|
30
27
|
deleteOldBuilds(): Promise<void>;
|
|
31
28
|
}
|
|
32
|
-
export declare const waitAndSummarizeBuilds: (startedBuilds: BuildData[], label: string) => Promise<BuildData[]>;
|
|
29
|
+
export declare const waitAndSummarizeBuilds: (startedBuilds: BuildData[], buildersMap: Map<string, ApifyBuilder>, label: string) => Promise<BuildData[]>;
|
|
33
30
|
type RunBuildsOptions = {
|
|
34
31
|
actorConfigs: ActorConfig[];
|
|
35
32
|
isLatest?: boolean;
|
package/dist/bin/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../bin/build.ts"],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