hashicorp / hashicorp/nomad

Display task events on console while job run

Open
#18,271 1 comment 0 reactions 0 assignees View on GitHub
stage/accepted theme/cli type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version
```
$ nomad --version
Nomad v1.6.1
BuildDate 2023-07-21T13:49:42Z
Revision 515895c7690cdc72278018dc5dc58aca41204ccc
```

### Operating system and Environment details

```
$ uname -a
Darwin Eugens-MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64 i386 Darwin
```

### Issue

![image](https://github.com/hashicorp/nomad/assets/139780495/fc071293-6a4e-4c1e-990d-ab54258f5ead)

### Reproduction steps
configure task with wrong auth section like this:
```
...
task "redis" {
driver = "docker"

config {
# image = "/:"
image = "redis:7.2"
ports = ["db"]

auth {
server_address = ""
username = "dockerhub_user"
password = "dockerhub_password"
}
}

```

#### Expected Result
It would be nice to see errors in console similar to UI

#### Actual Result
It is not clear what was happened:
```
$ nomad job run -check-index 0 wi-redis.nomad.hcl
==> 2023-08-21T15:39:03-04:00: Monitoring evaluation "408d706e"
2023-08-21T15:39:03-04:00: Evaluation triggered by job "nomad-redis"
2023-08-21T15:39:03-04:00: Evaluation within deployment: "5d9c5a5c"
2023-08-21T15:39:03-04:00: Allocation "7d3598d6" created: node "4a37d9e8", group "cache"
2023-08-21T15:39:03-04:00: Evaluation status changed: "pending" -> "complete"
==> 2023-08-21T15:39:03-04:00: Evaluation "408d706e" finished with status "complete"
==> 2023-08-21T15:39:03-04:00: Monitoring deployment "5d9c5a5c"
⠦ Deployment "5d9c5a5c" failed

2023-08-21T15:44:03-04:00
ID = 5d9c5a5c
Job ID = nomad-redis
Job Version = 0
Status = failed
Description = Failed due to progress deadline - no stable job version to auto revert to

Deployed
Task Group Auto Revert Desired Placed Healthy Unhealthy Progress Deadline
cache true 1 3 0 3 2023-08-21T19:44:03Z
```

### Job file (if appropriate)

```
job "nomad-redis" {
datacenters = ["dc1"]
type = "service"

group "cache" {
count = 1

network {
# mode = "host"
port "db" {
to = 6379
}
}

update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "2m"
progress_deadline = "5m"
auto_revert = true
auto_promote = true
canary = 1
}

task "redis" {
driver = "docker"

# https://developer.hashicorp.com/nomad/docs/drivers/docker
config {
# image = "/:"
image = "redis:7.2"
ports = ["db"]
# network_mode = "host"

# https://developer.hashicorp.com/nomad/docs/drivers/docker#authentication
# https://developer.hashicorp.com/nomad/docs/drivers/docker#client-requirements
auth {
server_address = ""
username = "dockerhub_user"
password = "dockerhub_password"
}
}

service {
tags = ["redis-service"]
name = "redis"
port = "db"

provider = "consul"
# connect = ??

#name (string: "--")

meta {
meta = "Some meta for my service"
}

check {
name = "host-redis-check"
type = "tcp"
port = "db"
interval = "10s"
timeout = "2s"
}

check {
name = "app_health"
type = "http"
path = "/health"
interval = "20s"
timeout = "5s"

check_restart {
limit = 3
grace = "90s"
ignore_warnings = false
}
}
}
}
}
}
```

### Logs
See screenshot above

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the shown `nomad job run -check-index 0 wi-redis.nomad.hcl` command and compare the console output with the UI events. The issue names no source files or tests; done means relevant task events and errors are displayed during the job run.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.