Skip to content

Commit d667a91

Browse files
committed
Merge branch 'master' into cinodebump
2 parents 4f3e056 + 0f30f19 commit d667a91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+398
-148
lines changed

.github/workflows/node.js.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,6 @@ jobs:
8080
uses: coactions/setup-xvfb@v1
8181
with:
8282
run: npm test
83-
- name: Code coverage (Core)
84-
env:
85-
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
86-
NODE_OPTIONS: ''
87-
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
88-
uses: codecov/codecov-action@v4
89-
with:
90-
flags: macos-core-unittests
91-
verbose: true
92-
file: ./coverage/core/lcov.info
93-
token: ${{ secrets.CODECOV_TOKEN }}
9483
- name: Code coverage (Toolkit)
9584
env:
9685
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
@@ -113,17 +102,6 @@ jobs:
113102
verbose: true
114103
file: ./coverage/amazonq/lcov.info
115104
token: ${{ secrets.CODECOV_TOKEN }}
116-
- name: Code coverage (CodeWhisperer)
117-
env:
118-
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
119-
NODE_OPTIONS: ''
120-
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
121-
uses: codecov/codecov-action@v4
122-
with:
123-
flags: codewhisperer
124-
verbose: true
125-
file: ./coverage/core/lcov.info
126-
token: ${{ secrets.CODECOV_TOKEN }}
127105

128106
web:
129107
needs: lint-commits

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ To run tests against a specific folder in VSCode, do any one of:
218218
219219
### Coverage report
220220
221-
You can find the coverage report at `./coverage/amazonq/lcov-report/index.html` and `./coverage/core/lcov-report/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching.
221+
You can find the coverage report at `./coverage/amazonq/lcov-report/index.html` and `./coverage/toolkit/lcov-report/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching.
222222
223223
### CodeCatalyst Blueprints
224224

buildspec/linuxE2ETests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ phases:
4141
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
4242
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
4343
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
44-
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
44+
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
4545
finally:
4646
- rm -rf ~/.aws/sso/cache || true
4747
reports:

buildspec/linuxIntegrationTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ phases:
7575
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
7676
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
7777
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
78-
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
78+
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
7979
post_build:
8080
commands:
8181
# Destroy .netrc to avoid leaking $GITHUB_READONLY_TOKEN.

buildspec/linuxTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ phases:
4848
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
4949
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g') # Encode `#` in the URL because otherwise the url is clipped in the Codecov.io site
5050
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
51-
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
51+
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
5252

5353
reports:
5454
unit-test:

packages/core/.c8rc.json

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

packages/core/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"AWS.command.ec2.stopInstance": "Stop EC2 Instance",
130130
"AWS.command.ec2.rebootInstance": "Reboot EC2 Instance",
131131
"AWS.command.ec2.copyInstanceId": "Copy Instance Id",
132+
"AWS.command.ec2.viewLogs": "View EC2 Logs",
132133
"AWS.command.ecr.copyTagUri": "Copy Tag URI",
133134
"AWS.command.ecr.copyRepositoryUri": "Copy Repository URI",
134135
"AWS.command.ecr.createRepository": "Create Repository...",

packages/core/src/awsService/cloudWatchLogs/changeLogSearch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { CancellationError } from '../../shared/utilities/timeoutUtils'
66
import { telemetry } from '../../shared/telemetry/telemetry'
77
import { showInputBox } from '../../shared/ui/inputPrompter'
8-
import { createURIFromArgs, isLogStreamUri, recordTelemetryFilter } from './cloudWatchLogsUtils'
8+
import { cwlUriSchema, isLogStreamUri, recordTelemetryFilter } from './cloudWatchLogsUtils'
99
import { prepareDocument } from './commands/searchLogGroup'
1010
import { getActiveDocumentUri } from './document/logDataDocumentProvider'
1111
import { CloudWatchLogsData, filterLogEventsFromUri, LogDataRegistry } from './registry/logDataRegistry'
@@ -98,7 +98,7 @@ export async function changeLogSearchParams(
9898
throw new CancellationError('user')
9999
}
100100

101-
const newUri = createURIFromArgs(newData.logGroupInfo, newData.parameters)
101+
const newUri = cwlUriSchema.form({ logGroupInfo: newData.logGroupInfo, parameters: newData.parameters })
102102
await prepareDocument(newUri, newData, registry)
103103
})
104104
}

packages/core/src/awsService/cloudWatchLogs/cloudWatchLogsUtils.ts

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import { telemetry } from '../../shared/telemetry/telemetry'
66
import * as vscode from 'vscode'
77
import { CLOUDWATCH_LOGS_SCHEME } from '../../shared/constants'
88
import { fromExtensionManifest } from '../../shared/settings'
9-
import { CloudWatchLogsData, CloudWatchLogsGroupInfo } from './registry/logDataRegistry'
9+
import { CloudWatchLogsArgs, CloudWatchLogsData, CloudWatchLogsGroupInfo } from './registry/logDataRegistry'
1010
import { CloudWatchLogsParameters } from './registry/logDataRegistry'
11+
import { UriSchema } from '../../shared/utilities/uriUtils'
1112

