levant icon indicating copy to clipboard operation
levant copied to clipboard

Feature request: pass pre-rendered jobspec to levant for deployment.

Open jwinters-tc opened this issue 2 years ago • 2 comments

Description

I want to use levant's deployment watcher in our CI/CD pipelines but it would require us to redo all of our HCL2 job files as levant templates, which for the moment seems like a step backwards, since HCL2 seems to be the future.

Rather than re-inventing the wheel to come up with a deployment watcher, can levant's deploy command accept pre-rendered JSON produced by nomad itself I.E. nomad job run -output

It would be especially useful to be able to pipe such JSON output directly to levant deploy. I.E. nomad job run -output -var-file=vars.hcl job.hcl | levant deploy -pre-rendered

Basically, decouple levant templating from levant deployments.

Related: https://github.com/hashicorp/levant/issues/400

jwinters-tc avatar Apr 19 '22 01:04 jwinters-tc

Hi @jwinters-tc, the nomad job run command now includes a deployment watch which will follow and report on the deploy resulting from a job register. I wonder if this functionality meets the criteria you need? If not, I feel it would be worth enhancing the core binary to meet expectations.

jrasell avatar Jun 09 '22 08:06 jrasell

Hi @jrasell thanks for the reply. Yes I've seen that functionality and maybe it could be iterated on instead; it seems not quite as intuitive as levant's deployment watcher. Nomad will return a success code if the deployment fails and auto-reverts, and the output isn't always very clear. Levant's output is more concise, and more importantly it returns a failure code in the case of an auto-revert, which makes more sense in the pipeline.

Anyway I'm not sure of the future of levant, HCL2, nomad pack, etc... In the meantime I've implemented this idea and it's working alright for us. https://github.com/hashicorp/levant/pull/445

jwinters-tc avatar Jun 20 '22 20:06 jwinters-tc