Loading tarball docker images as artifact fail since nomad v1.2.4.
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
v1.2.[4:6]
### Operating system
Ubuntu 20.04.3
### Issue
Downloading remote docker images as artifacts fail. In version 1.2.3 the artifacts are downloaded as expected.
### Job configuration snippet
``` hcl
task "docker-image" {
driver = "docker"
config {
load = "image.1.0.0.tar"
image = "image:1.0.0"
ports = ["http"]
}
artifact {
source = "https://private.gitlab.server/image.1.0.0.tar"
}
}
```
### Job log - result
```
Feb 14, '22 08:55:23 +0100 Killing Sent interrupt. Waiting 5s before force killing
Feb 14, '22 08:55:21 +0100 Alloc Unhealthy Unhealthy because of failed task
Feb 14, '22 08:55:21 +0100 Not Restarting Error was unrecoverable
Feb 14, '22 08:55:21 +0100 Driver Failure unable to open image archive: open /opt/nomad/alloc/2af7b4d2-4b33-4dc9-009b-6cd0cf8bf671/docker-image/local/image.1.0.0.tar: no such file or directory
Feb 14, '22 08:55:17 +0100 Downloading Artifacts Client is downloading artifacts
Feb 14, '22 08:55:17 +0100 Task Setup Building Task Directory
Feb 14, '22 08:55:17 +0100 Received Task received by client
```
### Job log - expected
```
Feb 14, '22 09:19:58 +0100 Started Task started by client
Feb 14, '22 09:19:39 +0100 Downloading Artifacts Client is downloading artifacts
Feb 14, '22 09:19:39 +0100 Task Setup Building Task Directory
Feb 14, '22 09:19:39 +0100 Received Task received by client
```
### Client alloc files - result
``` bash
nomad-client:/opt/nomad/alloc/2af7b4d2-4b33-4dc9-009b-6cd0cf8bf671/docker-image:/local# ls -al
total 40
drwxrwxrwx 6 nobody nogroup 4096 Feb 14 07:50 .
drwxrwxrwx 5 nobody nogroup 4096 Feb 14 07:50 ..
drwxr-xr-x 2 root root 4096 Jan 25 09:13 20adb492c08a397dae8cb889f1692fe39256cdef16789744d8d74fa15a041418
drwxr-xr-x 2 root root 4096 Jan 25 09:13 72bfcdfb530f97254df757c1f8e9b096d09de9c247db5be02350b5be0ff43d6b
drwxr-xr-x 2 root root 4096 Jan 25 09:13 b81885a820ba23b335f142fe94f4a46da835adc3ce5dd2ce82ef6e6ca6d822a2
drwxr-xr-x 2 root root 4096 Jan 25 09:13 ceebdfe94f3c9382ff8ee4fe597762acfcd2ebbb2251ce1375c9b2c70fdca0c8
-rw-r--r-- 1 root root 7193 Jan 25 09:13 f93704044d24675b570e9e80bfee7de0d25e7a80aef3ab62850d965ca2a210ee.json
-rw-r--r-- 1 root root 435 Feb 14 07:50 manifest.json
-rw-r--r-- 1 root root 91 Feb 14 07:50 repositories
```
### Client alloc files - expected
``` bash
nomad-client:/opt/nomad/alloc/d04c7985-a260-3fef-8ff9-3deb73f90578/docker-image/local# ls -al
total 81792
drwxrwxrwx 2 nobody nogroup 4096 Feb 14 07:42 .
drwxrwxrwx 5 nobody nogroup 4096 Feb 14 07:42 ..
-rw-r--r-- 1 root root 83745792 Feb 14 07:42 image.1.0.0.tar
```
### Fix
I was able to fix this by setting an artifact option so that `go-getter` (which is responible for downloading the artifact) does not auto unarchives. The option is also explained [here](https://www.nomadproject.io/docs/job-specification/artifact#download-and-unarchive).
I can't find this change of behavior in the [go-getter releases](https://github.com/hashicorp/go-getter/releases) though.
``` hcl
artifact {
source = "https://private.gitlab.server/image.1.0.0.tar"
options {
archive = false
}
}
```
I hope this may help people having the same issues.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with Nomad's artifact configuration and the go-getter download and unarchive behavior described in the issue. Reproduce the Docker task using the provided HCL and compare behavior with and without archive = false. Done means remote tarball artifacts are handled consistently with the documented artifact option and the regression is covered or clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100