open-nomad/contributing/checklist-jobspec.md
Seth Hoenig 8209eb4d80 doc: add a reminder about field order for diff comparisons
After spending hours re-learning this lesson more than once,
update the jobspec contribution guide with a reminder about
how to configure FieldDiff comparisons.
2020-03-25 09:33:27 -06:00

1.4 KiB

New jobspec Entry Checklist

Code

  • Consider similar features in Consul, Kubernetes, and other tools. Is there prior art we should match? Terminology, structure, etc?
  • Parse in jobspec/parse.go
  • Test in jobspec/parse_test.go (preferably with a jobspec/text-fixtures/<feature>.hcl test file)
  • Add structs/fields to api/ package
    • structs usually have Canonicalize, Copy, and Merge methods
    • New fields should be added to existing Canonicalize, Copy, and Merge methods
    • Test the struct/field via all methods mentioned above
  • Add structs/fields to nomad/structs package
    • Validation happens in this package and must be implemented
    • Implement other methods and tests from api/ package
  • Add conversion between api/ and nomad/structs in command/agent/job_endpoint.go
  • Add check for job diff in nomad/structs/diff.go
    • Note that fields must be listed in alphabetical order in FieldDiff slices in nomad/structs/diff_test.go
  • Test conversion

Docs