64 lines
1.5 KiB
Plaintext
64 lines
1.5 KiB
Plaintext
|
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',
|
||
|
],
|
||
|
},
|
||
|
}
|