mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
CI - Allow sourcemap uploads to sentry for empty version (#5403)
* Allow sourcemap uploads to sentry for empty version * Fix comments * fix console log msgs * fix console log msgs * clean up * fix linter errors
This commit is contained in:
parent
63c61c52eb
commit
fb6eca3f65
@ -14,21 +14,27 @@ async function start () {
|
|||||||
const versionAlreadyExists = await checkIfVersionExists()
|
const versionAlreadyExists = await checkIfVersionExists()
|
||||||
// abort if versions exists
|
// abort if versions exists
|
||||||
if (versionAlreadyExists) {
|
if (versionAlreadyExists) {
|
||||||
console.log(`Version "${VERSION}" already exists on Sentry, aborting sourcemap upload.`)
|
console.log(`Version "${VERSION}" already exists on Sentry, skipping version creation`)
|
||||||
return
|
} else {
|
||||||
|
// create sentry release
|
||||||
|
console.log(`creating Sentry release for "${VERSION}"...`)
|
||||||
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' new ${VERSION}`)
|
||||||
|
console.log(`removing any existing files from Sentry release "${VERSION}"...`)
|
||||||
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} delete --all`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create sentry release
|
// check if version has artifacts or not
|
||||||
console.log(`creating Sentry release for "${VERSION}"...`)
|
const versionHasArtifacts = versionAlreadyExists && await checkIfVersionHasArtifacts()
|
||||||
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' new ${VERSION}`)
|
if (!versionHasArtifacts) {
|
||||||
console.log(`removing any existing files from Sentry release "${VERSION}"...`)
|
// upload sentry source and sourcemaps
|
||||||
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} delete --all`)
|
console.log(`uploading source files Sentry release "${VERSION}"...`)
|
||||||
// upload sentry source and sourcemaps
|
await exec(`for FILEPATH in ./dist/chrome/*.js; do [ -e $FILEPATH ] || continue; export FILE=\`basename $FILEPATH\` && echo uploading $FILE && sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload $FILEPATH metamask/$FILE; done;`)
|
||||||
console.log(`uploading source files Sentry release "${VERSION}"...`)
|
console.log(`uploading sourcemaps Sentry release "${VERSION}"...`)
|
||||||
await exec(`for FILEPATH in ./dist/chrome/*.js; do [ -e $FILEPATH ] || continue; export FILE=\`basename $FILEPATH\` && echo uploading $FILE && sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload $FILEPATH metamask/$FILE; done;`)
|
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload-sourcemaps ./dist/sourcemaps/ --url-prefix 'sourcemaps'`)
|
||||||
console.log(`uploading sourcemaps Sentry release "${VERSION}"...`)
|
console.log('all done!')
|
||||||
await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload-sourcemaps ./dist/sourcemaps/ --url-prefix 'sourcemaps'`)
|
} else {
|
||||||
console.log('all done!')
|
console.log(`Version "${VERSION}" already has artifacts on Sentry, skipping sourcemap upload`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkIfAuthWorks () {
|
async function checkIfAuthWorks () {
|
||||||
@ -45,6 +51,12 @@ async function checkIfVersionExists () {
|
|||||||
return versionAlreadyExists
|
return versionAlreadyExists
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function checkIfVersionHasArtifacts () {
|
||||||
|
const artifacts = await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} list`)
|
||||||
|
// When there's no artifacts, we get a response from the shell like this ['', '']
|
||||||
|
return artifacts[0] && artifacts[0].length > 0
|
||||||
|
}
|
||||||
|
|
||||||
async function doesNotFail (asyncFn) {
|
async function doesNotFail (asyncFn) {
|
||||||
try {
|
try {
|
||||||
await asyncFn()
|
await asyncFn()
|
||||||
|
Loading…
Reference in New Issue
Block a user