gitea/.drone/drone-home.jsonnet

107 lines
2.5 KiB
Plaintext

local build = import 'lib/build.libsonnet';
local images = import 'lib/images.libsonnet';
local environment = import 'node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
local compose = import 'node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
local secretSecrets = import 'lib/secret-secrets.libsonnet';
local publicSecrets = import 'lib/public-secrets.libsonnet';
local util = import 'lib/util.libsonnet';
[
{
kind: 'pipeline',
type: 'docker',
name: 'build',
clone: {
disable: false,
depth: 0,
},
/*trigger: {
event: [
'tag',
],
},*/
services: [
images.docker {
privileged: true,
volumes: [
{
name: 'dockersock',
path: '/var/run',
},
{
name: 'ca',
path: '/etc/docker/certs.d',
},
],
},
],
volumes: [
{
name: 'dockersock',
temp: {},
},
{
name: 'ca',
host: {
path: '/etc/docker/certs.d',
},
},
],
steps:[
compose(
std.map(
function(secret) util.printEnv('env-gitea', secret),
publicSecrets,
)
)
(
images.ssh {
settings +: {
script: [
'rm -f env-gitea',
],
},
},
) {
name: 'print env',
},
images.scp(
'/stack/gitea'
),
images.wait(15),
//build,
compose(
std.map(
function(secret) environment.envSet(secret),
publicSecrets + secretSecrets,
),
)(
images.ssh {
name: 'deploy stack',
settings +: {
script +:
std.map(
function(secret)
'export %(env)s=$${%(env)s}' % {
env: environment.environment(secret)
},
secretSecrets + publicSecrets,
) +
[
//'rm -f -R /stack/squid/.secrets',
//'mkdir -p /stack/squid/.secrets',
//'echo "$${CA_CRT}" > /stack/squid/.secrets/ca.crt',
//'echo "$${CA_KEY}" > /stack/squid/.secrets/ca.key',
'set -e',
"cd /stack/gitea",
'docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${REGISTRY_PASSWORD}"',
'sh pull.sh',
'sh deploy.sh',
// 'docker logout $${LOCAL_DOCKER_REGISTRY}',
]
}
},
),
],
}
]