Commit graph

9903 commits

Author SHA1 Message Date
Eelco Dolstra
b63f79175e
<nix/fetchurl.nix>: Remove unnecessary assertion 2017-02-16 14:06:47 +01:00
Eelco Dolstra
40f0e3b366
Include "curl" in the User-Agent header
Some sites (e.g. BitBucket) give a helpful 401 error when trying to
download a private archive if the User-Agent contains "curl", but give
a redirect to a login page otherwise (so for instance
"nix-prefetch-url" will succeed but produce useless output).
2017-02-16 13:55:43 +01:00
Eelco Dolstra
d1139ff36b Merge pull request #1215 from k0001/netrc-1
Add netrc-file support
2017-02-16 12:45:44 +01:00
Vincent Ambo
0147c3e13e feat ctx: Let sub-resource-sets inherit vars from parent
Users of kontemplate may expect variables defined on the parent resource to be
inherited by children.

This implements that functionality. Values defined twice are overwritten by the
child's definition.

Fixes #20
2017-02-14 19:12:53 +01:00
Vincent Ambo
f81fe551bc chore templater: Use new util.Merge func 2017-02-14 19:12:53 +01:00
Vincent Ambo
7a930aad11 feat util: Add silly map-merge function that should be in the stdlib 2017-02-14 19:12:53 +01:00
Eelco Dolstra
9ff9c3f2f8
Add support for s3:// URIs
This adds support for s3:// URIs in all places where Nix allows URIs,
e.g. in builtins.fetchurl, builtins.fetchTarball, <nix/fetchurl.nix>
and NIX_PATH. It allows fetching resources from private S3 buckets,
using credentials obtained from the standard places (i.e. AWS_*
environment variables, ~/.aws/credentials and the EC2 metadata
server). This may not be super-useful in general, but since we already
depend on aws-sdk-cpp, it's a cheap feature to add.
2017-02-14 14:20:00 +01:00
Eelco Dolstra
62ff5ad424 Merge pull request #1224 from dezgeg/configh
Unbreak 32-bit builds by always implicitly including config.h
2017-02-13 14:44:58 +01:00
Eelco Dolstra
77a78af678 Merge pull request #1233 from dezgeg/splice
nix-daemon: Don't splice with len=SIZE_MAX
2017-02-13 14:33:18 +01:00
Tuomas Tynkkynen
649a81bcd6 nix-daemon: Don't splice with len=SIZE_MAX
Currently, 'nix-daemon --stdio' is always failing for me, due to the
splice call always failing with (on a 32-bit host):

splice(0, NULL, 3, NULL, 4294967295, SPLICE_F_MOVE) = -1 EINVAL (Invalid argument)

With a bit of ftracing (and luck) the problem seems to be that splice()
always fails with EINVAL if the len cast as ssize_t is negative:
http://lxr.free-electrons.com/source/fs/read_write.c?v=4.4#L384

So use SSIZE_MAX instead of SIZE_MAX.
2017-02-13 15:14:44 +02:00
Vincent Ambo
1c3ea48da9 Merge pull request #2 from tazjin/fix/url-encode
fix urls: Escape values in URLs
2017-02-13 10:03:05 +01:00
Vincent Ambo
6dcb0f4b2b fix urls: Escape values in URLs
For usernames and passwords containing special characters the URL parameters
must be escaped.

Because the entire URI is just query parameters I've opted for using net/url.Values
for the entire URI.

