@expo/build-tools 1.0.149 → 1.0.151
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/dist/generic.d.ts +3 -1
- package/dist/generic.js +9 -1
- package/dist/generic.js.map +1 -1
- package/dist/steps/functions/startAndroidEmulator.js +10 -2
- package/dist/steps/functions/startAndroidEmulator.js.map +1 -1
- package/dist/utils/outputs.d.ts +23 -0
- package/dist/utils/outputs.js +62 -0
- package/dist/utils/outputs.js.map +1 -0
- package/dist/utils/turtleFetch.d.ts +32 -0
- package/dist/utils/turtleFetch.js +51 -0
- package/dist/utils/turtleFetch.js.map +1 -0
- package/package.json +8 -8
package/dist/generic.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { BuildWorkflow } from '@expo/steps';
|
|
|
3
3
|
import { Result } from '@expo/results';
|
|
4
4
|
import { BuildContext } from './context';
|
|
5
5
|
import { CustomBuildContext } from './customBuildContext';
|
|
6
|
-
export declare function runGenericJobAsync(ctx: BuildContext<Generic.Job
|
|
6
|
+
export declare function runGenericJobAsync(ctx: BuildContext<Generic.Job>, { expoApiV2BaseUrl }: {
|
|
7
|
+
expoApiV2BaseUrl: string;
|
|
8
|
+
}): Promise<{
|
|
7
9
|
runResult: Result<void>;
|
|
8
10
|
buildWorkflow: BuildWorkflow;
|
|
9
11
|
}>;
|
package/dist/generic.js
CHANGED
|
@@ -13,7 +13,8 @@ const projectSources_1 = require("./common/projectSources");
|
|
|
13
13
|
const easFunctions_1 = require("./steps/easFunctions");
|
|
14
14
|
const customBuildContext_1 = require("./customBuildContext");
|
|
15
15
|
const easFunctionGroups_1 = require("./steps/easFunctionGroups");
|
|
16
|
-
|
|
16
|
+
const outputs_1 = require("./utils/outputs");
|
|
17
|
+
async function runGenericJobAsync(ctx, { expoApiV2BaseUrl }) {
|
|
17
18
|
const customBuildCtx = new customBuildContext_1.CustomBuildContext(ctx);
|
|
18
19
|
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx, customBuildCtx.projectSourceDirectory);
|
|
19
20
|
await addEasWorkflows(customBuildCtx);
|
|
@@ -44,6 +45,13 @@ async function runGenericJobAsync(ctx) {
|
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
47
|
const runResult = await (0, results_1.asyncResult)(workflow.executeAsync());
|
|
48
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.COMPLETE_JOB, async () => {
|
|
49
|
+
await (0, outputs_1.uploadJobOutputsToWwwAsync)(ctx, {
|
|
50
|
+
steps: workflow.buildSteps,
|
|
51
|
+
logger: ctx.logger,
|
|
52
|
+
expoApiV2BaseUrl,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
47
55
|
return { runResult, buildWorkflow: workflow };
|
|
48
56
|
}
|
|
49
57
|
exports.runGenericJobAsync = runGenericJobAsync;
|
package/dist/generic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../src/generic.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,uDAA0D;AAC1D,uCAMqB;AACrB,2CAAoD;AAGpD,4DAAqE;AACrE,uDAAuD;AACvD,6DAA0D;AAC1D,iEAAiE;
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../src/generic.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,uDAA0D;AAC1D,uCAMqB;AACrB,2CAAoD;AAGpD,4DAAqE;AACrE,uDAAuD;AACvD,6DAA0D;AAC1D,iEAAiE;AACjE,6CAA6D;AAEtD,KAAK,UAAU,kBAAkB,CACtC,GAA8B,EAC9B,EAAE,gBAAgB,EAAgC;IAElD,MAAM,cAAc,GAAG,IAAI,uCAAkB,CAAC,GAAG,CAAC,CAAC;IAEnD,MAAM,IAAA,2CAA0B,EAAC,GAAG,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;IAE7E,MAAM,eAAe,CAAC,cAAc,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AAA,qBAAW,EAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IAE7D,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,IAAA,oCAA0B,EAAC,GAAG,EAAE;YACpC,KAAK,EAAE,QAAQ,CAAC,UAAU;YAC1B,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AAChD,CAAC;AApDD,gDAoDC;AAEM,KAAK,UAAU,eAAe,CAAC,cAAkC;IACtE,MAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAI,CAAC,IAAI,CAAC,cAAc,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE;QACjF,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,MAAM,YAAE,CAAC,QAAQ,CAAC,EAAE,CAClB,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAChD,cAAI,CAAC,IAAI,CAAC,cAAc,CAAC,sBAAsB,EAAE,OAAO,CAAC,EACzD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;AACJ,CAAC;AAVD,0CAUC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { BuildPhase, Generic } from '@expo/eas-build-job';\nimport {\n BuildConfigParser,\n BuildStepGlobalContext,\n BuildWorkflow,\n errors,\n StepsConfigParser,\n} from '@expo/steps';\nimport { Result, asyncResult } from '@expo/results';\n\nimport { BuildContext } from './context';\nimport { prepareProjectSourcesAsync } from './common/projectSources';\nimport { getEasFunctions } from './steps/easFunctions';\nimport { CustomBuildContext } from './customBuildContext';\nimport { getEasFunctionGroups } from './steps/easFunctionGroups';\nimport { uploadJobOutputsToWwwAsync } from './utils/outputs';\n\nexport async function runGenericJobAsync(\n ctx: BuildContext<Generic.Job>,\n { expoApiV2BaseUrl }: { expoApiV2BaseUrl: string }\n): Promise<{ runResult: Result<void>; buildWorkflow: BuildWorkflow }> {\n const customBuildCtx = new CustomBuildContext(ctx);\n\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n\n await addEasWorkflows(customBuildCtx);\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n\n const parser = ctx.job.steps\n ? new StepsConfigParser(globalContext, {\n externalFunctions: getEasFunctions(customBuildCtx),\n externalFunctionGroups: getEasFunctionGroups(customBuildCtx),\n steps: ctx.job.steps,\n })\n : new BuildConfigParser(globalContext, {\n externalFunctions: getEasFunctions(customBuildCtx),\n externalFunctionGroups: getEasFunctionGroups(customBuildCtx),\n configPath: path.join(\n customBuildCtx.projectSourceDirectory,\n ctx.job.customBuildConfig.path\n ),\n });\n\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the job definition file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n\n const runResult = await asyncResult(workflow.executeAsync());\n\n await ctx.runBuildPhase(BuildPhase.COMPLETE_JOB, async () => {\n await uploadJobOutputsToWwwAsync(ctx, {\n steps: workflow.buildSteps,\n logger: ctx.logger,\n expoApiV2BaseUrl,\n });\n });\n\n return { runResult, buildWorkflow: workflow };\n}\n\nexport async function addEasWorkflows(customBuildCtx: CustomBuildContext): Promise<void> {\n await fs.promises.mkdir(path.join(customBuildCtx.projectSourceDirectory, '__eas'), {\n recursive: true,\n });\n\n await fs.promises.cp(\n path.join(__dirname, '..', 'resources', '__eas'),\n path.join(customBuildCtx.projectSourceDirectory, '__eas'),\n { recursive: true }\n );\n}\n"]}
|
|
@@ -35,9 +35,17 @@ function createStartAndroidEmulatorBuildFunction() {
|
|
|
35
35
|
const deviceName = `${inputs.device_name.value}`;
|
|
36
36
|
const systemImagePackage = `${inputs.system_image_package.value}`;
|
|
37
37
|
logger.info('Making sure system image is installed');
|
|
38
|
-
await (0,
|
|
39
|
-
|
|
38
|
+
await (0, retry_1.retryAsync)(async () => {
|
|
39
|
+
await (0, turtle_spawn_1.default)('sdkmanager', [systemImagePackage], {
|
|
40
|
+
env,
|
|
41
|
+
logger,
|
|
42
|
+
});
|
|
43
|
+
}, {
|
|
40
44
|
logger,
|
|
45
|
+
retryOptions: {
|
|
46
|
+
retries: 3, // Retry 3 times
|
|
47
|
+
retryIntervalMs: 1000,
|
|
48
|
+
},
|
|
41
49
|
});
|
|
42
50
|
logger.info('Creating emulator device');
|
|
43
51
|
const avdManager = (0, turtle_spawn_1.default)('avdmanager', ['create', 'avd', '--name', deviceName, '--package', systemImagePackage, '--force'], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startAndroidEmulator.js","sourceRoot":"","sources":["../../../src/steps/functions/startAndroidEmulator.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,yCAAwC;AACxC,uCAKqB;AACrB,sEAAuC;AACvC,+BAAoC;AAEpC,6CAA+C;AAE/C,MAAM,yBAAyB,GAAG,oCAChC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAC3C,EAAE,CAAC;AAEH,SAAgB,uCAAuC;IACrD,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,wBAAwB;QAC5B,IAAI,EAAE,wBAAwB;QAC9B,cAAc,EAAE;YACd,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,aAAa;gBACjB,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,oBAAoB;gBAClC,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;aACzD,CAAC;YACF,sBAAc,CAA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CAAC,QAAQ;YACvB,GAAG;SACJ,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1C,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { PipeMode } from '@expo/logger';\nimport {\n BuildFunction,\n BuildStepEnv,\n BuildStepInput,\n BuildStepInputValueTypeName,\n} from '@expo/steps';\nimport spawn from '@expo/turtle-spawn';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { retryAsync } from '../../utils/retry';\n\nconst defaultSystemImagePackage = `system-images;android-30;default;${\n process.arch === 'arm64' ? 'arm64-v8a' : 'x86_64'\n}`;\n\nexport function createStartAndroidEmulatorBuildFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'start_android_emulator',\n name: 'Start Android Emulator',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'device_name',\n required: false,\n defaultValue: 'EasAndroidDevice01',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'system_image_package',\n required: false,\n defaultValue: defaultSystemImagePackage,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n ],\n fn: async ({ logger }, { inputs, env }) => {\n const deviceName = `${inputs.device_name.value}`;\n const systemImagePackage = `${inputs.system_image_package.value}`;\n logger.info('Making sure system image is installed');\n await retryAsync(\n async () => {\n await spawn('sdkmanager', [systemImagePackage], {\n env,\n logger,\n });\n },\n {\n logger,\n retryOptions: {\n retries: 3, // Retry 3 times\n retryIntervalMs: 1_000,\n },\n }\n );\n\n logger.info('Creating emulator device');\n const avdManager = spawn(\n 'avdmanager',\n ['create', 'avd', '--name', deviceName, '--package', systemImagePackage, '--force'],\n {\n env,\n stdio: 'pipe',\n }\n );\n // `avdmanager create` always asks about creating a custom hardware profile.\n // > Do you wish to create a custom hardware profile? [no]\n // We answer \"no\".\n avdManager.child.stdin?.write('no');\n avdManager.child.stdin?.end();\n await avdManager;\n\n const qemuPropId = uuidv4();\n\n logger.info('Starting emulator device');\n await startAndroidSimulator({ deviceName, qemuPropId, env });\n\n logger.info('Waiting for emulator to become ready');\n const serialId = await retryAsync(\n async () => {\n const serialId = await getEmulatorSerialId({ qemuPropId, env });\n assert(serialId, 'Failed to configure emulator: emulator with required ID not found.');\n return serialId;\n },\n {\n logger,\n retryOptions: {\n // Emulators usually take 30 second tops to boot.\n retries: 60,\n retryIntervalMs: 1_000,\n },\n }\n );\n\n await retryAsync(\n async () => {\n const { stdout } = await spawn(\n 'adb',\n ['-s', serialId, 'shell', 'getprop', 'sys.boot_completed'],\n {\n env,\n mode: PipeMode.COMBINED,\n }\n );\n\n if (!stdout.startsWith('1')) {\n throw new Error('Emulator boot has not completed.');\n }\n },\n {\n // Retry every second for 3 minutes.\n retryOptions: {\n retries: 3 * 60,\n retryIntervalMs: 1_000,\n },\n }\n );\n\n logger.info(`${deviceName} is ready.`);\n },\n });\n}\n\nasync function startAndroidSimulator({\n deviceName,\n qemuPropId,\n env,\n}: {\n deviceName: string;\n qemuPropId: string;\n env: BuildStepEnv;\n}): Promise<void> {\n const emulatorPromise = spawn(\n `${process.env.ANDROID_HOME}/emulator/emulator`,\n [\n '-no-window',\n '-no-boot-anim',\n '-writable-system',\n '-noaudio',\n '-avd',\n deviceName,\n '-prop',\n `qemu.uuid=${qemuPropId}`,\n ],\n {\n detached: true,\n stdio: 'ignore',\n env,\n }\n );\n // If emulator fails to start, throw its error.\n if (!emulatorPromise.child.pid) {\n await emulatorPromise;\n }\n emulatorPromise.child.unref();\n}\n\nasync function getEmulatorSerialId({\n qemuPropId,\n env,\n}: {\n qemuPropId: string;\n env: BuildStepEnv;\n}): Promise<string | null> {\n const adbDevices = await spawn('adb', ['devices'], { mode: PipeMode.COMBINED, env });\n for (const adbDeviceLine of adbDevices.stdout.split('\\n')) {\n if (!adbDeviceLine.startsWith('emulator')) {\n continue;\n }\n\n const matches = adbDeviceLine.match(/^(\\S+)/);\n if (!matches) {\n continue;\n }\n\n const [, serialId] = matches;\n const getProp = await spawn('adb', ['-s', serialId, 'shell', 'getprop', 'qemu.uuid'], {\n mode: PipeMode.COMBINED,\n env,\n });\n if (getProp.stdout.startsWith(qemuPropId)) {\n return serialId;\n }\n }\n\n return null;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="bunyan" />
|
|
2
|
+
import { Generic } from '@expo/eas-build-job';
|
|
3
|
+
import { BuildStep } from '@expo/steps';
|
|
4
|
+
import { bunyan } from '@expo/logger';
|
|
5
|
+
import { BuildContext } from '../context';
|
|
6
|
+
export declare function uploadJobOutputsToWwwAsync(ctx: BuildContext<Generic.Job>, { steps, logger, expoApiV2BaseUrl, }: {
|
|
7
|
+
steps: BuildStep[];
|
|
8
|
+
logger: bunyan;
|
|
9
|
+
expoApiV2BaseUrl: string;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
/** Function we use to get outputs of the whole job from steps. */
|
|
12
|
+
export declare function getJobOutputsFromSteps({ jobOutputDefinitions, interpolationContext, }: {
|
|
13
|
+
jobOutputDefinitions: Record<string, string>;
|
|
14
|
+
interpolationContext: {
|
|
15
|
+
steps: Record<string, {
|
|
16
|
+
outputs: Record<string, string | undefined>;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
}): Record<string, string | undefined>;
|
|
20
|
+
/** This is what we'll use to generate an object representing a step. */
|
|
21
|
+
export declare function getStepOutputsAsObject(step: BuildStep): {
|
|
22
|
+
outputs: Record<string, string | undefined>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getStepOutputsAsObject = exports.getJobOutputsFromSteps = exports.uploadJobOutputsToWwwAsync = void 0;
|
|
7
|
+
const steps_1 = require("@expo/steps");
|
|
8
|
+
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
9
|
+
const turtleFetch_1 = require("./turtleFetch");
|
|
10
|
+
async function uploadJobOutputsToWwwAsync(ctx, { steps, logger, expoApiV2BaseUrl, }) {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
if (!ctx.job.outputs) {
|
|
13
|
+
logger.info('Job defines no outputs, skipping upload');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const workflowJobId = (0, nullthrows_1.default)((_b = (_a = ctx.job.builderEnvironment) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.__WORKFLOW_JOB_ID);
|
|
18
|
+
const robotAccessToken = (0, nullthrows_1.default)((_c = ctx.job.secrets) === null || _c === void 0 ? void 0 : _c.robotAccessToken);
|
|
19
|
+
const interpolationContext = {
|
|
20
|
+
steps: Object.fromEntries(steps.map((step) => [step.id, getStepOutputsAsObject(step)])),
|
|
21
|
+
};
|
|
22
|
+
logger.debug({ dynamicValues: interpolationContext }, 'Using dynamic values');
|
|
23
|
+
const outputs = getJobOutputsFromSteps({
|
|
24
|
+
jobOutputDefinitions: ctx.job.outputs,
|
|
25
|
+
interpolationContext,
|
|
26
|
+
});
|
|
27
|
+
logger.info('Uploading outputs');
|
|
28
|
+
await (0, turtleFetch_1.turtleFetch)(new URL(`workflows/${workflowJobId}`, expoApiV2BaseUrl).toString(), 'PATCH', {
|
|
29
|
+
json: { outputs },
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: `Bearer ${robotAccessToken}`,
|
|
32
|
+
},
|
|
33
|
+
timeout: 20000,
|
|
34
|
+
logger,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
logger.error({ err }, 'Failed to upload outputs');
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.uploadJobOutputsToWwwAsync = uploadJobOutputsToWwwAsync;
|
|
43
|
+
/** Function we use to get outputs of the whole job from steps. */
|
|
44
|
+
function getJobOutputsFromSteps({ jobOutputDefinitions, interpolationContext, }) {
|
|
45
|
+
const jobOutputs = {};
|
|
46
|
+
for (const [outputKey, outputDefinition] of Object.entries(jobOutputDefinitions)) {
|
|
47
|
+
const outputValue = outputDefinition.replace(/\$\{\{(.+?)\}\}/g, (_match, expression) => {
|
|
48
|
+
return `${(0, steps_1.jsepEval)(expression, interpolationContext)}`;
|
|
49
|
+
});
|
|
50
|
+
jobOutputs[outputKey] = outputValue;
|
|
51
|
+
}
|
|
52
|
+
return jobOutputs;
|
|
53
|
+
}
|
|
54
|
+
exports.getJobOutputsFromSteps = getJobOutputsFromSteps;
|
|
55
|
+
/** This is what we'll use to generate an object representing a step. */
|
|
56
|
+
function getStepOutputsAsObject(step) {
|
|
57
|
+
var _a;
|
|
58
|
+
const outputs = Object.fromEntries((_a = Object.entries(step.outputById).map(([id, output]) => { var _a; return [id, (_a = output.value) !== null && _a !== void 0 ? _a : '']; })) !== null && _a !== void 0 ? _a : []);
|
|
59
|
+
return { outputs };
|
|
60
|
+
}
|
|
61
|
+
exports.getStepOutputsAsObject = getStepOutputsAsObject;
|
|
62
|
+
//# sourceMappingURL=outputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/utils/outputs.ts"],"names":[],"mappings":";;;;;;AACA,uCAAkD;AAElD,4DAAoC;AAIpC,+CAA4C;AAErC,KAAK,UAAU,0BAA0B,CAC9C,GAA8B,EAC9B,EACE,KAAK,EACL,MAAM,EACN,gBAAgB,GACiD;;IAEnE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO;IACT,CAAC;I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B,EACpB,oBAAoB,GAMrB;IACC,MAAM,UAAU,GAAuC,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACjF,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;YACtF,OAAO,GAAG,IAAA,gBAAQ,EAAC,UAAU,EAAE,oBAAoB,CAAC,EAAE,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;IACtC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAnBD,wDAmBC;AAED,wEAAwE;AACxE,SAAgB,sBAAsB,CAAC,IAAe;;IAGpD,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,MAAA,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,WAAC,OAAA,CAAC,EAAE,EAAE,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA,CAAC,mCAAI,EAAE,CACtF,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC;AARD,wDAQC","sourcesContent":["import { Generic } from '@expo/eas-build-job';\nimport { BuildStep, jsepEval } from '@expo/steps';\nimport { bunyan } from '@expo/logger';\nimport nullthrows from 'nullthrows';\n\nimport { BuildContext } from '../context';\n\nimport { turtleFetch } from './turtleFetch';\n\nexport async function uploadJobOutputsToWwwAsync(\n ctx: BuildContext<Generic.Job>,\n {\n steps,\n logger,\n expoApiV2BaseUrl,\n }: { steps: BuildStep[]; logger: bunyan; expoApiV2BaseUrl: string }\n): Promise<void> {\n if (!ctx.job.outputs) {\n logger.info('Job defines no outputs, skipping upload');\n return;\n }\n\n try {\n const workflowJobId = nullthrows(ctx.job.builderEnvironment?.env?.__WORKFLOW_JOB_ID);\n const robotAccessToken = nullthrows(ctx.job.secrets?.robotAccessToken);\n\n const interpolationContext = {\n steps: Object.fromEntries(steps.map((step) => [step.id, getStepOutputsAsObject(step)])),\n };\n logger.debug({ dynamicValues: interpolationContext }, 'Using dynamic values');\n\n const outputs = getJobOutputsFromSteps({\n jobOutputDefinitions: ctx.job.outputs,\n interpolationContext,\n });\n logger.info('Uploading outputs');\n\n await turtleFetch(new URL(`workflows/${workflowJobId}`, expoApiV2BaseUrl).toString(), 'PATCH', {\n json: { outputs },\n headers: {\n Authorization: `Bearer ${robotAccessToken}`,\n },\n timeout: 20000,\n logger,\n });\n } catch (err) {\n logger.error({ err }, 'Failed to upload outputs');\n throw err;\n }\n}\n\n/** Function we use to get outputs of the whole job from steps. */\nexport function getJobOutputsFromSteps({\n jobOutputDefinitions,\n interpolationContext,\n}: {\n jobOutputDefinitions: Record<string, string>;\n interpolationContext: {\n steps: Record<string, { outputs: Record<string, string | undefined> }>;\n };\n}): Record<string, string | undefined> {\n const jobOutputs: Record<string, string | undefined> = {};\n for (const [outputKey, outputDefinition] of Object.entries(jobOutputDefinitions)) {\n const outputValue = outputDefinition.replace(/\\$\\{\\{(.+?)\\}\\}/g, (_match, expression) => {\n return `${jsepEval(expression, interpolationContext)}`;\n });\n\n jobOutputs[outputKey] = outputValue;\n }\n\n return jobOutputs;\n}\n\n/** This is what we'll use to generate an object representing a step. */\nexport function getStepOutputsAsObject(step: BuildStep): {\n outputs: Record<string, string | undefined>;\n} {\n const outputs = Object.fromEntries(\n Object.entries(step.outputById).map(([id, output]) => [id, output.value ?? '']) ?? []\n );\n\n return { outputs };\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="bunyan" />
|
|
2
|
+
import { Response, RequestInit, HeaderInit } from 'node-fetch';
|
|
3
|
+
import { bunyan } from '@expo/logger';
|
|
4
|
+
type TurtleFetchMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'PATCH';
|
|
5
|
+
export declare class TurtleFetchError extends Error {
|
|
6
|
+
readonly response: Response;
|
|
7
|
+
constructor(message: string, response: Response);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wrapper around node-fetch adding some useful features:
|
|
11
|
+
* - retries
|
|
12
|
+
* - json body - if you specify json in options, it will be stringified and content-type will be set to application/json
|
|
13
|
+
* - automatic error throwing - if response is not ok, it will throw an error
|
|
14
|
+
*
|
|
15
|
+
* @param url URL to fetch
|
|
16
|
+
* @param method HTTP method
|
|
17
|
+
* @param options.retries number of retries
|
|
18
|
+
* @param options.json json body
|
|
19
|
+
* @param options.headers headers
|
|
20
|
+
* @param options.shouldThrowOnNotOk if false, it will not throw an error if response is not ok (default: true)
|
|
21
|
+
* @param options other options passed to node-fetch
|
|
22
|
+
* @returns {Promise<Response>}
|
|
23
|
+
*/
|
|
24
|
+
export declare function turtleFetch(url: string, method: TurtleFetchMethod, options: Omit<RequestInit, 'body' | 'method'> & {
|
|
25
|
+
retries?: number;
|
|
26
|
+
json?: Record<string, any>;
|
|
27
|
+
headers?: Exclude<HeaderInit, string[][]>;
|
|
28
|
+
shouldThrowOnNotOk?: boolean;
|
|
29
|
+
retryIntervalMs?: number;
|
|
30
|
+
logger?: bunyan;
|
|
31
|
+
}): Promise<Response>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.turtleFetch = exports.TurtleFetchError = void 0;
|
|
7
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
|
+
const retry_1 = require("./retry");
|
|
9
|
+
class TurtleFetchError extends Error {
|
|
10
|
+
constructor(message, response) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.response = response;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.TurtleFetchError = TurtleFetchError;
|
|
16
|
+
/**
|
|
17
|
+
* Wrapper around node-fetch adding some useful features:
|
|
18
|
+
* - retries
|
|
19
|
+
* - json body - if you specify json in options, it will be stringified and content-type will be set to application/json
|
|
20
|
+
* - automatic error throwing - if response is not ok, it will throw an error
|
|
21
|
+
*
|
|
22
|
+
* @param url URL to fetch
|
|
23
|
+
* @param method HTTP method
|
|
24
|
+
* @param options.retries number of retries
|
|
25
|
+
* @param options.json json body
|
|
26
|
+
* @param options.headers headers
|
|
27
|
+
* @param options.shouldThrowOnNotOk if false, it will not throw an error if response is not ok (default: true)
|
|
28
|
+
* @param options other options passed to node-fetch
|
|
29
|
+
* @returns {Promise<Response>}
|
|
30
|
+
*/
|
|
31
|
+
async function turtleFetch(url, method, options) {
|
|
32
|
+
const { json, headers: rawHeaders, retries: rawRetries, logger, retryIntervalMs = 1000, shouldThrowOnNotOk = true, ...otherOptions } = options;
|
|
33
|
+
const retries = rawRetries !== null && rawRetries !== void 0 ? rawRetries : (method === 'POST' ? 0 : 2);
|
|
34
|
+
const body = JSON.stringify(json);
|
|
35
|
+
const headers = json ? { ...rawHeaders, 'Content-Type': 'application/json' } : rawHeaders;
|
|
36
|
+
return await (0, retry_1.retryAsync)(async (attemptCount) => {
|
|
37
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
38
|
+
method,
|
|
39
|
+
body,
|
|
40
|
+
headers,
|
|
41
|
+
...otherOptions,
|
|
42
|
+
});
|
|
43
|
+
const shouldThrow = shouldThrowOnNotOk || attemptCount < retries;
|
|
44
|
+
if (!response.ok && shouldThrow) {
|
|
45
|
+
throw new TurtleFetchError(`Request failed with status ${response.status}`, response);
|
|
46
|
+
}
|
|
47
|
+
return response;
|
|
48
|
+
}, { retryOptions: { retries, retryIntervalMs }, logger });
|
|
49
|
+
}
|
|
50
|
+
exports.turtleFetch = turtleFetch;
|
|
51
|
+
//# sourceMappingURL=turtleFetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turtleFetch.js","sourceRoot":"","sources":["../../src/utils/turtleFetch.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAsE;AAGtE,mCAAqC;AAIrC,MAAa,gBAAiB,SAAQ,KAAK;IAEzC,YAAY,OAAe,EAAE,QAAkB;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAND,4CAMC;AAED;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,MAAyB,EACzB,OAOC;IAED,MAAM,EACJ,IAAI,EACJ,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,UAAU,EACnB,MAAM,EACN,eAAe,GAAG,IAAI,EACtB,kBAAkB,GAAG,IAAI,EACzB,GAAG,YAAY,EAChB,GAAG,OAAO,CAAC;IAEZ,MAAM,OAAO,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IAE1F,OAAO,MAAM,IAAA,kBAAU,EACrB,KAAK,EAAE,YAAY,EAAE,EAAE;QACrB,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,EAAE;YAChC,MAAM;YACN,IAAI;YACJ,OAAO;YACP,GAAG,YAAY;SAChB,CAAC,CAAC;QACH,MAAM,WAAW,GAAG,kBAAkB,IAAI,YAAY,GAAG,OAAO,CAAC;QACjE,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,WAAW,EAAE,CAAC;YAChC,MAAM,IAAI,gBAAgB,CAAC,8BAA8B,QAAQ,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,EACD,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,CACvD,CAAC;AACJ,CAAC;AA3CD,kCA2CC","sourcesContent":["import fetch, { Response, RequestInit, HeaderInit } from 'node-fetch';\nimport { bunyan } from '@expo/logger';\n\nimport { retryAsync } from './retry';\n\ntype TurtleFetchMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'PATCH';\n\nexport class TurtleFetchError extends Error {\n readonly response: Response;\n constructor(message: string, response: Response) {\n super(message);\n this.response = response;\n }\n}\n\n/**\n * Wrapper around node-fetch adding some useful features:\n * - retries\n * - json body - if you specify json in options, it will be stringified and content-type will be set to application/json\n * - automatic error throwing - if response is not ok, it will throw an error\n *\n * @param url URL to fetch\n * @param method HTTP method\n * @param options.retries number of retries\n * @param options.json json body\n * @param options.headers headers\n * @param options.shouldThrowOnNotOk if false, it will not throw an error if response is not ok (default: true)\n * @param options other options passed to node-fetch\n * @returns {Promise<Response>}\n */\nexport async function turtleFetch(\n url: string,\n method: TurtleFetchMethod,\n options: Omit<RequestInit, 'body' | 'method'> & {\n retries?: number;\n json?: Record<string, any>;\n headers?: Exclude<HeaderInit, string[][]>;\n shouldThrowOnNotOk?: boolean;\n retryIntervalMs?: number;\n logger?: bunyan;\n }\n): Promise<Response> {\n const {\n json,\n headers: rawHeaders,\n retries: rawRetries,\n logger,\n retryIntervalMs = 1000,\n shouldThrowOnNotOk = true,\n ...otherOptions\n } = options;\n\n const retries = rawRetries ?? (method === 'POST' ? 0 : 2);\n\n const body = JSON.stringify(json);\n const headers = json ? { ...rawHeaders, 'Content-Type': 'application/json' } : rawHeaders;\n\n return await retryAsync(\n async (attemptCount) => {\n const response = await fetch(url, {\n method,\n body,\n headers,\n ...otherOptions,\n });\n const shouldThrow = shouldThrowOnNotOk || attemptCount < retries;\n if (!response.ok && shouldThrow) {\n throw new TurtleFetchError(`Request failed with status ${response.status}`, response);\n }\n return response;\n },\n { retryOptions: { retries, retryIntervalMs }, logger }\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.151",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"bugs": "https://github.com/expo/eas-build/issues",
|
|
23
23
|
"license": "BUSL-1.1",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@expo/config": "
|
|
26
|
-
"@expo/config-plugins": "
|
|
25
|
+
"@expo/config": "10.0.5",
|
|
26
|
+
"@expo/config-plugins": "9.0.10",
|
|
27
27
|
"@expo/downloader": "1.0.118",
|
|
28
|
-
"@expo/eas-build-job": "1.0.
|
|
29
|
-
"@expo/env": "^0.
|
|
28
|
+
"@expo/eas-build-job": "1.0.151",
|
|
29
|
+
"@expo/env": "^0.4.0",
|
|
30
30
|
"@expo/logger": "1.0.117",
|
|
31
31
|
"@expo/package-manager": "1.5.2",
|
|
32
|
-
"@expo/plist": "^0.
|
|
32
|
+
"@expo/plist": "^0.2.0",
|
|
33
33
|
"@expo/repack-app": "0.0.6",
|
|
34
34
|
"@expo/results": "^1.0.0",
|
|
35
|
-
"@expo/steps": "1.0.
|
|
35
|
+
"@expo/steps": "1.0.151",
|
|
36
36
|
"@expo/template-file": "1.0.117",
|
|
37
37
|
"@expo/turtle-spawn": "1.0.117",
|
|
38
38
|
"@expo/xcpretty": "^4.3.1",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"node": "20.14.0",
|
|
75
75
|
"yarn": "1.22.21"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "e6e19b19d2037d23af2a9ec8e28128e9fcaee92e"
|
|
78
78
|
}
|