formica icon indicating copy to clipboard operation
formica copied to clipboard

Proposal: `--detailed-exitcode` option

Open ryansb opened this issue 7 years ago • 2 comments

For scripting use cases where I've got a CI system that I want to raise a status for different changeset states.

Example:

formica change -c dev-env.config.yml
STATE=$(aws cloudformation describe-change-set --stack-name ${STACK} --change-set-name ${STACK}-change-set --query ExecutionStatus --output=text)
if [[ $STATE == "AVAILABLE" ]] ; then formica deploy -c dev-env.config.yml ; fi

Really what I want is a structured output that I can jp or jq into telling me: how many resources have changed, whether the changeset has any changes, and the state of the changeset. The awscli command above only does the latter, and I don't want to blindly formica deploy and have it fail if there are no changes in the changeset.

ryansb avatar Dec 18 '17 19:12 ryansb

Hmm so I assume the use case is you have template files in a repo with app code, you want to first go through deploying the templates and once those pass deploy the app code. If there are no changes in the template though you want to go through change and deploy successfully so the app deployment steps can run successfully.

To solve this we could simply add an argument to change that makes it succeed if there are no changes in the changeset. Then in deploy another argument that ignores unavailable change sets but doesn't fail.

Or is there are more comprehensive use case for this? I don't want to add any machine readable output, the awscli does that already (also gives you the List of Changes).

flomotlik avatar Jan 04 '18 13:01 flomotlik

But I definitely want something like this in, otherwise its not usable for the use case I described in CI, which is bad.

flomotlik avatar Jan 04 '18 13:01 flomotlik