mirror of
https://github.com/atom/atom.git
synced 2026-02-15 17:15:24 -05:00
On release branches, we can't upload crash dumps because they will leak secret environment variables. So instead we will upload them to our S3 bucket with 'private' ACL. They can then be manually retrieved via the AWS CLI with our private credentials.
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
'use strict'
|
|
|
|
const glob = require('glob')
|
|
const uploadToS3 = require('./lib/upload-to-s3')
|
|
|
|
const yargs = require('yargs')
|
|
const argv = yargs
|
|
.usage('Usage: $0 [options]')
|
|
.help('help')
|
|
.describe('crash-report-path', 'The local path of a directory containing crash reports to upload')
|
|
.describe('s3-path', 'Indicates the S3 path in which the crash reports should be uploaded')
|
|
.wrap(yargs.terminalWidth())
|
|
.argv
|
|
|
|
async function uploadCrashReports () {
|
|
const crashesPath = argv.crashReportPath
|
|
const crashes = glob.sync('/*.dmp', { root: crashesPath })
|
|
const bucketPath = argv.s3Path
|
|
|
|
if (crashes && crashes.length > 0) {
|
|
console.log(`Uploading ${crashes.length} private crash reports to S3 under '${bucketPath}'`)
|
|
|
|
await uploadToS3(
|
|
process.env.ATOM_RELEASES_S3_KEY,
|
|
process.env.ATOM_RELEASES_S3_SECRET,
|
|
process.env.ATOM_RELEASES_S3_BUCKET,
|
|
bucketPath,
|
|
crashes,
|
|
'private'
|
|
)
|
|
}
|
|
}
|
|
|
|
// Wrap the call the async function and catch errors from its promise because
|
|
// Node.js doesn't yet allow use of await at the script scope
|
|
uploadCrashReports().catch(err => {
|
|
console.error('An error occurred while uploading crash reports:\n\n', err)
|
|
process.exit(1)
|
|
})
|