[go: nahoru, domu]

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

Importing from URLs #9

Closed
sparkprime opened this issue Aug 10, 2014 · 9 comments
Closed

Importing from URLs #9

sparkprime opened this issue Aug 10, 2014 · 9 comments

Comments

@sparkprime
Copy link
Contributor

It may be useful to import from a URL, or otherwise contact an external service. The current semantics would be a special case of this, i.e. file://path.

It is not clear whether the request should be parameterizable.

Either way, Jsonnet will still cache the result of fetching the URL to enforce referential transparency.

@jessechahal
Copy link

Can we get an update on this enhancement? Is it something that will ever be worked on? This is issue #9 from 2014....

@sparkprime
Copy link
Contributor Author

I don't think so. There is some objection to the idea because although in principle it's no more non-hermetic than regular file I/O and indeed you can use UNIX sockets or whatever to connect to curl and achieve the same thing, nevertheless it makes the config depend on having an internet connection, and URLs don't feel as static as files on disk.

The people who have needed this have implemented it using import callbacks or native callbacks, which works quite well. If you use native callbacks you have to do the cacheing yourself.

@sparkprime
Copy link
Contributor Author

Feel free to keep asking though, if enough people want it, it would tip the balance.

@sbarzowski
Copy link
Collaborator
sbarzowski commented Oct 30, 2017

(digression)

The people who have needed this have implemented it using import callbacks or native callbacks, which works quite well. If you use native callbacks you have to do the cacheing yourself.

Is there any reason why native callbacks could be preferred over import callbacks for that? I thought that native callbacks are supposed to be for pure functions only.

BTW probably the most mature discussion of jsonnet package management at the moment is ksonnet stuff here:
https://docs.google.com/document/d/1CQ3cQMH0WgoOpnVl_qFWhqMybE0IJIpkbJOu1xH6HFE

@sparkprime
Copy link
Contributor Author

No, I think they used native callbacks because they didn't realize they could use import callbacks (although I may be mis-remembering this anyway).

@mkmik
Copy link
Contributor
mkmik commented Nov 7, 2019

What if we force the import string to include a checksum e.g. "https+sum://foo.com/bar#sha256:123456789abcdef..."

It would still suffer from:

nevertheless it makes the config depend on having an internet connection

But it would be hermetic.

Furthermore, a "file+sum:/...." URL would allow you to be stricter for local on-disk imports too.

@sparkprime
Copy link
Contributor Author

I have a feeling that Nix might do that.

Why not just vendor it into your repo though, using jsonnet-bundler to manage that if you want.

@mkmik
Copy link
Contributor
mkmik commented Nov 22, 2019

With explicit hermetic imports, you always get the same thing, regardless of possible diamond dependencies

@underrun
Copy link
underrun commented Dec 9, 2020

i'd like this feature

my use case is to import some external non-jsonnet json data in a secure way

the json data is not available at packaging time but will be available in a containerized environment at runtime (the name of the resource is well known and versioned)

python and shell are not to be included in the container image - ideally as few tools as possible

sbarzowski pushed a commit to sbarzowski/jsonnet that referenced this issue Jun 10, 2024
First end-to-end test (add numbers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants