Skip to content

Commit 4d6542c

Browse files
committed
patch
1 parent 4b9800f commit 4d6542c

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

packages/core/src/codewhisperer/commands/startTestGeneration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export async function startTestGenerationProcess(
7272
let artifactMap: ArtifactMap = {}
7373
const uploadStartTime = performance.now()
7474
try {
75-
artifactMap = await getPresignedUrlAndUploadTestGen(zipMetadata)
75+
artifactMap = await getPresignedUrlAndUploadTestGen(zipMetadata, profile)
7676
} finally {
7777
const outputLogPath = path.join(testGenerationLogsDir, 'output.log')
7878
if (await fs.existsFile(outputLogPath)) {

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export async function preTransformationUploadCode() {
269269
})
270270

271271
transformByQState.setPayloadFilePath(payloadFilePath)
272-
uploadId = await uploadPayload(payloadFilePath)
272+
uploadId = await uploadPayload(payloadFilePath, AuthUtil.instance.regionProfileManager.activeRegionProfile)
273273
telemetry.record({ codeTransformJobId: uploadId }) // uploadId is re-used as jobId
274274
})
275275
} catch (err) {
@@ -457,7 +457,7 @@ export async function finishHumanInTheLoop(selectedDependency?: string) {
457457
}),
458458
})
459459

460-
await uploadPayload(uploadResult.tempFilePath, {
460+
await uploadPayload(uploadResult.tempFilePath, profile, {
461461
transformationUploadContext: {
462462
jobId,
463463
uploadArtifactType: 'Dependencies',

packages/core/src/codewhisperer/service/testGenHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function throwIfCancelled() {
4646
}
4747
}
4848

49-
export async function getPresignedUrlAndUploadTestGen(zipMetadata: ZipMetadata) {
49+
export async function getPresignedUrlAndUploadTestGen(zipMetadata: ZipMetadata, profile: RegionProfile | undefined) {
5050
const logger = getLogger()
5151
if (zipMetadata.zipFilePath === '') {
5252
getLogger().error('Failed to create valid source zip')
@@ -56,6 +56,7 @@ export async function getPresignedUrlAndUploadTestGen(zipMetadata: ZipMetadata)
5656
contentMd5: getMd5(zipMetadata.zipFilePath),
5757
artifactType: 'SourceCode',
5858
uploadIntent: CodeWhispererConstants.testGenUploadIntent,
59+
profileArn: profile?.arn,
5960
}
6061
logger.verbose(`Prepare for uploading src context...`)
6162
const srcResp = await codeWhisperer.codeWhispererClient.createUploadUrl(srcReq).catch((err) => {

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ export async function stopJob(jobId: string) {
194194
}
195195
}
196196

197-
export async function uploadPayload(payloadFileName: string, uploadContext?: UploadContext) {
197+
export async function uploadPayload(
198+
payloadFileName: string,
199+
profile: RegionProfile | undefined,
200+
uploadContext?: UploadContext
201+
) {
198202
const buffer = Buffer.from(await fs.readFileBytes(payloadFileName))
199203
const sha256 = getSha256(buffer)
200204

@@ -206,6 +210,7 @@ export async function uploadPayload(payloadFileName: string, uploadContext?: Upl
206210
contentChecksumType: CodeWhispererConstants.contentChecksumType,
207211
uploadIntent: CodeWhispererConstants.uploadIntent,
208212
uploadContext,
213+
profileArn: profile?.arn,
209214
})
210215
} catch (e: any) {
211216
const errorMessage = `Creating the upload URL failed due to: ${(e as Error).message}`

0 commit comments

Comments
 (0)