jobspec: allow artifact headers in HCLv1 (#14637)
* jobspec: allow artifact headers in HCLv1 Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
This commit is contained in:
parent
5df5e70542
commit
7da3fd050b
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
jobspec: Fixed a bug where an `artifact` with `headers` configuration would fail to parse when using HCLv1
|
||||||
|
```
|
|
@ -370,6 +370,7 @@ func parseArtifacts(result *[]*api.TaskArtifact, list *ast.ObjectList) error {
|
||||||
valid := []string{
|
valid := []string{
|
||||||
"source",
|
"source",
|
||||||
"options",
|
"options",
|
||||||
|
"headers",
|
||||||
"mode",
|
"mode",
|
||||||
"destination",
|
"destination",
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,6 +628,13 @@ func TestParse(t *testing.T) {
|
||||||
GetterOptions: nil,
|
GetterOptions: nil,
|
||||||
RelativeDest: stringToPtr("var/foo"),
|
RelativeDest: stringToPtr("var/foo"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
GetterSource: stringToPtr("https://example.com/file.txt"),
|
||||||
|
GetterHeaders: map[string]string{
|
||||||
|
"User-Agent": "nomad",
|
||||||
|
"X-Nomad-Alloc": "alloc",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,6 +20,15 @@ job "binstore-storagelocker" {
|
||||||
source = "http://foo.com/bam"
|
source = "http://foo.com/bam"
|
||||||
destination = "var/foo"
|
destination = "var/foo"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
artifact {
|
||||||
|
source = "https://example.com/file.txt"
|
||||||
|
|
||||||
|
headers {
|
||||||
|
User-Agent = "nomad"
|
||||||
|
X-Nomad-Alloc = "alloc"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue