Nomad job error only visible in Nomad server logs
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
Output from `nomad version`
```Nomad v1.1.3 (8c0c8140997329136971e66e4c2337dfcf932692)```
### Operating system and Environment details
```Any```
### Issue
Jobs can be submitted/planned without error whereas server logs contain error (see below)
### Reproduction steps
Use the [following repo](https://github.com/WhatsARanjit/nomad-odd_number_batch_job)
and plan or submit the `jobs/collector.nomad` modified from
```
job "collector" {
datacenters = ["dc1"]
type = "service"
group "api" {
count = 1
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
task "collector_api" {
driver = "docker"
constraint {
attribute = "${attr.kernel.name}"
operator = "!="
value = "windows"
}
config {
image = "whatsaranjit/collector:0.1.0"
port_map {
http = 4567
}
}
resources {
network {
mbits = 10
port "http" {
static = 4567
}
}
}
service {
name = "collector"
tags = ["demo"]
port = "http"
check {
name = "alive"
type = "tcp"
interval = "1m"
timeout = "2s"
}
}
}
}
}
```
to
```
job "collector" {
datacenters = ["dc1"]
type = "service"
group "api" {
count = 1
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
network {
port "http" {
static = 4567
}
}
task "collector_api" {
driver = "docker"
constraint {
attribute = "${attr.kernel.name}"
operator = "!="
value = "windows"
}
config {
image = "whatsaranjit/collector:0.1.0"
port_map {
http = 4567
}
}
service {
name = "collector"
tags = ["demo"]
port = "http"
check {
name = "alive"
type = "tcp"
interval = "1m"
timeout = "2s"
}
}
}
}
}
```
(aka deprecated `resources/network` block)
#### Expected Result
```
'port_map' cannot map group network ports, use 'ports' instead
```
#### Actual Result
Nothing is printed in CLI output, neither from plan or run command and error is only visible in server logs
### Job file (if appropriate)
See above
### Nomad Server logs (if appropriate)
### Nomad Client logs (if appropriate)
### See also
[Issue #9710: Deprecated Docker port_map syntax](https://github.com/hashicorp/nomad/issues/9710)
[This line in the driver code](https://github.com/hashicorp/nomad/blob/main/drivers/docker/driver.go#L1108)
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the behavior with jobs/collector.nomad from the linked repository, comparing the deprecated resources/network form with the group network form. Start at drivers/docker/driver.go around line 1108 and review issue #9710; done means the expected port-mapping error is returned in plan or run CLI output instead of only appearing in server logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100