|
1 | 1 | import * as fs from 'fs'; |
2 | 2 | import * as path from 'path'; |
3 | | -import * as aws from 'aws-sdk'; |
| 3 | +import { S3Client } from '@aws-sdk/client-s3'; |
| 4 | +import { Upload } from '@aws-sdk/lib-storage'; |
4 | 5 | import * as archiver from 'archiver'; |
5 | 6 | import { logInfo } from '../util/logger'; |
6 | 7 |
|
@@ -39,23 +40,25 @@ export class CacheUploader { |
39 | 40 | const file = fs.createReadStream(cacheFile); |
40 | 41 | const keyname = this.dateStr + '-' + this.testName + '-test-cache-' + this.releaseName + '.zip'; |
41 | 42 |
|
42 | | - aws.config.region = 'us-west-2'; |
43 | | - |
44 | 43 | // This is a restricted cache upload account |
45 | | - aws.config.credentials = new aws.Credentials({ |
46 | | - accessKeyId: process.env.OSN_ACCESS_KEY_ID, |
47 | | - secretAccessKey: process.env.OSN_SECRET_ACCESS_KEY, |
| 44 | + const s3 = new S3Client({ |
| 45 | + region: 'us-west-2', |
| 46 | + credentials: { |
| 47 | + accessKeyId: process.env.OSN_ACCESS_KEY_ID, |
| 48 | + secretAccessKey: process.env.OSN_SECRET_ACCESS_KEY, |
| 49 | + }, |
48 | 50 | }); |
49 | | - |
50 | | - const upload = new aws.S3.ManagedUpload({ |
51 | | - params: { |
52 | | - Bucket: 'obs-studio-node-tests-cache', |
53 | | - Key: keyname, |
54 | | - Body: file, |
55 | | - }, |
| 51 | + |
| 52 | + const upload = new Upload({ |
| 53 | + client: s3, |
| 54 | + params: { |
| 55 | + Bucket: 'obs-studio-node-tests-cache', |
| 56 | + Key: keyname, |
| 57 | + Body: file, |
| 58 | + }, |
56 | 59 | }); |
57 | | - |
58 | | - upload.promise().then(() => { |
| 60 | + |
| 61 | + upload.done().then(() => { |
59 | 62 | logInfo(this.testName, 'Finished uploading cache'); |
60 | 63 | logInfo(this.testName, keyname); |
61 | 64 | resolve(keyname); |
|
0 commit comments