hashicorp / hashicorp/nomad-pack
Get the created deployment ids and other metadata back as json
- Dominant language
- Go
- Stars
- 447
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
## What
It would be great to be able to:
- specify `-json` as a flag to define the output format of the `nomad-pack run` command
- get a `deployment_id` (and any other metadata) on a per-job basis in the response (both in plain text as well as json output)
## Why
I am currently running nomad-pack as part of a CI pipeline (Github Actions). We deploy a number of jobs in CI and want to ensure they get deployed to completion. The output of `nomad deployment list` has to be parsed to _guess_ the associated deployment id, making it tougher to check if the deployment is complete. Here is the jq call I had to invoke:
```shell
nomad deployment list -json | jq -r --arg job_id "$NOMAD_JOB_ID" 'last(. | sort_by(.JobVersion) | .[] | select(.JobID == $job_id)) | .ID')
```
Not great, but working.
That said, this fails if the `nomad-pack run` call _does not_ create a deployment for a given job (because no config changed). In those cases, its useful to know which jobs did not result in a deployment so we can either avoid tracking it or something trigger a restart instead.
Contributor guide
Research direction
Start with the nomad-pack run command and trace how per-job results are collected and formatted. Add the -json output mode and ensure both plain text and JSON identify each job's deployment_id, including jobs that did not create a deployment; verify the output supports the CI workflow described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100