Compare commits

..
Author SHA1 Message Date
szdziedzic 3b836ef30c [eas-cli] Add --os-version to eas simulator 2026-10-26 16:24:00 +01:00
Stanisław Chmiela bcb5d96ea8 [cocoapods-proxy] Add Sonatype snapshot CocoaPods proxy support (#3736)
## Summary

Adds `central.sonatype.com` support to the packaged `expo-cocoapods-proxy` gem used by iOS workers.

## Change

- Adds `central.sonatype.com` to the `Pod::Downloader::Http` proxy allowlist.
- Adds spec coverage for Sonatype repository artifact URLs.

## Code Requiring This

This PR is for CocoaPods `:http` pod source downloads. It does not proxy React Native's `Net::HTTP` metadata lookup.

React Native returns Sonatype artifact URLs to CocoaPods as `:http` pod sources here:

- RNCore returns `{:http => url}` after resolving the Sonatype nightly artifact URL: https://github.com/facebook/react-native/blob/7bbb13c9be014c0e63f0deaad809d669c15325ad/packages/react-native/scripts/cocoapods/rncore.rb#L170-L173
- ReactNativeDependencies returns `{:http => url}` after resolving the Sonatype nightly artifact URL: https://github.com/facebook/react-native/blob/7bbb13c9be014c0e63f0deaad809d669c15325ad/packages/react-native/scripts/cocoapods/rndependencies.rb#L205-L208
- Hermes returns `{:http => url}` after resolving the Sonatype nightly artifact URL: https://github.com/facebook/react-native/blob/7bbb13c9be014c0e63f0deaad809d669c15325ad/packages/react-native/sdks/hermes-engine/hermes-utils.rb#L190-L193

CocoaPods/cocoapods-downloader then uses `Pod::Downloader::Http` for those `:http` params:

- CocoaPods passes the pod source params to `Downloader.for_target(...).download`: https://github.com/CocoaPods/CocoaPods/blob/1.12.1/lib/cocoapods/downloader.rb#L107-L110
- `cocoapods-downloader` maps `:http` to `Http`: https://github.com/CocoaPods/cocoapods-downloader/blob/1.6.3/lib/cocoapods-downloader.rb#L22-L30
- `Downloader.for_target` instantiates that downloader with the `:http` URL: https://github.com/CocoaPods/cocoapods-downloader/blob/1.6.3/lib/cocoapods-downloader.rb#L51-L64
- `Pod::Downloader::Http#download_file` uses curl for that URL: https://github.com/CocoaPods/cocoapods-downloader/blob/1.6.3/lib/cocoapods-downloader/http.rb#L12-L22

## Validation

- `rspec` in `packages/expo-cocoapods-proxy`: 16 examples, 0 failures
- `git diff --check`
2026-10-26 15:51:09 +01:00
10 changed files with 107 additions and 105 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
'eas-cli': minor
---
Add `--os-version` to `eas simulator` to select the iOS Simulator runtime version.
@@ -1,5 +0,0 @@
---
'@expo/build-tools': patch
---
Allow an App Store Connect processing timeout to be configured and report an error when processing does not finish before the deadline.
@@ -1,78 +0,0 @@
import fs from 'fs-extra';
import nock from 'nock';
import { generateKeyPairSync } from 'node:crypto';
import { createGlobalContextMock } from '../../../__tests__/utils/context';
import { createUploadToAscBuildFunction } from '../uploadToAsc';
jest.unmock('node-fetch');
jest.mock('../readIpaInfo', () => ({
readIpaInfoAsync: async () => ({ dtPlatformName: 'iphoneos' }),
}));
beforeAll(() => nock.disableNetConnect());
afterAll(() => nock.enableNetConnect());
afterEach(() => {
try {
expect(nock.pendingMocks()).toEqual([]);
} finally {
nock.cleanAll();
}
});
it.each(['COMPLETE', 'PROCESSING'] as const)(
'only reports success when Apple processing is COMPLETE (received %s)',
async state => {
await fs.ensureDir('/tmp');
const { privateKey } = generateKeyPairSync('ec', { namedCurve: 'prime256v1' });
await fs.writeJson('/tmp/key.json', {
key_id: 'TESTKEY',
key: privateKey.export({ type: 'pkcs8', format: 'pem' }),
});
await fs.writeFile('/tmp/app.ipa', 'test');
const api = nock('https://api.appstoreconnect.apple.com');
api
.get('/v1/apps/app')
.query(true)
.reply(200, {
data: { id: 'app', type: 'apps', attributes: { name: 'App', bundleId: 'dev.test' } },
});
api.post('/v1/buildUploads').reply(201, { data: { id: 'upload', type: 'buildUploads' } });
api.post('/v1/buildUploadFiles').reply(201, {
data: { id: 'file', type: 'buildUploadFiles', attributes: { uploadOperations: [] } },
});
const file = {
data: {
id: 'file',
type: 'buildUploadFiles',
attributes: { assetDeliveryState: { state: 'COMPLETE' } },
},
};
api.get('/v1/buildUploadFiles/file').query(true).twice().reply(200, file);
api
.get('/v1/buildUploads/upload')
.query(true)
.reply(200, {
data: { id: 'upload', type: 'buildUploads', attributes: { state: { state } } },
});
const step = createUploadToAscBuildFunction().createBuildStepFromFunctionCall(
createGlobalContextMock(),
{
callInputs: {
ipa_path: '/tmp/app.ipa',
asc_api_key_path: '/tmp/key.json',
apple_app_identifier: 'app',
bundle_version: '1',
bundle_short_version: '1.0',
wait_for_processing: true,
wait_processing_timeout_seconds: 1,
},
}
);
if (state === 'COMPLETE') {
await expect(step.executeAsync()).resolves.toBeUndefined();
} else {
await expect(step.executeAsync()).rejects.toThrow('Apple did not finish processing');
}
}
);
@@ -55,12 +55,6 @@ export function createUploadToAscBuildFunction(): BuildFunction {
defaultValue: false,
allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,
}),
BuildStepInput.createProvider({
id: 'wait_processing_timeout_seconds',
required: false,
defaultValue: 30 * 60,
allowedValueTypeName: BuildStepInputValueTypeName.NUMBER,
}),
],
outputProviders: [
BuildStepOutput.createProvider({
@@ -79,11 +73,6 @@ export function createUploadToAscBuildFunction(): BuildFunction {
const bundleVersion = z.string().parse(inputs.bundle_version.value);
const bundleShortVersion = z.string().parse(inputs.bundle_short_version.value);
const waitForProcessing = Boolean(inputs.wait_for_processing.value);
const processingTimeoutSeconds = z
.number()
.int()
.positive()
.parse(inputs.wait_processing_timeout_seconds.value);
const ipaPath = path.resolve(stepsCtx.workingDirectory, ipaPathInput);
if (!(await fs.pathExists(ipaPath))) {
@@ -224,7 +213,7 @@ export function createUploadToAscBuildFunction(): BuildFunction {
const waitingLogIntervalMs = 10 * 1000;
let lastWaitLogTime = 0;
let lastWaitLogState: string | null = null;
while (Date.now() - waitingForBuildStartedAt < processingTimeoutSeconds * 1000) {
while (Date.now() - waitingForBuildStartedAt < 30 * 60 * 1000 /* 30 minutes */) {
const {
data: {
attributes: { state },
@@ -333,14 +322,9 @@ export function createUploadToAscBuildFunction(): BuildFunction {
throw new Error(`Build upload (ID: ${buildUploadId}) failed.`);
} else if (state.state === 'COMPLETE') {
stepsCtx.logger.info(`Build upload (ID: ${buildUploadId}) complete!`);
return;
}
break;
}
throw new UserError(
'EAS_UPLOAD_TO_ASC_PROCESSING_TIMEOUT',
`Apple did not finish processing build upload ${buildUploadId} within ${processingTimeoutSeconds} seconds. ` +
'The binary was uploaded. Check its status in App Store Connect before uploading it again, or increase wait_processing_timeout_seconds.'
);
},
});
}
+13 -1
View File
@@ -46796,7 +46796,19 @@
"inputFields": [
{
"name": "deviceIdentifier",
"description": "Simulator device name or UDID to use for the session (e.g. \"iPhone 16 Pro\").",
"description": "Simulator device name or UDID to use for the session (e.g. \"iPhone 17 Pro\"). If omitted,\nthe default device of the selected iOS version is used.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "osVersion",
"description": "iOS version of the Simulator runtime, as major.minor (e.g. \"18.6\") or as a major version\n(e.g. \"26\") for the newest available release of that major. Each version runs on the macOS\nworker image that has that runtime, so the session also uses that image's Xcode. Unavailable\nversions are rejected with the list of available ones. Not every account can select a version\nyet. If omitted, the default iOS version is used.",
"type": {
"kind": "SCALAR",
"name": "String",
@@ -1223,6 +1223,54 @@ describe(Simulator, () => {
expect(mockCreateDeviceRunSessionAsync.mock.calls[0][1]).not.toHaveProperty('ios');
});
it('forwards --os-version in the iOS create options', async () => {
const { command } = createCommand([
'--platform',
'ios',
'--non-interactive',
'--os-version',
' 18.5 ',
]);
await command.runAsync();
expect(mockCreateDeviceRunSessionAsync).toHaveBeenCalledWith(
graphqlClient,
expect.objectContaining({ ios: { osVersion: '18.5' } })
);
});
it('forwards --os-version together with --device', async () => {
const { command } = createCommand([
'--platform',
'ios',
'--non-interactive',
'--device',
'iPhone 16 Pro',
'--os-version',
'26',
]);
await command.runAsync();
expect(mockCreateDeviceRunSessionAsync).toHaveBeenCalledWith(
graphqlClient,
expect.objectContaining({ ios: { deviceIdentifier: 'iPhone 16 Pro', osVersion: '26' } })
);
});
it('rejects --os-version for Android before creating a session', async () => {
const { command } = createCommand([
'--platform',
'android',
'--non-interactive',
'--os-version',
'18.5',
]);
await expect(command.runAsync()).rejects.toThrow(
'--os-version is only supported with --platform ios.'
);
expect(mockCreateDeviceRunSessionAsync).not.toHaveBeenCalled();
});
it('omits resourceClass when --resource-class is not set', async () => {
const { command } = createCommand(['--platform', 'ios', '--non-interactive']);
await command.runAsync();
@@ -108,6 +108,10 @@ export default class Simulator extends EasCommand {
description:
'Android SDK system image package to use for the emulator (e.g. "system-images;android-35-ext15;google_apis_playstore;x86_64"). Defaults to a system image chosen by the runner. Only supported with --platform android.',
}),
'os-version': Flags.string({
description:
'iOS version of the Simulator runtime, as major.minor (e.g. "18.6") or as a major version (e.g. "26") for the newest available release of that major. Unavailable versions are rejected with the list of available ones. Defaults to the server default. Only supported with --platform ios.',
}),
'build-id': Flags.string({
description: 'EAS Build to install and launch before the simulator session is ready.',
exclusive: ['build-fingerprint', 'application-archive-url', 'expo-go'],
@@ -257,6 +261,7 @@ export default class Simulator extends EasCommand {
const tags = flags.tag?.map(tag => tag.trim()).filter(tag => tag.length > 0);
const deviceIdentifier = flags.device?.trim() || undefined;
const systemImagePackage = flags['system-image']?.trim() || undefined;
const osVersion = flags['os-version']?.trim() || undefined;
const buildId = flags['build-id']?.trim() || undefined;
const buildFingerprint = flags['build-fingerprint']?.trim() || undefined;
const applicationArchiveUrlFromFlag = flags['application-archive-url']?.trim() || undefined;
@@ -303,6 +308,9 @@ export default class Simulator extends EasCommand {
if (systemImagePackage && platform !== AppPlatform.Android) {
throw new EasCommandError('--system-image is only supported with --platform android.');
}
if (osVersion && platform !== AppPlatform.Ios) {
throw new EasCommandError('--os-version is only supported with --platform ios.');
}
let egressAllow: string[] = [];
try {
egressAllow = parseEgressAllowList(flags['egress-allow'] ?? []);
@@ -379,8 +387,13 @@ export default class Simulator extends EasCommand {
networkCapture: flags['network-capture'],
...(networkCaptureFields.length ? { networkCaptureFields } : {}),
...(platform === AppPlatform.Ios
? deviceIdentifier
? { ios: { deviceIdentifier } }
? deviceIdentifier || osVersion
? {
ios: {
...(deviceIdentifier ? { deviceIdentifier } : {}),
...(osVersion ? { osVersion } : {}),
},
}
: {}
: deviceIdentifier || systemImagePackage
? {
+12 -1
View File
@@ -6613,8 +6613,19 @@ export type CreateGitHubRepositorySettingsInput = {
};
export type CreateIosDeviceRunSessionInput = {
/** Simulator device name or UDID to use for the session (e.g. "iPhone 16 Pro"). */
/**
* Simulator device name or UDID to use for the session (e.g. "iPhone 17 Pro"). If omitted,
* the default device of the selected iOS version is used.
*/
deviceIdentifier?: InputMaybe<Scalars['String']['input']>;
/**
* iOS version of the Simulator runtime, as major.minor (e.g. "18.6") or as a major version
* (e.g. "26") for the newest available release of that major. Each version runs on the macOS
* worker image that has that runtime, so the session also uses that image's Xcode. Unavailable
* versions are rejected with the list of available ones. Not every account can select a version
* yet. If omitted, the default iOS version is used.
*/
osVersion?: InputMaybe<Scalars['String']['input']>;
};
export type CreateIosSubmissionInput = {
@@ -17,6 +17,7 @@ module Pod
%r{https?://(api\.)?github\.com/},
%r{https?://sourceforge\.net/},
%r{https?://repo1\.maven\.org/},
%r{https?://central\.sonatype\.com/},
%r{https?://boostorg\.jfrog\.io/},
%r{https?://www\.sqlite\.org/},
%r{https?://download\.videolan\.org/},
@@ -142,6 +142,17 @@ RSpec.describe ExpoCocoaPodsProxy do
downloader.download_file(path.to_s)
end
it 'fetches Sonatype snapshot artifacts via proxy' do
path = Pathname.new('some/fake/path')
url = 'https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/react-native-artifacts/0.82.0-SNAPSHOT/maven-metadata.xml'
opts = {}
downloader = Pod::Downloader::Http.new(path, url, opts)
expect(downloader).to receive(:download_file_via_proxy).once {}
downloader.download_file(path.to_s)
end
it 'does not proxy when url doesn\'t match an allowlist regex' do
path = Pathname.new('some/fake/path')
url = 'https://not-github.com/expo/test-repo/archive/main.tar.gz'