Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
15236a2c
Unverified
Commit
15236a2c
authored
Feb 26, 2020
by
Robert Knight
Committed by
GitHub
Feb 26, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1830 from hypothesis/remove-sourcemap-upload
Remove unused sourcemap upload scripts
parents
a78b8642
1e91cac1
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
398 deletions
+6
-398
gulpfile.js
gulpfile.js
+0
-25
package.json
package.json
+0
-1
upload-to-sentry.js
scripts/gulp/upload-to-sentry.js
+0
-127
yarn.lock
yarn.lock
+6
-245
No files found.
gulpfile.js
View file @
15236a2c
...
...
@@ -40,13 +40,6 @@ function parseCommandLine() {
const
taskArgs
=
parseCommandLine
();
function
getEnv
(
key
)
{
if
(
!
process
.
env
.
hasOwnProperty
(
key
))
{
throw
new
Error
(
`Environment variable
${
key
}
is not set`
);
}
return
process
.
env
[
key
];
}
/** A list of all modules included in vendor bundles. */
const
vendorModules
=
Object
.
keys
(
vendorBundles
.
bundles
).
reduce
(
function
(
deps
,
...
...
@@ -355,21 +348,3 @@ gulp.task(
'test-watch'
,
gulp
.
series
(
'build-css'
,
done
=>
runKarma
({
singleRun
:
false
},
done
))
);
gulp
.
task
(
'upload-sourcemaps'
,
gulp
.
series
(
'build-js'
,
function
()
{
const
uploadToSentry
=
require
(
'./scripts/gulp/upload-to-sentry'
);
const
opts
=
{
key
:
getEnv
(
'SENTRY_API_KEY'
),
organization
:
getEnv
(
'SENTRY_ORGANIZATION'
),
};
const
projects
=
getEnv
(
'SENTRY_PROJECTS'
).
split
(
','
);
const
release
=
getEnv
(
'SENTRY_RELEASE_VERSION'
);
return
gulp
.
src
([
'build/scripts/*.js'
,
'build/scripts/*.map'
])
.
pipe
(
uploadToSentry
(
opts
,
projects
,
release
));
})
);
package.json
View file @
15236a2c
...
...
@@ -91,7 +91,6 @@
"
raf
"
:
"^3.1.0"
,
"
redux
"
:
"^4.0.1"
,
"
redux-thunk
"
:
"^2.1.0"
,
"
request
"
:
"^2.76.0"
,
"
reselect
"
:
"^4.0.0"
,
"
retry
"
:
"^0.12.0"
,
"
sass
"
:
"^1.23.0"
,
...
...
scripts/gulp/upload-to-sentry.js
deleted
100644 → 0
View file @
a78b8642
'use strict'
;
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
log
=
require
(
'fancy-log'
);
const
request
=
require
(
'request'
);
const
through
=
require
(
'through2'
);
const
SENTRY_API_ROOT
=
'https://app.getsentry.com/api/0'
;
/**
* interface SentryOptions {
* /// The Sentry API key
* key: string;
* /// The Sentry organisation to upload the release to
* organization: string;
* }
*/
/** Wrapper around request() that returns a Promise. */
function
httpRequest
(
opts
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
request
(
opts
,
function
(
err
,
response
,
body
)
{
if
(
err
)
{
reject
(
err
);
}
else
{
resolve
({
response
:
response
,
body
:
body
,
});
}
});
});
}
/** Create a release in Sentry. Returns a Promise. */
function
createRelease
(
opts
,
project
,
release
)
{
return
httpRequest
({
uri
:
`
${
SENTRY_API_ROOT
}
/projects/
${
opts
.
organization
}
/
${
project
}
/releases/`
,
method
:
'POST'
,
auth
:
{
user
:
opts
.
key
,
password
:
''
,
},
body
:
{
version
:
release
,
},
json
:
true
,
}).
then
(
function
(
result
)
{
const
success
=
result
.
response
.
statusCode
===
201
;
const
alreadyCreated
=
result
.
response
.
statusCode
===
400
&&
result
.
body
.
detail
.
match
(
/already exists/
);
if
(
success
||
alreadyCreated
)
{
return
;
}
throw
new
Error
(
`unable to create release '
${
release
}
' in project '
${
project
}
'`
);
});
}
/** Upload a named file to a release in Sentry. Returns a Promise. */
function
uploadReleaseFile
(
opts
,
project
,
release
,
file
)
{
return
httpRequest
({
uri
:
`
${
SENTRY_API_ROOT
}
/projects/
${
opts
.
organization
}
/
${
project
}
/releases/
${
release
}
/files/`
,
method
:
'POST'
,
auth
:
{
user
:
opts
.
key
,
password
:
''
,
},
formData
:
{
file
:
fs
.
createReadStream
(
file
.
path
),
name
:
path
.
basename
(
file
.
path
),
},
}).
then
(
function
(
result
)
{
if
(
result
.
response
.
statusCode
===
201
)
{
return
;
}
throw
new
Error
(
`Uploading file failed:
${
result
.
response
.
statusCode
}
:
${
result
.
body
}
`
);
});
}
/**
* Upload a stream of Vinyl files as a Sentry release.
*
* This creates a new release in Sentry using the organization, project
* and release settings in `opts` and uploads the input stream of Vinyl
* files as artefacts for the release.
*
* @param {SentryOptions} opts
* @param {Array[String]} projects - A list of projects to which to upload
* files.
* @param {String} release - The name of the release.
* @return {NodeJS.ReadWriteStream} - A stream into which Vinyl files from
* gulp.src() etc. can be piped.
*/
module
.
exports
=
function
uploadToSentry
(
opts
,
projects
,
release
)
{
// Create releases in every project
const
releases
=
projects
.
map
(
function
(
project
)
{
log
(
`Creating release '
${
release
}
' in project '
${
project
}
'`
);
return
createRelease
(
opts
,
project
,
release
);
});
return
through
.
obj
(
function
(
file
,
enc
,
callback
)
{
Promise
.
all
(
releases
)
.
then
(
function
()
{
log
(
`Uploading
${
path
.
basename
(
file
.
path
)}
`
);
const
uploads
=
projects
.
map
(
function
(
project
)
{
return
uploadReleaseFile
(
opts
,
project
,
release
,
file
);
});
return
Promise
.
all
(
uploads
);
})
.
then
(
function
()
{
callback
();
})
.
catch
(
function
(
err
)
{
log
(
'Sentry upload failed: '
,
err
);
callback
(
err
);
});
});
};
yarn.lock
View file @
15236a2c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment