I just realised something when running `pact-broke...
# pact-broker
j
I just realised something when running
pact-broker can-i-deploy
- I was (incorrectly) specifying the flag
--environment staging
instead of (the correct)
--to-environment staging
and getting the warning:
Copy code
WARN: It is recommended to specify the environment into which you are deploying. Without the environment, this result will not be reliable.
Turns out pact-broker CLI does not validate unknown arguments. It will happily run with anything and ignore it 😄
Copy code
pact-broker can-i-deploy --to--disneyworld yes --and-disneyland maybe ...
Is it worth throwing an error in those cases?
y
I’d prefer it error, rather than assuming in your instance despite the warning did you get a pass resulting in an exit code 0 reason being is that if it doesn’t fail, you often aren’t going to dig into the logs for further detail and this could definitely catch people out they move from can-i-deploy to record-deployment where the arg is just environment i’d argue that although to-environment could just be replaced with environment ( or at least aliased to ) we used to can i deploy with tags and you wouldn’t say can i deploy to-tag sorry poor formatting as on the mobile
j
Also a bit confusing that
pact-broker record-deployment
takes
--environment
while
can-i-deploy
takes
--to-environment
. But the main concern I think is silently ignoring invalid arguments. They should hard fail. Maybe difficult to do now since it is used in the wild, you would probably have to deprecate that behaviour and log warnings for the next few minor releases, and then start failling in the next major release.
b
@Jonatan Bjork the option is called
--to-environment
because before we had support for environments, we used tags, and the syntax was
--to TAG
👍 1
Also, PR for raising errors on unknown options https://github.com/pact-foundation/pact_broker-client/pull/147