-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-example
- Loading branch information
Showing
98 changed files
with
2,552 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ensure that git would checkout files with lf instead of crlf on windows | ||
*.formatted text eol=lf | ||
*.yml text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ coverage.txt | |
dist/ | ||
helm.tar.gz | ||
linux-amd64/ | ||
darwin-amd64/ | ||
bin/ | ||
.release-notes.md | ||
.tools/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
local base = import './base.libsonnet'; | ||
local base = import '_.libsonnet'; | ||
|
||
base { | ||
components +: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
local base = import './base.libsonnet'; | ||
local base = import '_.libsonnet'; | ||
|
||
base { | ||
components +: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
local len = std.length; | ||
local split = std.split; | ||
local join = std.join; | ||
|
||
// keepDirs returns a key mapping function for the number of directories to be retained | ||
local keepDirs = function(num=0) function(s) ( | ||
if num < 0 | ||
then | ||
s | ||
else ( | ||
local elems = split(s, '/'); | ||
local preserveRight = num + 1; | ||
if len(elems) <= preserveRight | ||
then | ||
s | ||
else ( | ||
local remove = len(elems) - preserveRight; | ||
join('/', elems[remove:]) | ||
) | ||
) | ||
); | ||
|
||
// stripExtension is a key mapping function that strips the file extension from the key | ||
local stripExtension = function(s) ( | ||
local parts = split(s, '/'); | ||
local dirs = parts[:len(parts) - 1]; | ||
local file = parts[len(parts) - 1]; | ||
local fileParts = split(file, '.'); | ||
local fixed = if len(fileParts) == 1 then file else join('.', fileParts[:len(fileParts) - 1]); | ||
join('/', dirs + [fixed]) | ||
); | ||
|
||
// compose composes an array of map functions by applying them in sequence | ||
local compose = function(arr) function(s) std.foldl(function(prev, fn) fn(prev), arr, s); | ||
|
||
// transform transforms an object, mapping keys using the key mapper and values using the valueMapper. | ||
// It ensures that the key mapping does not produce duplicate keys. | ||
local transform = function(globObject, keyMapper=function(s) s, valueMapper=function(o) o) ( | ||
local keys = std.objectFields(globObject); | ||
std.foldl(function(obj, key) ( | ||
local mKey = keyMapper(key); | ||
local val = globObject[key]; | ||
if std.objectHas(obj, mKey) | ||
then | ||
error 'multiple keys map to the same value: %s' % [mKey] | ||
else | ||
obj { [mKey]: valueMapper(val) } | ||
), keys, {}) | ||
); | ||
|
||
// nameOnly is a key mapper that removes all directories and strips extensions from file names, | ||
// syntax sugar for the common case. | ||
local nameOnly = compose([keepDirs(0), stripExtension]); | ||
|
||
{ | ||
transform:: transform, | ||
keepDirs:: keepDirs, | ||
stripExtension:: stripExtension, | ||
compose:: compose, | ||
nameOnly:: nameOnly, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
local p = { | ||
_: import './environments/base.libsonnet', | ||
dev: import './environments/dev.libsonnet', | ||
prod: import './environments/prod.libsonnet', | ||
}; | ||
|
||
local env = std.extVar('qbec.io/env'); | ||
|
||
if std.objectHas(p, env) then p[env] else error 'Environment ' + env + ' not defined in ' + std.thisFile | ||
local globutil = import 'globutil.libsonnet'; | ||
local p = globutil.transform(import 'glob-import:environments/*.libsonnet', globutil.nameOnly); | ||
|
||
local key = std.extVar('qbec.io/env'); | ||
if std.objectHas(p, key) then p[key] else error 'Environment ' + key + ' not defined in environments/' |
Oops, something went wrong.