I use dpl to deploy heroku at gitlab. But I get the error is invalid option "--api-key="
I reference this page.
https://docs.gitlab.com/ce/ci/examples/deployment/README.html#storing-api-keys
I am not sure this is gitlab or dpl's issue. I use dpl version 1.8.47
Here is the deploy command
dpl --provider=heroku --app=blog-server-dev --api-key=$HEROKU_STAGING_API_KEY --strategy=git
Sorry, but I don鈥檛 know how Gitlab uses dpl. If dpl is complaining about bad options, then Gitlab is most likely to know why. Please ask them for support.
@BanzaiMan So the option is available for heroku?
I will try to ask them, thx.
I have been using dpl to deploy for the last 6 months, and I have not changed my CI code, but all of a sudden, I was getting it. I realized that the problem is that I recently changed the API Key, and used the wrong API Key. The error says Invalid Option, but I think should have been Invalid Key for option --api-key=.
@davydany The error message is correct. If there is no API key, then the option itself is wrong. Only when the API key is given but invalid, should the error message be "invalid key", but there is no way for dpl to know that the API key is invalid before accepting the option and making the API call required.
Try to define variables in Gitlab.
really helpful @BanzaiMan , thanks...
But I agree with @davydany that the error could be clearer... I got myself trying to understand what is the right key... dpl doesnt help because there aren't any kind of --help option
Just in case anyone will come here from goolge, the issue may be with the "protected" branches option. If your API key variable is protected but branch is not, it won't see the API key and will fail with this arcane error.
I've stumbled this when unprotected branch for the reason (to force push) and forgot to protect it again after.
This is because your Heroku api key variable is set as protected. Just remove the protected option from it.
Most helpful comment
Just in case anyone will come here from goolge, the issue may be with the "protected" branches option. If your API key variable is protected but branch is not, it won't see the API key and will fail with this arcane error.
I've stumbled this when unprotected branch for the reason (to force push) and forgot to protect it again after.