diff --git a/.drone-home.jsonnet b/.drone-home.jsonnet index 5b96032..dc0b3ee 100644 --- a/.drone-home.jsonnet +++ b/.drone-home.jsonnet @@ -1,4 +1,33 @@ +local secrets = [ + 'ssh-host' +]; local util = { + // the head of an array + head(array): array[0], + // the tail of an array + tail(array): std.makeArray( + std.length(array) -1, + function(x) array[x + 1], + ), + // compose an array of functions + compose(functions): + local compose(functions) = + if std.length(functions) == 0 + then + local ret(object) = object; + ret + else + local ret(object) = compose( + utils.tail( + functions, + ) + )( + utils.head( + functions, + )(object) + ); + ret; + compose(functions), fromSecret(secret): { from_secret: secret, }, @@ -136,12 +165,17 @@ local images = { '/stack/root' ), images.wait(15), - util.printEnv( - 'afile', - 'ssh_host', + util.compose( + std.map( + function(secret) util.printEnv(secret, 'afile'), + secrets, + ) )( images.ssh { - name: 'will print ssh-host', + name: 'will print ssh-host again', + settings +: [ + 'rm afile' + ], }, ) ],