|
1 | 1 | /**
|
2 | 2 | * Usage: `yarn view-test-artifacts <buildBatchId>`
|
3 |
| - * |
4 |
| - * N.B. It is important to have your local environment configured for the correct codebuild account before running the script. |
5 |
| - * This script caches resources, but in the case the local resource state is out of sync, you may need to wipe the asset directory |
6 |
| - * that is printed when the script begins. |
7 | 3 | */
|
8 | 4 |
|
9 | 5 | import * as process from 'process';
|
10 | 6 | import * as path from 'path';
|
11 | 7 | import * as os from 'os';
|
12 | 8 | import * as fs from 'fs-extra';
|
13 | 9 | // eslint-disable-next-line import/no-extraneous-dependencies
|
14 |
| -import { CodeBuild, S3 } from 'aws-sdk'; |
| 10 | +import { CodeBuild, S3, SharedIniFileCredentials } from 'aws-sdk'; |
15 | 11 | // eslint-disable-next-line import/no-extraneous-dependencies
|
16 | 12 | import { SingleBar, Presets } from 'cli-progress';
|
17 | 13 | import * as execa from 'execa';
|
18 | 14 |
|
19 |
| -const s3 = new S3(); |
| 15 | +const E2E_PROFILE_NAME = 'AmplifyAPIE2EProd'; |
| 16 | +const credentials = new SharedIniFileCredentials({ profile: E2E_PROFILE_NAME }); |
| 17 | +const s3 = new S3({ credentials }); |
| 18 | +const codeBuild = new CodeBuild({ credentials, region: 'us-east-1' }); |
20 | 19 | const progressBar = new SingleBar({}, Presets.shades_classic);
|
21 | 20 |
|
22 | 21 | type BuildStatus = 'FAILED' | 'FAULT' | 'IN_PROGRESS' | 'STOPPED' | 'SUCCEEDED' | 'TIMED_OUT';
|
@@ -82,7 +81,6 @@ const generateIndexFile = (directory: string, artifacts: TestArtifact[]): void =
|
82 | 81 | * @param batchId the batch to look up.
|
83 | 82 | */
|
84 | 83 | const retrieveArtifactsForBatch = async (batchId: string): Promise<TestArtifact[]> => {
|
85 |
| - const codeBuild = new CodeBuild({ region: 'us-east-1' }); |
86 | 84 | const { buildBatches } = await codeBuild.batchGetBuildBatches({ ids: [batchId] }).promise();
|
87 | 85 | return (buildBatches || [])
|
88 | 86 | .flatMap((batch) =>
|
|
0 commit comments