cml icon indicating copy to clipboard operation
cml copied to clipboard

Allow `-cloud-startup-script` to specify a file

Open tadejsv opened this issue 3 years ago • 4 comments

Currently, only a base64 encoded string can be passed to -cloud-startup-script.

It would be more convenient if a path to a file (script) could be specified

tadejsv avatar Sep 14 '22 12:09 tadejsv

You can always use cml runner --cloud-startup-script="$(base64 --wrap=0 /path/to/file)"

0x2b3bfa0 avatar Sep 14 '22 14:09 0x2b3bfa0

I can, but I don't want to :)

tadejsv avatar Sep 14 '22 14:09 tadejsv

If useful, this would [hypothetically] be implemented by introducing a separate --cloud-startup-script-file option taking the path to a file, but https://github.com/iterative/cml/pull/1063#discussion_r899358857 hints you'll probably have to use command substitution as proposed in https://github.com/iterative/cml/issues/1167#issuecomment-1246865434. 😅

Note also that requiring Base64 encoding for the value of that option is inexcusable, but that's a separate discussion.^1

0x2b3bfa0 avatar Sep 14 '22 15:09 0x2b3bfa0

Well, what led me to write this FR is that at first I missed the -w 0 option[^1] for base64, and wasted ~15 minutes of my time on this - this wouldn't have happened had there been an option to input a script. In general, all these "just cat the contents` parameters are a potential minefield of improper quoting, escaping etc.

As a developer, I understand the urge to keep the number of different options low, but as a user I much prefer the convenience and not having to google things that are not really central to the task I am doing.

[^1]: I know it's in the documentation - but unfortunately I did not read that part of the documentation at the time.

tadejsv avatar Sep 14 '22 15:09 tadejsv