Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nomad 0.9.3 update stanza "auto_promote" property #68

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ require (
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-version v1.1.0
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f
github.com/hashicorp/nomad v0.9.1
github.com/hashicorp/nomad/api v0.0.0-20190506160519-84306b0bfbed
github.com/hashicorp/nomad v0.9.3
github.com/hashicorp/nomad/api v0.0.0-20190723171653-9aa271409411
github.com/hashicorp/terraform v0.12.0-rc1
github.com/hashicorp/vault v0.10.4
github.com/hashicorp/yamux v0.0.0-20180917205041-7221087c3d28 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ github.com/gophercloud/utils v0.0.0-20190128072930-fbb6ab446f01/go.mod h1:wjDF8z
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 h1:f0n1xnMSmBLzVfsMMvriDyA75NB/oBgILX2GcHXIQzY=
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
Expand All @@ -117,6 +118,7 @@ github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/U
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.0.0-20190129193224-166dfd221bb2/go.mod h1:lu62V//auUow6k0IykxLK2DCNW8qTmpm8KqhYVWattA=
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
Expand Down Expand Up @@ -159,8 +161,12 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE=
github.com/hashicorp/nomad v0.9.1 h1:oOUlPrl7nlT6DJEfYplggXK8p+diugEBzUFai9/EoHU=
github.com/hashicorp/nomad v0.9.1/go.mod h1:WRaKjdO1G2iqi86TvTjIYtKTyxg4pl7NLr9InxtWaI0=
github.com/hashicorp/nomad v0.9.3 h1:mWczfImY8S+xASCwQvhtjIsj/RXKyc597XK8QhORAcc=
github.com/hashicorp/nomad v0.9.3/go.mod h1:WRaKjdO1G2iqi86TvTjIYtKTyxg4pl7NLr9InxtWaI0=
github.com/hashicorp/nomad/api v0.0.0-20190506160519-84306b0bfbed h1:B3ebedlbNLAOwY+5acWtcaipCS+tTguSksavplKNhnE=
github.com/hashicorp/nomad/api v0.0.0-20190506160519-84306b0bfbed/go.mod h1:BDngVi1f4UA6aJq9WYTgxhfWSE1+42xshvstLU2fRGk=
github.com/hashicorp/nomad/api v0.0.0-20190723171653-9aa271409411 h1:Nzh3n21ajvf3/6JrF6kSGfMTZeF+XB4zxTadcDON9z4=
github.com/hashicorp/nomad/api v0.0.0-20190723171653-9aa271409411/go.mod h1:BDngVi1f4UA6aJq9WYTgxhfWSE1+42xshvstLU2fRGk=
github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE=
github.com/hashicorp/terraform v0.12.0-rc1 h1:sTOrvFeoklMBsEHNhu25APyMyATTOeUUiuXm+PpLjDg=
github.com/hashicorp/terraform v0.12.0-rc1/go.mod h1:mLbSyFcATc332aCwDeX9cziNg/dUb6ZJzRVd1KgrDOk=
Expand Down
4 changes: 4 additions & 0 deletions nomad/datasource_nomad_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ func dataSourceJob() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"auto_promote": {
Type: schema.TypeBool,
Computed: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a test to datasource_nomad_job_test.go to test this is working; i don't believe that it is.

"canary": {
Type: schema.TypeInt,
Computed: true,
Expand Down
1 change: 1 addition & 0 deletions nomad/jobspec/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,7 @@ func parseUpdate(result **api.UpdateStrategy, list *ast.ObjectList) error {
"healthy_deadline",
"progress_deadline",
"auto_revert",
"auto_promote",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the api.UpdateStrategy object that this attempting to parse into doesn't have an AutoPromote field, because the dependency version for the Nomad API needs to be updated.

"canary",
}
if err := helper.CheckHCLKeys(o.Val, valid); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions nomad/resource_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ resource "nomad_job" "test" {
healthy_deadline = "6m"
progress_deadline = "11m"
auto_revert = true
auto_promote = true
canary = 1
}

Expand Down Expand Up @@ -885,6 +886,7 @@ resource "nomad_job" "test" {
healthy_deadline = "6m"
progress_deadline = "11m"
auto_revert = true
auto_promote = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test was looking at new config for the 0.9.0 API... auto_promote should be part of a separate test for 0.9.3. such a test should verify that this option is successfully being submitted to Nomad.

canary = 1
}

Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ github.com/hashicorp/hil/parser
github.com/hashicorp/hil/scanner
# github.com/hashicorp/logutils v1.0.0
github.com/hashicorp/logutils
# github.com/hashicorp/nomad v0.9.1
# github.com/hashicorp/nomad v0.9.3
github.com/hashicorp/nomad/helper
# github.com/hashicorp/nomad/api v0.0.0-20190506160519-84306b0bfbed
github.com/hashicorp/nomad/api
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/job.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The following attributes are exported:
* `task_groups`: `(list of maps)` A list of of the job's task groups.
* `placed_canaries`: `(string)`
* `auto_revert`: `(boolean)`
* `auto_promote`: `(boolean)`
* `promoted`: `(boolean)`
* `desired_canaries`: `(integer)`
* `desired_total`: `(integer)`
Expand Down