cnabio / duffle

CNAB installer
https://duffle.sh
MIT License
375 stars 54 forks source link

Install: how to distinguish result reporting from progress reporting #394

Open itowlson opened 6 years ago

itowlson commented 6 years ago

A duffle install might produce some information that was generated during installtion that the user needs to know - for example, a credential, a DNS name or an IP address. We provide no structured way to access this information: the invocation image can dump text, which is piped to the console, but there is no structure to help tools distinguish this useful information from the Executing install action... pulling invocation image... Digest... Status... progress indicators.

In the self-installer, I would like to display any values or other instructional/advisory text from the run script in a post-install screen; the progress messages I want to discard or show only on the installation progress bar. How can I do this?

technosophos commented 6 years ago

Would it work to just have a line start convention that one could regexp over the result data? For example, lines that contain progress reports start #=>:

#=> Executing install action
#=> Pulling invocation image
some random line of log text
some other line
#=> Installation complete

(We could go with a more structured message body, like JSON, if we wanted)

I'm trying to think of a method that would also make it super simple for CNAB authors to inject their own info into the log, so they could do things like:

echo "#=> Downloading Ansible plug ins"
echo "#=> Running playbooks"
itowlson commented 6 years ago

I think that would work and be reasonably simple for authors. I was trying to avoid a JSON or similar structure because that is harder for human readers (though this could be worked around with a --format flag) and probably quite tricky for bundle authors. A convention-based approach seems like a good thing to explore at first.

Should this be part of the standard? It would be good to be able to describe this in a way that tools could rely on it, but it's also very much 'judgment call' on the author's part.