parent
3055b928e9
commit
dca47ea050
|
@ -4,13 +4,16 @@ local environment = import 'lib/node_modules/@sigyl/jsonnet-drone-environment/en
|
||||||
local compose = import 'lib/node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
|
local compose = import 'lib/node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
|
||||||
local util = import 'lib/util.libsonnet';
|
local util = import 'lib/util.libsonnet';
|
||||||
|
|
||||||
|
local overide = function(overides, name)
|
||||||
|
({ [name]: {}} + overides)[name];
|
||||||
function(
|
function(
|
||||||
name,
|
name,
|
||||||
root,
|
root,
|
||||||
buildSecrets,
|
buildSecrets,
|
||||||
publicSecrets,
|
publicSecrets,
|
||||||
secretSecrets,
|
secretSecrets,
|
||||||
droneSecrets
|
droneSecrets,
|
||||||
|
imageOverides = {},
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
kind: 'pipeline',
|
kind: 'pipeline',
|
||||||
|
@ -21,7 +24,7 @@ function(
|
||||||
depth: 0,
|
depth: 0,
|
||||||
},
|
},
|
||||||
services: [
|
services: [
|
||||||
images.docker {
|
images.docker(overide(imageOverides, 'docker')) {
|
||||||
privileged: true,
|
privileged: true,
|
||||||
volumes: [
|
volumes: [
|
||||||
{
|
{
|
||||||
|
@ -57,9 +60,9 @@ function(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
images.ssh {
|
images.ssh(overide(imageOverides, 'ssh')) {
|
||||||
settings +: {
|
settings +: {
|
||||||
script: [
|
script +: [
|
||||||
'rm -f env-%s' % name,
|
'rm -f env-%s' % name,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -67,18 +70,18 @@ function(
|
||||||
) {
|
) {
|
||||||
name: 'print env',
|
name: 'print env',
|
||||||
},
|
},
|
||||||
images.scp(
|
images.scp(overide(imageOverides, 'scp'))(
|
||||||
'%(root)s%(name)s' % { root: root, name: name }
|
'%(root)s%(name)s' % { root: root, name: name }
|
||||||
),
|
),
|
||||||
images.wait(15),
|
images.wait(overide(imageOverides, 'alpine'))(15),
|
||||||
build(buildSecrets),
|
build(overide(imageOverides, 'docker'))(buildSecrets),
|
||||||
compose(
|
compose(
|
||||||
std.map(
|
std.map(
|
||||||
function(secret) environment.envSet(secret),
|
function(secret) environment.envSet(secret),
|
||||||
publicSecrets + secretSecrets + buildSecrets,
|
publicSecrets + secretSecrets + buildSecrets,
|
||||||
),
|
),
|
||||||
)(
|
)(
|
||||||
images.ssh {
|
images.ssh(overide(imageOverides, 'ssh')) {
|
||||||
name: 'deploy',
|
name: 'deploy',
|
||||||
settings +: {
|
settings +: {
|
||||||
envs +: std.map(
|
envs +: std.map(
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
local images = import 'images.libsonnet';
|
local images = import 'images.libsonnet';
|
||||||
local environment = import 'node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
local environment = import 'node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
||||||
|
|
||||||
function(secrets)
|
function(overide)
|
||||||
images.docker {
|
function(secrets)
|
||||||
|
images.docker(overide) {
|
||||||
name +: 'build:',
|
name +: 'build:',
|
||||||
environment +: environment.environmentSecrets(secrets),
|
environment +: environment.environmentSecrets(secrets),
|
||||||
volumes: [
|
volumes: [
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
local settings = import 'settings.libsonnet';
|
local settings = import 'settings.libsonnet';
|
||||||
{
|
{
|
||||||
docker: {
|
docker(overide): {
|
||||||
name: 'docker',
|
name: 'docker',
|
||||||
image: 'docker:dind',
|
image: 'docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f',
|
||||||
},
|
} + overide,
|
||||||
scp(target): settings.ssh {
|
scp(overide): function(target) settings.ssh {
|
||||||
name: 'scp',
|
name: 'scp',
|
||||||
image: 'appleboy/drone-scp:1.6.2',
|
image: 'appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47',
|
||||||
settings +: {
|
settings +: {
|
||||||
command_timeout: '2m',
|
command_timeout: '2m',
|
||||||
target: target,
|
target: target,
|
||||||
|
@ -14,9 +14,9 @@ local settings = import 'settings.libsonnet';
|
||||||
'.',
|
'.',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
} + overide,
|
||||||
ssh: settings.ssh {
|
ssh(overide): settings.ssh {
|
||||||
image: 'appleboy/drone-ssh:1.6.2',
|
image: 'appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea',
|
||||||
settings +: {
|
settings +: {
|
||||||
envs: [
|
envs: [
|
||||||
'drone_tag',
|
'drone_tag',
|
||||||
|
@ -27,12 +27,12 @@ local settings = import 'settings.libsonnet';
|
||||||
],
|
],
|
||||||
script: [],
|
script: [],
|
||||||
},
|
},
|
||||||
},
|
} + overide,
|
||||||
wait(delay): {
|
wait(overide): function(delay) {
|
||||||
image: 'alpine',
|
image: 'alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1',
|
||||||
name: 'wait',
|
name: 'wait',
|
||||||
commands: [
|
commands: [
|
||||||
'sleep %s' % delay,
|
'sleep %s' % delay,
|
||||||
],
|
],
|
||||||
}
|
} + overide
|
||||||
}
|
}
|
|
@ -2,10 +2,11 @@ local environment = import 'node_modules/@sigyl/jsonnet-drone-environment/enviro
|
||||||
{
|
{
|
||||||
ssh: {
|
ssh: {
|
||||||
settings +: {
|
settings +: {
|
||||||
host: environment.fromSecret('ssh-host'),
|
host: '${SSH_HOST}',
|
||||||
port: environment.fromSecret('ssh-port'),
|
username: '${SSH_USER}',
|
||||||
username: environment.fromSecret('ssh-user'),
|
key: '${SSH_KEY}',
|
||||||
key: environment.fromSecret('ssh-key'),
|
port: '${SSH_PORT}',
|
||||||
|
passphrase: '${SSH_PASSPHRASE}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
Loading…
Reference in New Issue