local build = import 'lib/build.libsonnet'; local images = import 'lib/images.libsonnet'; local environment = import 'lib/node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet'; local compose = import 'lib/node_modules/@sigyl/jsonnet-compose/compose.libsonnet'; local util = import 'lib/util.libsonnet'; local login = import 'lib/login.libsonnet'; function(config) function( buildSecrets, publicSecrets, secretSecrets, droneSecrets, ) { kind: 'pipeline', type: 'docker', name: 'deploy', clone: { disable: false, depth: 0, }, steps:[ images(config).scp( '/%(root)s/%(name)s' % config ), compose( std.map( function(secret) environment.envSet(secret), publicSecrets + secretSecrets + buildSecrets, ), )( images(config).ssh{ name: 'deploy', settings +: { envs +: std.map( environment.env, droneSecrets, ), script +: std.map( function(secret) 'export %(env)s=$${%(env)s}' % { env: environment.environment(secret) }, secretSecrets + publicSecrets + buildSecrets + droneSecrets, ) + [ 'set -e', 'export NAME=%s' % config.name, 'export ROOT=%s' % config.root, 'cd /%(root)s/%(name)s' % config, login, 'sh .drone/pull.sh', 'sh .drone/deploy.sh', ] } }, ), ], } { trigger +: { event +: [ 'promote', ], target +: [ 'deploy', ], }, }