Nomad artifact stanza

Hello,

I wonder if it’s possible to download in artifact stanza binary from windows shared drive on Nomad windows client.

artifact {
    source      = "\\path\to\binary"

}

When I try to use it I have an error:
failed to download artifact “path” relative paths require a module with pwd

Thanks in advance for help

Hi,

Artefacts uses go-getter library GitHub - hashicorp/go-getter: Package for downloading things from a string URL using a variety of protocols.

Have you tried?

artifact {
    source = "file::\\path\to\binary"
}

I tried and now I have this error:

"failed to download artifact “file::\path\to\binary” download not supported for scheme ‘file’

Nomad version - v1.0.4

Hi @AlxZakrzewski :wave:

As @resmo mentioned, Nomad uses go-getter to fetch artifacts, but we disable the file getter for a few reasons:

  1. to prevent task from being able to fetch arbitrary files from the system for security reasons.
  2. Nomad can’t tell if the file exists in the client, and the allocation will fail if scheduled in the wrong client.

To access files from the client you will need a host volume.

Thanks for the explanation

Is possible to use host volume without root privileges though?

I managed to setup node.js http server as a workaround but like to know if there is better way.

Hum…good question. In general we recommend running the Nomad client agents as root, but I think that, if the agent user has access to the entire path of the host volume, it it would work :thinking:

Let me know how it goes if you give it try.

Yes, it works :slight_smile:

  1. Create directory
  2. Add config
    And that’s all.
1 Like