-
Notifications
You must be signed in to change notification settings - Fork 731
build(sam): pull SAM builds in install phase to avoid timeouts #6179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
53ad85a
b9d4c32
7c8b5cc
a9a1a16
3bdf145
a74e7a2
d4fa8cb
177e620
9d428be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,262 +46,111 @@ const noDebugSessionInterval: number = 100 | |
| /** Go can't handle API tests yet */ | ||
| const skipLanguagesOnApi = ['go'] | ||
|
|
||
| interface TestScenario { | ||
| displayName: string | ||
| runtime: Runtime | ||
| baseImage?: string | ||
| interface TestScenarioDefaults { | ||
| path: string | ||
| debugSessionType: string | ||
| language: Language | ||
| dependencyManager: DependencyManager | ||
| /** Minimum vscode version required by the relevant third-party extension. */ | ||
| vscodeMinimum: string | ||
| } | ||
| type TestScenario = { | ||
| displayName: string | ||
| runtime: Runtime | ||
| baseImage?: string | ||
| } & TestScenarioDefaults | ||
|
|
||
| const nodeDefaults = { | ||
| path: 'hello-world/app.mjs', | ||
| debugSessionType: 'pwa-node', | ||
| dependencyManager: 'npm' as DependencyManager, | ||
| language: 'javascript' as Language, | ||
| vscodeMinimum: '1.50.0', | ||
| } | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| const pythonDefaults = { | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| dependencyManager: 'pip' as DependencyManager, | ||
| language: 'python' as Language, | ||
| vscodeMinimum: '1.77.0', | ||
| } | ||
|
|
||
| const javaDefaults = { | ||
| path: 'HelloWorldFunction/src/main/java/helloworld/App.java', | ||
| debugSessionType: 'java', | ||
| dependencyManager: 'gradle' as DependencyManager, | ||
| language: 'java' as Language, | ||
| vscodeMinimum: '1.50.0', | ||
| } | ||
|
|
||
| const dotnetDefaults = { | ||
| path: 'src/HelloWorld/Function.cs', | ||
| debugSessionType: 'coreclr', | ||
| language: 'csharp' as Language, | ||
| dependencyManager: 'cli-package' as DependencyManager, | ||
| vscodeMinimum: '1.80.0', | ||
| } | ||
|
|
||
| const defaults: Record<Runtime, TestScenarioDefaults> = { | ||
| nodejs: nodeDefaults, | ||
| java: javaDefaults, | ||
| python: pythonDefaults, | ||
| dotnet: dotnetDefaults, | ||
| } | ||
|
|
||
| function generateScenario( | ||
| runtime: Runtime, | ||
| version: string, | ||
| options: Partial<TestScenario & { sourceTag: string }> = {}, | ||
| fromImage: boolean = false | ||
| ): TestScenario { | ||
| if (fromImage && !options.baseImage) { | ||
| throw new Error('baseImage property must be specified when testing from image') | ||
| } | ||
| const { sourceTag, ...defaultOverride } = options | ||
| const source = `(${options.sourceTag ? `${options.sourceTag} ` : ''}${fromImage ? 'Image' : 'ZIP'})` | ||
| const fullName = `${runtime}${version}` | ||
| return { | ||
| runtime: fullName, | ||
| displayName: `${fullName} ${source}`, | ||
| ...defaults[runtime], | ||
| ...defaultOverride, | ||
| } | ||
| } | ||
| // When testing additional runtimes, consider pulling the docker container in buildspec\linuxIntegrationTests.yml | ||
| // to reduce the chance of automated tests timing out. | ||
|
|
||
| const scenarios: TestScenario[] = [ | ||
| // zips | ||
| { | ||
| runtime: 'nodejs18.x', | ||
| displayName: 'nodejs18.x (ZIP)', | ||
| path: 'hello-world/app.mjs', | ||
| debugSessionType: 'pwa-node', | ||
| language: 'javascript', | ||
| dependencyManager: 'npm', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'nodejs20.x', | ||
| displayName: 'nodejs20.x (ZIP)', | ||
| path: 'hello-world/app.mjs', | ||
| debugSessionType: 'pwa-node', | ||
| language: 'javascript', | ||
| dependencyManager: 'npm', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'nodejs22.x', | ||
| displayName: 'nodejs22.x (ZIP)', | ||
| path: 'hello-world/app.mjs', | ||
| debugSessionType: 'pwa-node', | ||
| language: 'javascript', | ||
| dependencyManager: 'npm', | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.10', | ||
| displayName: 'python 3.10 (ZIP)', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.77.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.11', | ||
| displayName: 'python 3.11 (ZIP)', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.12', | ||
| displayName: 'python 3.12 (ZIP)', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.13', | ||
| displayName: 'python 3.13 (ZIP)', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| { | ||
| runtime: 'dotnet6', | ||
| displayName: 'dotnet6 (ZIP)', | ||
| path: 'src/HelloWorld/Function.cs', | ||
| debugSessionType: 'coreclr', | ||
| language: 'csharp', | ||
| dependencyManager: 'cli-package', | ||
| vscodeMinimum: '1.80.0', | ||
| }, | ||
| { | ||
| runtime: 'java8.al2', | ||
| displayName: 'java8.al2 (Maven ZIP)', | ||
| path: 'HelloWorldFunction/src/main/java/helloworld/App.java', | ||
| debugSessionType: 'java', | ||
| language: 'java', | ||
| dependencyManager: 'maven', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'java11', | ||
| displayName: 'java11 (Gradle ZIP)', | ||
| path: 'HelloWorldFunction/src/main/java/helloworld/App.java', | ||
| debugSessionType: 'java', | ||
| language: 'java', | ||
| dependencyManager: 'gradle', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'java17', | ||
| displayName: 'java11 (Gradle ZIP)', | ||
| path: 'HelloWorldFunction/src/main/java/helloworld/App.java', | ||
| debugSessionType: 'java', | ||
| language: 'java', | ||
| dependencyManager: 'gradle', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| // { | ||
| // runtime: 'go1.x', | ||
| // displayName: 'go1.x (ZIP)', | ||
| // path: 'hello-world/main.go', | ||
| // debugSessionType: 'delve', | ||
| // language: 'go', | ||
| // dependencyManager: 'mod', | ||
| // // https://github.com/golang/vscode-go/blob/master/package.json | ||
| // vscodeMinimum: '1.67.0', | ||
| // }, | ||
|
|
||
| generateScenario('nodejs', '18.x'), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A benefit of the old code is that it was "flat" data that did not require inspecting any logic. Copy-pasting can be very costly for logic, but for data, especially data contained in one place (this file) it can be a useful tradeoff. However, your new code is certainly easier to read at a glance. |
||
| generateScenario('nodejs', '20.x'), | ||
| generateScenario('nodejs', '22.x', { vscodeMinimum: '1.78.0' }), | ||
| generateScenario('python', '3.10'), | ||
| generateScenario('python', '3.11', { vscodeMinimum: '1.78.0' }), | ||
| generateScenario('python', '3.12', { vscodeMinimum: '1.78.0' }), | ||
| generateScenario('python', '3.13', { vscodeMinimum: '1.78.0' }), | ||
| generateScenario('dotnet', '6'), | ||
| generateScenario('java', '8.al2', { sourceTag: 'Maven', dependencyManager: 'maven' }), | ||
| generateScenario('java', '11', { sourceTag: 'Gradle' }), | ||
| generateScenario('java', '17', { sourceTag: 'Gradle' }), | ||
| // images | ||
| { | ||
| runtime: 'nodejs18.x', | ||
| displayName: 'nodejs18.x (Image)', | ||
| baseImage: 'amazon/nodejs18.x-base', | ||
| path: 'hello-world/app.mjs', | ||
| debugSessionType: 'pwa-node', | ||
| language: 'javascript', | ||
| dependencyManager: 'npm', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'nodejs20.x', | ||
| displayName: 'nodejs20.x (Image)', | ||
| baseImage: 'amazon/nodejs20.x-base', | ||
| path: 'hello-world/app.mjs', | ||
| debugSessionType: 'pwa-node', | ||
| language: 'javascript', | ||
| dependencyManager: 'npm', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'nodejs22.x', | ||
| displayName: 'nodejs22.x (Image)', | ||
| baseImage: 'amazon/nodejs22.x-base', | ||
| path: 'hello-world/app.mjs', | ||
| debugSessionType: 'pwa-node', | ||
| language: 'javascript', | ||
| dependencyManager: 'npm', | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.10', | ||
| displayName: 'python 3.10 (ZIP)', | ||
| baseImage: 'amazon/python3.10-base', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.77.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.11', | ||
| displayName: 'python 3.11 (ZIP)', | ||
| baseImage: 'amazon/python3.11-base', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.12', | ||
| displayName: 'python 3.12 (ZIP)', | ||
| baseImage: 'amazon/python3.12-base', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| { | ||
| runtime: 'python3.13', | ||
| displayName: 'python 3.13 (ZIP)', | ||
| baseImage: 'amazon/python3.13-base', | ||
| path: 'hello_world/app.py', | ||
| debugSessionType: 'python', | ||
| language: 'python', | ||
| dependencyManager: 'pip', | ||
| // https://github.com/microsoft/vscode-python/blob/main/package.json | ||
| vscodeMinimum: '1.78.0', | ||
| }, | ||
| // { | ||
| // runtime: 'go1.x', | ||
| // displayName: 'go1.x (Image)', | ||
| // baseImage: 'amazon/go1.x-base', | ||
| // path: 'hello-world/main.go', | ||
| // debugSessionType: 'delve', | ||
| // language: 'go', | ||
| // dependencyManager: 'mod', | ||
| // // https://github.com/golang/vscode-go/blob/master/package.json | ||
| // vscodeMinimum: '1.67.0', | ||
| // }, | ||
| { | ||
| runtime: 'java8.al2', | ||
| displayName: 'java8.al2 (Gradle Image)', | ||
| path: 'HelloWorldFunction/src/main/java/helloworld/App.java', | ||
| baseImage: 'amazon/java8.al2-base', | ||
| debugSessionType: 'java', | ||
| language: 'java', | ||
| dependencyManager: 'gradle', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'java11', | ||
| displayName: 'java11 (Maven Image)', | ||
| path: 'HelloWorldFunction/src/main/java/helloworld/App.java', | ||
| baseImage: 'amazon/java11-base', | ||
| debugSessionType: 'java', | ||
| language: 'java', | ||
| dependencyManager: 'maven', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'java17', | ||
| displayName: 'java17 (Maven Image)', | ||
| path: 'HelloWorldFunction/src/main/java/helloworld/App.java', | ||
| baseImage: 'amazon/java17-base', | ||
| debugSessionType: 'java', | ||
| language: 'java', | ||
| dependencyManager: 'maven', | ||
| vscodeMinimum: '1.50.0', | ||
| }, | ||
| { | ||
| runtime: 'dotnet6', | ||
| displayName: 'dotnet6 (Image)', | ||
| path: 'src/HelloWorld/Function.cs', | ||
| baseImage: 'amazon/dotnet6-base', | ||
| debugSessionType: 'coreclr', | ||
| language: 'csharp', | ||
| dependencyManager: 'cli-package', | ||
| vscodeMinimum: '1.80.0', | ||
| }, | ||
| generateScenario('nodejs', '18.x', { baseImage: 'amazon/nodejs18.x-base' }, true), | ||
| generateScenario('nodejs', '20.x', { baseImage: 'amazon/nodejs20.x-base' }, true), | ||
| generateScenario('nodejs', '22.x', { baseImage: 'amazon/nodejs22.x-base', vscodeMinimum: '1.78.0' }, true), | ||
| generateScenario('python', '3.10', { baseImage: 'amazon/python3.10-base' }, true), | ||
| generateScenario('python', '3.11', { baseImage: 'amazon/python3.11-base', vscodeMinimum: '1.78.0' }, true), | ||
| generateScenario('python', '3.12', { baseImage: 'amazon/python3.12-base', vscodeMinimum: '1.78.0' }, true), | ||
| generateScenario('python', '3.13', { baseImage: 'amazon/python3.13-base', vscodeMinimum: '1.78.0' }, true), | ||
| generateScenario('dotnet', '6', { baseImage: 'amazon/dotnet6-base' }, true), | ||
| generateScenario( | ||
| 'java', | ||
| '.al2', | ||
| { baseImage: 'amazon/java8.al2-base', sourceTag: 'Maven', dependencyManager: 'maven' }, | ||
| true | ||
| ), | ||
| generateScenario('java', '11', { baseImage: 'amazon/java11-base', sourceTag: 'Gradle' }, true), | ||
| generateScenario('java', '17', { baseImage: 'amazon/java17-base', sourceTag: 'Gradle' }, true), | ||
| ] | ||
|
|
||
| async function openSamAppFile(applicationPath: string): Promise<vscode.Uri> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea!!