Fixes #1
2017-02-13 09:55:24 +01:00
Vincent Ambo
7824e0e7e3 docs: Add blog post to README 2017-02-11 17:34:09 +01:00
Vincent Ambo
dd1e6c3b36 fix: Two minor, silly fixes 2017-02-11 16:38:23 +01:00
Vincent Ambo
e4ee5a4526 fix: Portability of stdin 2017-02-11 16:33:16 +01:00
Vincent Ambo
4a85116b4a fix: Remove trailing newlines from input 2017-02-11 16:32:36 +01:00
Vincent Ambo
393cff4847 feat: Don't echo password while inputting 2017-02-11 16:30:23 +01:00
Vincent Ambo
e6c3212018 chore: Don't print URLs 2017-02-11 16:19:24 +01:00
Vincent Ambo
01ad38d532 docs: Add README 2017-02-11 13:17:55 +01:00
Vincent Ambo
98e81c2c0e
feat: Initial working implementation 2017-02-11 12:27:12 +01:00
Vincent Ambo
33174cbb80
Initial commit 2017-02-11 12:26:52 +01:00
Renzo Carbonara
e2257d4eeb Documentation. 2017-02-09 18:16:09 +01:00
Vincent Ambo
c181decd9d fix main: Add a forgotten error check 2017-02-09 15:50:22 +01:00
Vincent Ambo
2f6e008121 feat templater: Add 'pass' lookup function
This introduces support for looking up secret values in the 'pass' command line
tool (https://www.passwordstore.org/).

Values like passwords can be interpolated from pass and even more complex
structures like certificates for Kubernetes Secrets can be retrieved and base64-
encoded as necessary.

Fixes #2
2017-02-09 15:44:18 +01:00
Vincent Ambo
4713d565d3 fix templater: Don't fail with two identical stack traces 2017-02-09 15:44:18 +01:00
Vincent Ambo
25c9ed4adc feat main: Version bump to v1.0.0-beta1 2017-02-09 15:44:18 +01:00
Vincent Ambo
b58b1e3385 feat templater: Add applyLimits tests 2017-02-08 22:12:34 +01:00
Vincent Ambo
75b6199c1b feat context: Add deserialisation tests 2017-02-08 22:12:34 +01:00
Tuomas Tynkkynen
2cd468874f Include config.h implicitly with '-include config.h' in CFLAGS
Because config.h can #define things like _FILE_OFFSET_BITS=64 and not
every compilation unit includes config.h, we currently compile half of
Nix with _FILE_OFFSET_BITS=64 and other half with _FILE_OFFSET_BITS
unset. This causes major havoc with the Settings class on e.g. 32-bit ARM,
where different compilation units disagree with the struct layout.

E.g.:

diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
@@ -166,6 +166,8 @@ void Settings::update()
     _get(useSubstitutes, "build-use-substitutes");
+    fprintf(stderr, "at Settings::update(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes);
     _get(buildUsersGroup, "build-users-group");
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -138,6 +138,8 @@ void RemoteStore::initConnection(Connection & conn)
 void RemoteStore::setOptions(Connection & conn)
 {
+    fprintf(stderr, "at RemoteStore::setOptions(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes);
     conn.to << wopSetOptions

Gave me:

at Settings::update(): &useSubstitutes = 0xb6e5c5cb
at RemoteStore::setOptions(): &useSubstitutes = 0xb6e5c5c7

That was not a fun one to debug!
2017-02-08 21:51:02 +02:00
Tuomas Tynkkynen
81c53fe8e5 configure.ac: We require C++14 now
At least in the main Makefile we have:

GLOBAL_CXXFLAGS += -std=c++14 -g -Wall
2017-02-08 21:08:44 +02:00
Vincent Ambo
a6eb421057 docs: Update README with 'delete' command 2017-02-08 18:16:00 +01:00
Vincent Ambo
c046e5acff feat main: Add 'delete' command 2017-02-08 18:16:00 +01:00
Vincent Ambo
dd2fdd63e5 fix templater & ctx: Correctly check resource set parent 2017-02-08 17:42:06 +01:00
Vincent Ambo
756a4c745d fix templater: Guard against empty parent reference 2017-02-08 17:34:49 +01:00
Vincent Ambo
bace4dd895 fix context: Set sub resource names correctly 2017-02-08 17:34:49 +01:00
Vincent Ambo
4e8223ef34 feat context: Add support for resource set collections
A resource set collection is a resource set with an addition 'include' array
configured. It is a short-hand for importing multiple resource sets from the
same folder and for excluding/including them as a group.

See https://github.com/tazjin/kontemplate/issues/9 for more information.

Closes #9
2017-02-08 17:34:49 +01:00
Vincent Ambo
d6b16793c1 docs: Update README with new options 2017-02-08 16:53:38 +01:00
Vincent Ambo
8e08a282eb feat templater: Add ability to exclude resource sets
* renamed --limit to --include (-i)
* added --exclude (-e)

Kontemplate users can now explicitly include and exclude certain resource sets.
Excludes always override includes.

Closes #11
2017-02-08 16:53:38 +01:00
Vincent Ambo
11a5cf9e19 feat main: Add replace support & respect context setting
* Adds support for calling `kubectl replace` (necessary for resource types that do
  not support `apply`).

* Sets `kubectl` context to whatever is defined in the cluster configuration file
2017-02-08 16:19:10 +01:00
Vincent Ambo
250d01c044 docs: Update README for 'apply' command 2017-02-08 15:42:13 +01:00
Vincent Ambo
bc9fc9730d feat main: Add apply command
This integrates support for actually calling out to `kubectl apply`.

A dry-run flag is implemented, too.

The `run` command has been renamed to `template`.
2017-02-08 15:42:13 +01:00
Vincent Ambo
25f2a1616c feat template: Add additional template functions
This adds the Go template functions from [sprig][] as well as a custom `json`
function that can interpolate any data as a JSON object - very useful for adding
arrays of data in JSON format into a variable:

```
certificateDomains:
  - oslo.pub
  - tazj.in

annotations:
  acme/certificate: {{ .certificateDomains | json }}

annotations:
  acme/certificate: ["oslo.pub", "tazj.in"]
```

[sprig]: https://godoc.org/github.com/Masterminds/sprig
2017-02-08 14:40:45 +01:00
Vincent Ambo
efe49de57f docs: Add generated 'kontemplate run' help 2017-02-08 14:07:56 +01:00
Vincent Ambo
6147ea7b9b docs: Add usage & installation sections 2017-02-08 13:53:46 +01:00
Vincent Ambo
3ef0f35bfe fix templater: Guard against empty values map 2017-02-08 13:47:56 +01:00
Vincent Ambo
a1c23d7018 docs: Add YAML to docs 2017-02-08 13:15:36 +01:00
Vincent Ambo
d94a0ffc25 feat context: Add YAML loading support
Closes #5
2017-02-08 13:13:21 +01:00
Vincent Ambo
c58ce7e2ab Merge pull request #7 from tazjin/feat/travis
Enable Travis.CI builds
2017-02-08 13:04:18 +01:00
Vincent Ambo
1e80f19f7b docs: Add build status 2017-02-08 13:03:06 +01:00
Vincent Ambo
13bf8a8ba3 feat build: Add Travis.CI support 2017-02-08 13:00:34 +01:00