1213
// URIs are the only vehicle for delivering information to a TextDocumentContentProvider.
1314
// The following functions are used to structure and destructure relevant information to/from a URI.
@@ -32,8 +33,7 @@ export function recordTelemetryFilter(logData: CloudWatchLogsData): void {
3233
export function uriToKey(uri: vscode.Uri): string {
3334
if (uri.query) {
3435
try {
35-
const { filterPattern, startTime, endTime, limit, streamNameOptions } =
36-
parseCloudWatchLogsUri(uri).parameters
36+
const { filterPattern, startTime, endTime, limit, streamNameOptions } = cwlUriSchema.parse(uri).parameters
3737
const parts = [uri.path, filterPattern, startTime, endTime, limit, streamNameOptions]
3838
return parts.map((p) => p ?? '').join(':')
3939
} catch {
@@ -52,18 +52,15 @@ export function uriToKey(uri: vscode.Uri): string {
5252
* message as the actual log group search. That results in a more fluid UX.
5353
*/
5454
export function msgKey(logGroupInfo: CloudWatchLogsGroupInfo): string {
55-
const uri = createURIFromArgs(logGroupInfo, {})
55+
const uri = cwlUriSchema.form({ logGroupInfo: logGroupInfo, parameters: {} })
5656
return uri.toString()
5757
}
5858

5959
/**
6060
* Destructures an awsCloudWatchLogs URI into its component pieces.
6161
* @param uri URI for a Cloudwatch Logs file
6262
*/
63-
export function parseCloudWatchLogsUri(uri: vscode.Uri): {
64-
logGroupInfo: CloudWatchLogsGroupInfo
65-
parameters: CloudWatchLogsParameters
66-
} {
63+
function parseCloudWatchLogsUri(uri: vscode.Uri): CloudWatchLogsArgs {
6764
const parts = uri.path.split(':')
6865

6966
if (uri.scheme !== CLOUDWATCH_LOGS_SCHEME) {
@@ -85,18 +82,8 @@ export function parseCloudWatchLogsUri(uri: vscode.Uri): {
8582
}
8683
}
8784

88-
/** True if given URI is a valid Cloud Watch Logs Uri */
89-
export function isCwlUri(uri: vscode.Uri): boolean {
90-
try {
91-
parseCloudWatchLogsUri(uri)
92-
return true
93-
} catch {
94-
return false
95-
}
96-
}
97-
9885
export function patternFromCwlUri(uri: vscode.Uri): CloudWatchLogsParameters['filterPattern'] {
99-
return parseCloudWatchLogsUri(uri).parameters.filterPattern
86+
return cwlUriSchema.parse(uri).parameters.filterPattern
10087
}
10188

10289
/**
@@ -105,7 +92,7 @@ export function patternFromCwlUri(uri: vscode.Uri): CloudWatchLogsParameters['fi
10592
* @returns
10693
*/
10794
export function isLogStreamUri(uri: vscode.Uri): boolean {
108-
const logGroupInfo = parseCloudWatchLogsUri(uri).logGroupInfo
95+
const logGroupInfo = cwlUriSchema.parse(uri).logGroupInfo
10996
return logGroupInfo.streamName !== undefined
11097
}
11198

@@ -115,15 +102,13 @@ export function isLogStreamUri(uri: vscode.Uri): boolean {
115102
* @param streamName Log stream name
116103
* @param regionName AWS region
117104
*/
118-
export function createURIFromArgs(
119-
logGroupInfo: CloudWatchLogsGroupInfo,
120-
parameters: CloudWatchLogsParameters
121-
): vscode.Uri {
122-
let uriStr = `${CLOUDWATCH_LOGS_SCHEME}:${logGroupInfo.regionName}:${logGroupInfo.groupName}`
123-
uriStr += logGroupInfo.streamName ? `:${logGroupInfo.streamName}` : ''
105+
function createURIFromArgs(args: CloudWatchLogsArgs): vscode.Uri {
106+
let uriStr = `${CLOUDWATCH_LOGS_SCHEME}:${args.logGroupInfo.regionName}:${args.logGroupInfo.groupName}`
107+
uriStr += args.logGroupInfo.streamName ? `:${args.logGroupInfo.streamName}` : ''
124108

125-
uriStr += `?${encodeURIComponent(JSON.stringify(parameters))}`
109+
uriStr += `?${encodeURIComponent(JSON.stringify(args.parameters))}`
126110
return vscode.Uri.parse(uriStr)
127111
}
112+
export const cwlUriSchema = new UriSchema<CloudWatchLogsArgs>(parseCloudWatchLogsUri, createURIFromArgs)
128113

129114
export class CloudWatchLogsSettings extends fromExtensionManifest('aws.cwl', { limit: Number }) {}

packages/core/src/awsService/cloudWatchLogs/commands/copyLogResource.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as nls from 'vscode-nls'
77
const localize = nls.loadMessageBundle()
88

99
import * as vscode from 'vscode'
10-
import { isLogStreamUri, parseCloudWatchLogsUri } from '../cloudWatchLogsUtils'
10+
import { cwlUriSchema, isLogStreamUri } from '../cloudWatchLogsUtils'
1111
import { copyToClipboard } from '../../../shared/utilities/messages'
1212

1313
export async function copyLogResource(uri?: vscode.Uri): Promise<void> {
@@ -20,7 +20,7 @@ export async function copyLogResource(uri?: vscode.Uri): Promise<void> {
2020
throw new Error('no active text editor, or undefined URI')
2121
}
2222
}
23-
const parsedUri = parseCloudWatchLogsUri(uri)
23+
const parsedUri = cwlUriSchema.parse(uri)
2424
const resourceName = isLogStreamUri(uri) ? parsedUri.logGroupInfo.streamName : parsedUri.logGroupInfo.groupName
2525

2626
if (!resourceName) {

0 commit comments

Comments
 (0)