apple build stops before the archive in an SSH / non-GUI session (errSecInternalComponent) with how to run it in the logged-in session, --allow-ssh to skip; relative credential paths resolve from the project and xcodebuild gets an absolute ASC key path; tests, pitfall 101
This commit is contained in:
parent
467bacc00a
commit
b97f23701f
7 changed files with 72 additions and 6 deletions
|
|
@ -488,3 +488,30 @@ describe('MCP', () => {
|
|||
for (const t of TOOLS.filter(t => ['apple_signing_status', 'originality'].includes(t.name))) expect(t.write).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('apple build outside the GUI session (pitfall 101)', () => {
|
||||
test('SSH or a non-Aqua launchd manager is named; the logged-in session passes', async () => {
|
||||
const { remoteBuildSession } = await import('../cli/lib/xcode');
|
||||
expect(remoteBuildSession({ SSH_CONNECTION: '10.0.0.2 5000 10.0.0.3 22' }, 'Aqua')).toBe('this is an SSH session');
|
||||
expect(remoteBuildSession({}, 'Background')).toContain('launchctl manager: Background');
|
||||
expect(remoteBuildSession({}, 'Aqua')).toBeNull();
|
||||
});
|
||||
test('a project-relative ASC_P8 path becomes absolute (xcodebuild refuses a relative -authenticationKeyPath)', async () => {
|
||||
const { mkdtempSync, mkdirSync, writeFileSync } = await import('node:fs');
|
||||
const { tmpdir } = await import('node:os');
|
||||
const { join, isAbsolute } = await import('node:path');
|
||||
const d = mkdtempSync(join(tmpdir(), 'sb-p8-'));
|
||||
mkdirSync(join(d, '.storebound'));
|
||||
const { generateKeyPairSync } = await import('node:crypto');
|
||||
writeFileSync(join(d, '.storebound/AuthKey_KEYID00002.p8'), generateKeyPairSync('ec', { namedCurve: 'P-256' }).privateKey.export({ type: 'pkcs8', format: 'pem' }).toString());
|
||||
writeFileSync(join(d, '.storebound/credentials.json'), JSON.stringify({ ASC_KEY_ID: 'KEYID00002', ASC_ISSUER_ID: '00000000-0000-0000-0000-000000000000', ASC_P8: '.storebound/AuthKey_KEYID00002.p8' }));
|
||||
const saved = { ...process.env };
|
||||
try {
|
||||
for (const k of ['ASC_KEY_ID', 'ASC_ISSUER_ID', 'ASC_P8']) delete process.env[k];
|
||||
const { ascKeyFile } = await import('../cli/lib/credentials');
|
||||
const path = ascKeyFile(d).keyPath;
|
||||
expect(isAbsolute(path)).toBe(true);
|
||||
expect(path).toBe(join(d, '.storebound/AuthKey_KEYID00002.p8'));
|
||||
} finally { process.env = saved; }
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue