Skip to content

Commit 534d953

Browse files
committed
Revert Copilot source build pipeline
The build orchestration now lives in microsoft/vscode-engineering.
1 parent a981a0c commit 534d953

21 files changed

Lines changed: 31 additions & 2519 deletions

build/azure-pipelines/common/apply-sdk-canary-override.ts

Lines changed: 4 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import fs from 'fs';
77
import path from 'path';
88
import { execFileSync } from 'child_process';
9-
import { copilotSourceVersion, readCopilotBuildOverrides, RUNTIME_NPM_NAME, SDK_NPM_NAME, type CopilotBuildOverrides, type VscodeSourceMetadata } from './copilotSource.ts';
109

1110
/**
1211
* Stage 3 of the Copilot SDK -> VS Code integration pipeline.
@@ -46,7 +45,6 @@ const ROOT = path.join(import.meta.dirname, '../../../');
4645
*/
4746
const IS_WINDOWS = process.platform === 'win32';
4847
const NPM = IS_WINDOWS ? 'npm.cmd' : 'npm';
49-
const COPILOT_SOURCE_PIPELINE_URL = 'https://dev.azure.com/monacotools/Monaco/_build?definitionId=704';
5048

5149
/**
5250
* Allowlist for npm version / range specifiers before they are interpolated
@@ -67,7 +65,7 @@ function assertSafeSpec(label: string, value: string): void {
6765
/** Manifests that declare the Copilot dependencies. */
6866
const TARGET_DIRS = ['', 'remote'];
6967

