You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chaining publish and unpublish commands changes their default behavior in relation to staging/production hosts.
Expected Behavior
Commands publish and unpublish should always default to staging when production_host and staging_host are defined under binary in package.json.
Actual Behavior
When the commands publish and unpublish are executed by themselves they default to staging. However, if the command being executed is chained after another command (for example package publish or info unpublish) then the default reverts to binary.production_host. As a result - accidental publishing/unpublishing is possible.
Steps to Reproduce
1) Prep package.json
Replace "host" with staging_host and production_host in package.json
[node-pre-gyp-test-app1] published to https://apm-appoptics-bindings-node-dev-staging.s3.us-east-1.amazonaws.com/node-pre-gyp/node-pre-gyp-test-app1/v0.1.0/Release/
[node-pre-gyp-test-app1] published to https://apm-appoptics-bindings-node-dev-production.s3.us-east-1.amazonaws.com/node-pre-gyp/node-pre-gyp-test-app1/v0.1.0/Release/
When chained commands are executed, the first command in the chain will raise the binaryHostSet flag. Subsequent publish or unpublishwill trigger the early return. Due to the early return, the host will not be configured correctly resulting in the bug described above.
The text was updated successfully, but these errors were encountered:
Describe the bug
Chaining
publish
andunpublish
commands changes their default behavior in relation to staging/production hosts.Expected Behavior
Commands
publish
andunpublish
should always default to staging whenproduction_host
andstaging_host
are defined underbinary
in package.json.Actual Behavior
When the commands
publish
andunpublish
are executed by themselves they default to staging. However, if the command being executed is chained after another command (for examplepackage publish
orinfo unpublish
) then the default reverts tobinary.production_host
. As a result - accidental publishing/unpublishing is possible.Steps to Reproduce
1) Prep package.json
Replace "host" with
staging_host
andproduction_host
in package.jsonExample:
2) Run Commands one after the other
node-pre-gyp package
node-pre-gyp publish
Results in: ✅
node-pre-gyp info
node-pre-gyp unpublish
Results in: ✅
3) Run Chained Commands
node-pre-gyp package publish
Results in: ❌
node-pre-gyp info unpublish
Results in: ❌
Root Cause
When chained commands are executed, the first command in the chain will raise the
binaryHostSet
flag. Subsequentpublish
orunpublish
will trigger the early return. Due to the early return, the host will not be configured correctly resulting in the bug described above.The text was updated successfully, but these errors were encountered: