Currently, we have multiple jobs with quite large task scripts in bash (up to 500 lines) written directly into task/template/data
as heredoc. These scripts can have multiple bash functions embedded and use many interpolated variables passed in from the nomad job. I’ve read the doc and know that we could use either artifacts
or source
instead of data
to ship these scripts. However, using artifacts
(pulling from s3 or some other places) means we can’t have the script in the same git repo as our nomad job, which can be a pain to synchronize with every change in interpolated variables. As far as I can see, using source
it’s possible to keep everything in one repo. I could use a consul template to ship it, which comes back to either heredoc or artifacts.
I found this related issue:
from that thread, it looks like I could use file
function to load an external file in the same repo. This looks to be my best bet. I’d like to know what you guys think about this.