70-
export interface Override {
68+
interface Override {
7169
readonly name: string;
7270
readonly version: string;
7371
}
@@ -189,7 +187,7 @@ function resolveLatestCanary(): string {
189187
return latest;
190188
}
191189

192-
function collectCanaryOverrides(): Override[] {
190+
function collectOverrides(): Override[] {
193191
let sdkVersion = (process.env['VSCODE_SDK_CANARY_VERSION'] ?? '').trim();
194192
if (!sdkVersion) {
195193
return [];
@@ -228,71 +226,6 @@ function collectCanaryOverrides(): Override[] {
228226
return overrides;
229227
}
230228

231-
function readVscodeSourceMetadata(packageName: string, version: string): VscodeSourceMetadata {
232-
let raw: string;
233-
try {
234-
raw = execFileSync(NPM, ['view', `${packageName}@${version}`, 'vscodeSource', '--json'], { encoding: 'utf8', shell: IS_WINDOWS });
235-
} catch (error) {
236-
throw new Error(
237-
`[build-override] ${packageName}@${version} is not available from the configured feed. ` +
238-
`Run the Copilot source pipeline for this VS Code commit: ${COPILOT_SOURCE_PIPELINE_URL}\n` +
239-
`${error instanceof Error ? error.message : String(error)}`
240-
);
241-
}
242-
const metadata = JSON.parse(raw || 'null') as Partial<VscodeSourceMetadata> | null;
243-
if (!metadata || typeof metadata !== 'object') {
244-
throw new Error(`[build-override] ${packageName}@${version} has no vscodeSource provenance metadata. Run ${COPILOT_SOURCE_PIPELINE_URL}`);
245-
}
246-
return metadata as VscodeSourceMetadata;
247-
}
248-
249-
export function assertVscodeSourceMetadata(packageName: string, packageVersion: string, actual: VscodeSourceMetadata, expected: VscodeSourceMetadata): void {
250-
const mismatches = (Object.keys(expected) as (keyof VscodeSourceMetadata)[])
251-
.filter(key => key !== 'sourceBuildId' && actual[key] !== expected[key])
252-
.map(key => `${key}: expected ${expected[key]}, got ${actual[key] ?? '<missing>'}`);
253-
if (mismatches.length > 0) {
254-
throw new Error(
255-
`[build-override] ${packageName}@${packageVersion} does not match package.json buildOverrides (${mismatches.join('; ')}). ` +
256-
`Run the Copilot source pipeline: ${COPILOT_SOURCE_PIPELINE_URL}`
257-
);
258-
}
259-
}
260-
261-
export function collectBuildOverrides(
262-
buildOverrides: CopilotBuildOverrides,
263-
vscodeCommit: string,
264-
metadataReader: (packageName: string, version: string) => VscodeSourceMetadata = readVscodeSourceMetadata,
265-
queuedSdk = (process.env['VSCODE_SDK_CANARY_VERSION'] ?? '').trim(),
266-
queuedCli = (process.env['VSCODE_CLI_CANARY_VERSION'] ?? '').trim(),
267-
): Override[] {
268-
if (queuedSdk || queuedCli) {
269-
throw new Error('[build-override] package.json buildOverrides cannot be combined with VSCODE_SDK_CANARY_VERSION or VSCODE_CLI_CANARY_VERSION.');
270-
}
271-
const version = copilotSourceVersion(buildOverrides.vscodeVersion, vscodeCommit);
272-
const expectedByPackage = new Map<string, VscodeSourceMetadata>([
273-
[SDK_NPM_NAME, {
274-
vscodeCommit,
275-
sourceCommit: buildOverrides.sdkRef,
276-
sourceVersion: buildOverrides.sdkVersion,
277-
sourceBuildId: '',
278-
}],
279-
[RUNTIME_NPM_NAME, {
280-
vscodeCommit,
281-
sourceCommit: buildOverrides.runtimeRef,
282-
sourceVersion: buildOverrides.runtimeVersion,
283-
sourceBuildId: '',
284-
}],
285-
]);
286-
for (const [packageName, expected] of expectedByPackage) {
287-
assertVscodeSourceMetadata(packageName, version, metadataReader(packageName, version), expected);
288-
}
289-
console.log(`##vso[build.addbuildtag]copilot-build-override=${version}`);
290-
return [
291-
{ name: SDK_NPM_NAME, version },
292-
{ name: RUNTIME_NPM_NAME, version },
293-
];
294-
}
295-
296229
function applyOverrides(dir: string, overrides: Override[]): Override[] {
297230
const packageJsonPath = path.join(ROOT, dir, 'package.json');
298231
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
@@ -350,20 +283,7 @@ function verifyResolved(dir: string, overrides: Override[]): void {
350283
}
351284

352285
function main(): void {
353-
const buildOverrides = readCopilotBuildOverrides(ROOT);
354-
const canaryRequested = Boolean((process.env['VSCODE_SDK_CANARY_VERSION'] ?? '').trim());
355-
if (process.argv.includes('--detect')) {
356-
if (buildOverrides && ((process.env['VSCODE_SDK_CANARY_VERSION'] ?? '').trim() || (process.env['VSCODE_CLI_CANARY_VERSION'] ?? '').trim())) {
357-
throw new Error('[build-override] package.json buildOverrides cannot be combined with SDK/CLI canary version parameters.');
358-
}
359-
console.log(`##vso[task.setvariable variable=VSCODE_APPLY_COPILOT_OVERRIDE]${Boolean(buildOverrides || canaryRequested)}`);
360-
console.log(`[build-override] ${buildOverrides ? 'Detected package.json Copilot build overrides.' : canaryRequested ? 'Detected an SDK canary request.' : 'No Copilot package override detected.'}`);
361-
return;
362-
}
363-
364-
const overrides = buildOverrides
365-
? collectBuildOverrides(buildOverrides, (process.env['BUILD_SOURCEVERSION'] ?? '').trim())
366-
: collectCanaryOverrides();
286+
const overrides = collectOverrides();
367287
if (overrides.length === 0) {
368288
console.log('[canary-override] No canary versions set — nothing to do.');
369289
return;
@@ -378,6 +298,4 @@ function main(): void {
378298
}
379299
}
380300

381-
if (import.meta.main) {
382-
main();
383-
}
301+
main();
Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Copilot package override integration. Applies package.json buildOverrides
2-
# automatically, or the existing SDK canary parameters when no build override
3-
# is present. Refreshes lockfiles before the node_modules cache key is computed.
1+
# SDK canary integration (no-op unless VSCODE_SDK_CANARY_VERSION is set).
2+
# Overrides @github/copilot-sdk / @github/copilot to a version published to the
3+
# private feed and refreshes the lockfile so the node_modules cache key below
4+
# misses and `npm ci` installs the canary. Authenticates to the feed first so
5+
# the override's lockfile refresh can resolve the canary — the standard
6+
# npmAuthenticate runs only after the cache-key step. Mirrors common/agent-sdk-produce.yml.
47
# See microsoft/vscode-engineering specs/sdk-vscode-integration.spec.md.
58

69
parameters:
@@ -9,50 +12,37 @@ parameters:
912
default: false
1013

1114
steps:
12-
- ${{ if eq(parameters.windows, true) }}:
13-
- powershell: node build/azure-pipelines/common/apply-sdk-canary-override.ts --detect
14-
env:
15-
VSCODE_SDK_CANARY_VERSION: $(VSCODE_SDK_CANARY_VERSION)
16-
VSCODE_CLI_CANARY_VERSION: $(VSCODE_CLI_CANARY_VERSION)
17-
displayName: Detect Copilot package override
18-
- ${{ else }}:
19-
- script: node build/azure-pipelines/common/apply-sdk-canary-override.ts --detect
20-
env:
21-
VSCODE_SDK_CANARY_VERSION: $(VSCODE_SDK_CANARY_VERSION)
22-
VSCODE_CLI_CANARY_VERSION: $(VSCODE_CLI_CANARY_VERSION)
23-
displayName: Detect Copilot package override
24-
2515
- ${{ if eq(parameters.windows, true) }}:
2616
- powershell: |
2717
npm config set registry $env:NPM_REGISTRY
2818
Write-Host "##vso[task.setvariable variable=SDK_CANARY_NPMRC_PATH]$(npm config get userconfig)"
29-
condition: and(succeeded(), eq(variables['VSCODE_APPLY_COPILOT_OVERRIDE'], 'true'))
30-
displayName: Copilot override — set registry for auth
19+
condition: and(succeeded(), ne(variables['VSCODE_SDK_CANARY_VERSION'], ''))
20+
displayName: SDK canary — set registry for auth
3121
- ${{ else }}:
3222
- script: |
3323
set -e
3424
npm config set registry "$NPM_REGISTRY"
3525
echo "##vso[task.setvariable variable=SDK_CANARY_NPMRC_PATH]$(npm config get userconfig)"
36-
condition: and(succeeded(), eq(variables['VSCODE_APPLY_COPILOT_OVERRIDE'], 'true'))
37-
displayName: Copilot override — set registry for auth
26+
condition: and(succeeded(), ne(variables['VSCODE_SDK_CANARY_VERSION'], ''))
27+
displayName: SDK canary — set registry for auth
3828
3929
- task: npmAuthenticate@0
4030
inputs:
4131
workingFile: $(SDK_CANARY_NPMRC_PATH)
42-
condition: and(succeeded(), eq(variables['VSCODE_APPLY_COPILOT_OVERRIDE'], 'true'))
43-
displayName: Copilot override — authenticate feed
32+
condition: and(succeeded(), ne(variables['VSCODE_SDK_CANARY_VERSION'], ''))
33+
displayName: SDK canary — authenticate feed
4434

4535
- ${{ if eq(parameters.windows, true) }}:
4636
- powershell: node build/azure-pipelines/common/apply-sdk-canary-override.ts
47-
condition: and(succeeded(), eq(variables['VSCODE_APPLY_COPILOT_OVERRIDE'], 'true'))
37+
condition: and(succeeded(), ne(variables['VSCODE_SDK_CANARY_VERSION'], ''))
4838
env:
4939
VSCODE_SDK_CANARY_VERSION: $(VSCODE_SDK_CANARY_VERSION)
5040
VSCODE_CLI_CANARY_VERSION: $(VSCODE_CLI_CANARY_VERSION)
51-
displayName: Apply Copilot package override
41+
displayName: Apply SDK canary override
5242
- ${{ else }}:
5343
- script: node build/azure-pipelines/common/apply-sdk-canary-override.ts
54-
condition: and(succeeded(), eq(variables['VSCODE_APPLY_COPILOT_OVERRIDE'], 'true'))
44+
condition: and(succeeded(), ne(variables['VSCODE_SDK_CANARY_VERSION'], ''))
5545
env:
5646
VSCODE_SDK_CANARY_VERSION: $(VSCODE_SDK_CANARY_VERSION)
5747
VSCODE_CLI_CANARY_VERSION: $(VSCODE_CLI_CANARY_VERSION)
58-
displayName: Apply Copilot package override
48+
displayName: Apply SDK canary override

build/azure-pipelines/common/build-copilot-runtime-target.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

build/azure-pipelines/common/buildCopilotOverride.ts

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)