feat:drone-images

This commit is contained in:
Giles Bradshaw 2020-10-23 20:20:40 +01:00
parent da35cfd775
commit 22d87f9487
9 changed files with 75 additions and 1611 deletions

View File

@ -19,7 +19,7 @@ function(config)
depth: 0,
},
services: [
images(config).docker {
images(config).docker() {
privileged: true,
volumes: [
{

View File

@ -31,7 +31,7 @@ function(config)
publicSecrets + secretSecrets + buildSecrets,
),
)(
images(config).ssh{
images(config).ssh() {
name: 'deploy',
settings +: {
envs +: std.map(

63
drone-images.libsonnet Normal file
View File

@ -0,0 +1,63 @@
local images = import 'lib/images.libsonnet';
function(config)
{
kind: 'pipeline',
type: 'docker',
name: 'drone-images',
clone: {
disable: true,
},
steps: [
images(config).ssh() {
settings +: {
script +: [
'mkdir -p /%(root)s/.images/%(name)s/drone-images' % config,
'rm -f /%(root)s/.images/%(name)s/drone-images/*.*' % config,
],
},
}
{
name: 'mkdir',
},
] +
std.map(
function(key)
images(config).ssh() {
settings +: {
envs +: [
'registry_domain',
'registry_port',
'registry_password',
],
script +: [
'docker pull %s' % images(config)[key]().image,
'docker save %(image)s -o /%(root)s/.images/%(name)s/drone-images/%(key)s.tar' % (
config +
{
image: images(config)[key]().image,
key: key,
}
),
'echo "docker load %(key)s.tar" >> /%(root)s/.images/%(name)s/drone-images/load.sh' % (
config +
{
key: key,
}
)
],
},
name: key,
},
std.objectFields(images(config)),
)
} {
trigger +: {
event +: [
'promote',
],
target +: [
'drone-images',
],
},
}

View File

@ -4,7 +4,7 @@ local login = import 'login.libsonnet';
function(config)
function(secrets)
images(config).docker {
images(config).docker() {
name +: 'build:',
environment +: environment.environmentSecrets(secrets),
volumes: [

View File

@ -1,9 +1,9 @@
function (config) {
docker: {
docker(): {
name: 'docker',
image: '%(registry)sdocker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f' % config,
},
scp(target): {
scp(target = ''): {
name: 'scp',
image: '%(registry)sappleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47' % config,
settings +: {
@ -14,7 +14,7 @@ function (config) {
],
},
},
ssh: {
ssh(): {
image: '%(registry)sappleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea' % config,
settings +: {
envs: [
@ -27,11 +27,4 @@ function (config) {
script: [],
},
},
wait(delay): {
image: '%(registry)salpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1' % config,
name: 'wait',
commands: [
'sleep %s' % delay,
],
}
}

View File

@ -30,7 +30,7 @@ function(config)
)
)
(
images(config).ssh {
images(config).ssh() {
settings +: {
script +: [
'rm -f env-%s' % config.name,

View File

@ -14,7 +14,7 @@ function(config)
disable: true,
},
services: [
images(config).docker {
images(config).docker() {
privileged: true,
volumes: [
{
@ -52,7 +52,7 @@ function(config)
],
steps:
std.map(
function(def) images(config).docker {
function(def) images(config).docker() {
name: def.save,
environment +: environment
.environmentSecrets(config.secrets),

View File

@ -19,7 +19,7 @@ function(config)
disable: true,
},
steps: [
images(config).ssh {
images(config).ssh() {
settings +: {
script +: [
'mkdir -p /%(root)s/.images/%(name)s/built' % config,
@ -34,7 +34,7 @@ function(config)
] +
std.map(
function(def)
images(config).ssh {
images(config).ssh() {
settings +: {
envs +: [
'registry_domain',
@ -71,7 +71,7 @@ function(config)
) +
std.map(
function(def)
images(config).ssh {
images(config).ssh() {
settings +: {
envs +: [
'registry_domain',

1592
yarn.lock

File diff suppressed because it is too large Load Diff