Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct flag name regex, remove x- from some headers #160

Merged
merged 8 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
build-alpine:
docker:
# specify the version you desire here
- image: alpine:3.13.5
- image: alpine:3.14.0

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
test-alpine:
docker:
# specify the version you desire here
- image: alpine:3.13.5
- image: alpine:3.14.0
steps:
- run:
name: Install git
Expand Down Expand Up @@ -190,6 +190,7 @@ jobs:
name: Run Linux binary (upload)
command: |
out/codecov-linux -F linux -Z -e CIRCLE_BRANCH
out/codecov-linux -F "-linux" -Z -e CIRCLE_BRANCH

- persist_to_workspace:
root: .
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.

# Codecov Uploader

[![CircleCI](https://circleci.com/gh/codecov/uploader.svg?style=shield&circle-token=def755bf76a1d8c36436c3115530c7eac7fa30e0)](https://circleci.com/gh/codecov/uploader) [![codecov](https://codecov.io/gh/codecov/uploader/branch/master/graph/badge.svg?token=X1gImxfIya)](https://codecov.io/gh/codecov/uploader)
Expand Down
14 changes: 13 additions & 1 deletion bin/codecov
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,16 @@ var argv = require("yargs") // eslint-disable-line
.help("help")
.alias("help", "h").argv;

app.main(argv);
const start = Date.now()

app.log(`Start of uploader: ${start}...`, { level: 'debug', argv })
app.main(argv).then(() => {
const end = Date.now()
app.log(`End of uploader: ${end - start} milliseconds`, { level: 'debug', argv })
}).catch(error => {
app.log(`Error!: ${error}`, { level: 'error', argv })
const end = Date.now()
app.log(`End of uploader: ${end - start} milliseconds`, { level: 'debug', argv })
process.exit(argv.nonZero ? -1 : 0)
})

816 changes: 537 additions & 279 deletions npm-shrinkwrap.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"superagent": "6.1.0"
},
"devDependencies": {
"eslint": "7.28.0",
"eslint": "7.29.0",
"eslint-config-prettier": "8.3.0",
"husky": "6.0.0",
"jest": "27.0.4",
"jest": "27.0.5",
"lint-staged": "11.0.0",
"nock": "13.1.0",
"pkg": "5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function validateURL(url) {
}

function validateFlags(flags) {
const mask = /^(?!-)[\w,-]+$/
const mask = /^[\w\.\-]{1,45}$/
return mask.test(flags)
}

Expand Down
11 changes: 6 additions & 5 deletions src/helpers/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ async function uploadToCodecovPUT(uploadURL, uploadFile) {
const result = await superagent
.put(`${putURL}`)
.retry()
.send(uploadFile) // sends a JSON post body
.set('Content-Type', 'application/x-gzip')
.send(uploadFile)
.set('Content-Type', 'text/plain')
.set('Content-Encoding', 'gzip')

if (result.status === 200) {
Expand All @@ -64,10 +64,11 @@ async function uploadToCodecov(uploadURL, token, query, uploadFile, version) {
const result = await superagent
.post(`${uploadURL}/upload/v4?package=uploader-${version}&${query}`)
.retry()
.send(uploadFile) // sends a JSON post body
.set('X-Reduced-Redundancy', 'false')
.set('X-Content-Type', 'application/x-gzip')
.send(uploadFile)
.set('Content-Type', 'text/plain')
.set('Content-Encoding', 'gzip')
.set('X-Upload-Token', token)
.set('X-Reduced-Redundancy', 'false')

return result.res.text
} catch (error) {
Expand Down
Loading