Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

artifact {} with custom destination does not work as advertised #2092

Closed
jippi opened this issue Dec 13, 2016 · 12 comments
Closed

artifact {} with custom destination does not work as advertised #2092

jippi opened this issue Dec 13, 2016 · 12 comments

Comments

@jippi
Copy link
Contributor

jippi commented Dec 13, 2016

Nomad version

0.5.1-rc1

Operating system and Environment details

Linux Debian 7.9

Issue

Based on the docs

artifact {
  source      = "https://example.com/file.txt"
  destination = "/tmp/example.txt"
}

should create /tmp/example.txt, though adjusting it to my own paths like below, this is not the case

artifact {
	source      = "https://xxxx/template/{{PROJECT_NAME}}/{{APP_ENV}}/{{APP_VERSION}}/consul-template/php-fpm.ctmpl"
	destination = "/local/php-fpm.conf"
}

It actually created /server/local/php-fpm.conf/php-fpm.ctmpl instead. Thus using the destination as a directory (ignoring the file part) and putting the file inside the destination directory as-named on the source url

@dadgar
Copy link
Contributor

dadgar commented Dec 13, 2016

Hey destination is relative to the allocation directory. It is not absolute. Please see the documentation: https://www.nomadproject.io/docs/job-specification/artifact.html#destination

Agree that it should do a rename rather than a join.

@dadgar dadgar added this to the v0.5.1 milestone Dec 13, 2016
@jippi
Copy link
Contributor Author

jippi commented Dec 13, 2016

@dadgar know it's "relative" :) the only problem is the destination is really just the directory, so end result is ${destination}/${basename source} which is very surprising :P

@dadgar
Copy link
Contributor

dadgar commented Jan 9, 2017

@jippi This isn't really possible with the API of go-getter. It assumes destination is a folder, just dug into the API. The only way to do this is to introduce a new option in the artifact block file = true which would treat it as a file and download it to that file name. Is that desirable? If file = true and you download not a file it would error.

@dadgar
Copy link
Contributor

dadgar commented Jan 9, 2017

Talked in Gitter, but following up. Added better documentation in this commit: 30655ef

I want to avoid a special flag and until a very compelling case comes up, the docs should suffice.

@dadgar dadgar closed this as completed Jan 9, 2017
@jippi
Copy link
Contributor Author

jippi commented Jan 10, 2017

@dadgar seems legit to me ! thank you

@shantanugadgil
Copy link
Contributor

shantanugadgil commented Jul 12, 2017

@dadgar @jippi

I stumbled upon this same issue today.

In my opinion, not able to specify the file name, enforces an artificial constraint on the user.

I had imagined that I would be able to keep various config files together in my S3 bucket, and based on some option, be able to pick any one from the S3 bucket and save it with a common name in the destination.
This was so that my docker could then assume a fixed named for the config file.

Being able to name the destination file seemed obvious to me. Hope this gets implemented.

  • Having an extra "file" parameter doesn't seem elegant though.

Regards,
Shantanu

@jippi
Copy link
Contributor Author

jippi commented Jul 12, 2017

Pretty sure this is fixed in next release as go-getter now support file mode :)

@shantanugadgil
Copy link
Contributor

FWIW, I am using version Nomad v0.6.0-rc1 (5187fcfcae50e3dee61e5340eb99805a564b55c3+CHANGES)

Could you point me to the place where go-getter mentions how to set target as a file ?
I couldn't find any open/closed issue in the go-getter issues section about this. 😢
https://github.com/hashicorp/go-getter/issues

Regards,
Shantanu

@jippi
Copy link
Contributor Author

jippi commented Jul 13, 2017

I think #2781 is what you are looking for

@jippi
Copy link
Contributor Author

jippi commented Jul 13, 2017

@shantanugadgil
Copy link
Contributor

@jippi Thanks, Got it!
mode = "file"

👍

Regards,
Shantanu

@tgross tgross modified the milestones: near-term, unscheduled Jan 9, 2020
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants