.prebuildrc upload token ignored
bsrdjan opened this issue · comments
The upload token works from command line:
$ prebuild -v
9.1.0
$ prebuild -r napi -u a36078672b2028a70b80f270dafc3266b610f829
prebuild info begin Prebuild version 9.1.0
prebuild info build Preparing to prebuild node-rfc@1.0.0-rc11 for napi 3 on darwin-x64 using node-gyp
prebuild info build prebuilds/node-rfc-v1.0.0-rc11-napi-v3-darwin-x64.tar.gz exists, skipping build
prebuild info build Uploading 1 prebuilds(s) to GitHub releases
prebuild info build Found 3 prebuild(s) on Github
prebuild info build -> node-rfc-v1.0.0-rc11-napi-v3-darwin-x64.tar.gz
prebuild info build -> node-rfc-v1.0.0-rc11-napi-v3-linux-x64.tar.gz
prebuild info build -> node-rfc-v1.0.0-rc11-napi-v3-win32-x64.tar.gz
prebuild info build Uploaded 0 new prebuild(s) to GitHub
but ignored from .prebuildrc:
$ cat .prebuildrc
upload=a36078672b2028a70b80f270dafc3266b610f829
$ prebuild -r napi -u prebuild info begin Prebuild version 9.1.0
prebuild info build Preparing to prebuild node-rfc@1.0.0-rc11 for napi 3 on darwin-x64 using node-gyp
prebuild info build prebuilds/node-rfc-v1.0.0-rc11-napi-v3-darwin-x64.tar.gz exists, skipping build
prebuild info build Uploading 1 prebuilds(s) to GitHub releases
prebuild ERR! build Error: Error from GitHub: Bad credentials
prebuild ERR! build at createError (/Users/d037732/src/NG-APPS/node-rfc/node_modules/ghutils/ghutils.js:36:10)
prebuild ERR! build at responseHandler (/Users/d037732/src/NG-APPS/node-rfc/node_modules/ghutils/ghutils.js:26:23)
prebuild ERR! build at BufferList.request.pipe.bl [as _callback] (/Users/d037732/src/NG-APPS/node-rfc/node_modules/jsonist/jsonist.js:61:7)
prebuild ERR! build at BufferList.end (/Users/d037732/src/NG-APPS/node-rfc/node_modules/bl/bl.js:113:10)
prebuild ERR! build at DestroyableTransform.onend (/Users/d037732/src/NG-APPS/node-rfc/node_modules/readable-stream/lib/_stream_readable.js:523:10)
prebuild ERR! build at Object.onceWrapper (events.js:286:20)
prebuild ERR! build at DestroyableTransform.emit (events.js:203:15)
prebuild ERR! build at /Users/d037732/src/NG-APPS/node-rfc/node_modules/readable-stream/lib/_stream_readable.js:965:16
prebuild ERR! build at process._tickCallback (internal/process/next_tick.js:61:11)
Is my configuration wrong or something else?
The problem there is that the -u
in prebuild -r napi -u
is short for --upload
and thus overrides the rc value.
So prebuild -r napi
should work in this case, but you should be aware that upload=..
in rc currently has a side effect: prebuild
takes that as an upload command (i.e. even when you don't want to upload).
Would it make sense to have the token=xxx
in rc instead of upload=xxx
(as a new option eventually?), so than only token read from rc, without triggering uploads?
Yes, it would! It's been suggested before (#131 (comment)).
A PR is welcome. Not sure if we can do it without a breaking change.
As a new option (token=xxx), why not?
Right, as a new option would not be breaking 👍
I came into a situation that
with .prebuildrc has upload=<some-token>
And prebuild --upload-all
, I want to upload all, according to doc
Then rc.upload = token
& rc['upload-all'] = true
Then with this code
Lines 71 to 73 in edb81c4
token value is discard, and set to true.
Then cause
I think we should not mess commands & flags
What I thought
make upload / upload-all as sub commands would be great.
prebuild upload -t <token>
prebuild upload-all -t <token>