Compare commits
No commits in common. "master" and "v0.0.1" have entirely different histories.
198
CHANGELOG.md
198
CHANGELOG.md
|
@ -2,202 +2,4 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
## [1.0.0](https://sigyl.com///compare/v0.4.6...v1.0.0) (2020-10-24)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* destination_registry parameter for save ([2342b9a](https://sigyl.com///commit/2342b9a6fc1f7927ba93938b0233092c1fe1f844))
|
|
||||||
|
|
||||||
### [0.4.6](https://sigyl.com///compare/v0.4.5...v0.4.6) (2020-10-23)
|
|
||||||
|
|
||||||
### [0.4.5](https://sigyl.com///compare/v0.4.4...v0.4.5) (2020-10-23)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* sve to save ([3f87049](https://sigyl.com///commit/3f87049590036054844998b5b5e93c58757961af))
|
|
||||||
|
|
||||||
### [0.4.4](https://sigyl.com///compare/v0.4.3...v0.4.4) (2020-10-23)
|
|
||||||
|
|
||||||
### [0.4.3](https://sigyl.com///compare/v0.4.2...v0.4.3) (2020-10-23)
|
|
||||||
|
|
||||||
### [0.4.2](https://sigyl.com///compare/v0.4.1...v0.4.2) (2020-10-23)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* print, build, save ([fd13fe0](https://sigyl.com///commit/fd13fe0e03711f0a67be11f72736b056ab9bb4c4))
|
|
||||||
|
|
||||||
### [0.4.1](https://sigyl.com///compare/v0.4.0...v0.4.1) (2020-10-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* docker service uses daemon.json from host ([cce9372](https://sigyl.com///commit/cce93724fee636e32846870a8fe3e43f60d22c84))
|
|
||||||
|
|
||||||
## [0.4.0](https://sigyl.com///compare/v0.1.1...v0.4.0) (2020-10-06)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* overide parameter removed
|
|
||||||
* new api config function
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* configured ([527aa41](https://sigyl.com///commit/527aa4128da897dd0690ee16fa2627ab67a927a7))
|
|
||||||
* registry pipeline ([39794f0](https://sigyl.com///commit/39794f03688f9fcdb37abf1937fe0738e41b1700))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* allow configured secrets to registry ([cded64c](https://sigyl.com///commit/cded64c558de384e182cdfce6def20035788c1d8))
|
|
||||||
* registry_password in quotes ([7b42336](https://sigyl.com///commit/7b423364086d14b7ad5b3ea02652670bf8929bd4))
|
|
||||||
* version in package.json ([75be869](https://sigyl.com///commit/75be869735874aac89be358f5f48b0ca1ad98ccb))
|
|
||||||
* wait image ([b4a5dc8](https://sigyl.com///commit/b4a5dc8bb681fc9d9e5303a6bfff9221c30a141e))
|
|
||||||
|
|
||||||
### [0.3.1](https://sigyl.com///compare/v0.2.2...v0.3.1) (2020-09-24)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* allow configured secrets to registry ([cded64c](https://sigyl.com///commit/cded64c558de384e182cdfce6def20035788c1d8))
|
|
||||||
* version in package.json ([75be869](https://sigyl.com///commit/75be869735874aac89be358f5f48b0ca1ad98ccb))
|
|
||||||
|
|
||||||
### [0.2.2](https://sigyl.com///compare/v0.3.0...v0.2.2) (2020-09-24)
|
|
||||||
|
|
||||||
## [0.3.0](https://sigyl.com///compare/v0.2.1...v0.3.0) (2020-09-24)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* overide parameter removed
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* registry pipeline ([39794f0](https://sigyl.com///commit/39794f03688f9fcdb37abf1937fe0738e41b1700))
|
|
||||||
|
|
||||||
### [0.2.1](https://sigyl.com///compare/v0.2.0...v0.2.1) (2020-09-23)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* wait image ([b4a5dc8](https://sigyl.com///commit/b4a5dc8bb681fc9d9e5303a6bfff9221c30a141e))
|
|
||||||
|
|
||||||
## [0.2.0](https://sigyl.com///compare/v0.1.1...v0.2.0) (2020-09-23)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* new api config function
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* configured ([527aa41](https://sigyl.com///commit/527aa4128da897dd0690ee16fa2627ab67a927a7))
|
|
||||||
|
|
||||||
### [0.1.1](https://sigyl.com///compare/v0.1.0...v0.1.1) (2020-09-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* no longer settings for ssh and scp ([3543411](https://sigyl.com///commit/354341178d14c0631be9d33af00bc2ecfa039723))
|
|
||||||
|
|
||||||
## [0.1.0](https://sigyl.com///compare/v0.0.14...v0.1.0) (2020-08-28)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
*
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* make images overideable ([dca47ea](https://sigyl.com///commit/dca47ea05016d374dcdc8151373889788b3b91e2))
|
|
||||||
|
|
||||||
### [0.0.14](https://sigyl.com///compare/v0.0.13...v0.0.14) (2020-08-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* envs in wrong place ([2bb298a](https://sigyl.com///commit/2bb298ab12d668d1d6d6dbb34a0cdcd09bbbcdcb))
|
|
||||||
|
|
||||||
### [0.0.13](https://sigyl.com///compare/v0.0.12...v0.0.13) (2020-08-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* dronesecrets should only be env for deploy ([2ee96ed](https://sigyl.com///commit/2ee96ed5adc2b14f136128ad4588ba15a3d4fba8))
|
|
||||||
|
|
||||||
### [0.0.12](https://sigyl.com///compare/v0.0.11...v0.0.12) (2020-08-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* build with drone secrets ([9f162c4](https://sigyl.com///commit/9f162c47aadbdf438d6bcaf6801be232a608963c))
|
|
||||||
|
|
||||||
### [0.0.11](https://sigyl.com///compare/v0.0.10...v0.0.11) (2020-08-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* still getting build and drone secrets right ..., ([9ca4e4c](https://sigyl.com///commit/9ca4e4c17bdeb6602a7849ae6a58b055214cef2e))
|
|
||||||
|
|
||||||
### [0.0.10](https://sigyl.com///compare/v0.0.9...v0.0.10) (2020-08-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* drone-secrets not build-secrets ([9e3a3b6](https://sigyl.com///commit/9e3a3b686ea813f92a9ff2ca23f0efaae4127142))
|
|
||||||
|
|
||||||
### [0.0.9](https://sigyl.com///compare/v0.0.8...v0.0.9) (2020-08-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* added drone secrets ([d38db6f](https://sigyl.com///commit/d38db6f40fa59cc12d36dba0a88166f06fe90569))
|
|
||||||
|
|
||||||
### [0.0.8](https://sigyl.com///compare/v0.0.7...v0.0.8) (2020-08-26)
|
|
||||||
|
|
||||||
### [0.0.7](https://sigyl.com///compare/v0.0.6...v0.0.7) (2020-08-20)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* deploy getting all buildSecrets ([336e775](https://sigyl.com///commit/336e7757091dfe2b3e0d26c38264eddfbd5ccbf9))
|
|
||||||
|
|
||||||
### [0.0.6](https://sigyl.com///compare/v0.0.5...v0.0.6) (2020-08-20)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* export buildSecrets for deploy ([a5910ac](https://sigyl.com///commit/a5910ac334a37079fb2f1b32f236e7b93224b929))
|
|
||||||
|
|
||||||
### [0.0.5](https://sigyl.com///compare/v0.0.4...v0.0.5) (2020-08-19)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* print all secrets ([721b63f](https://sigyl.com///commit/721b63fec67cd877d1969e6605178b64cd6e43e2))
|
|
||||||
|
|
||||||
### [0.0.4](https://sigyl.com///compare/v0.0.3...v0.0.4) (2020-08-19)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* wrong path ([3c31ed6](https://sigyl.com///commit/3c31ed67b5ae4ed2d96aa0aa4109c3705c054ece))
|
|
||||||
|
|
||||||
### [0.0.3](https://sigyl.com///compare/v0.0.2...v0.0.3) (2020-08-19)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* now publishes dependencies ([ea0dac2](https://sigyl.com///commit/ea0dac27046a231e47db6eb7b6ec153471e3c298))
|
|
||||||
|
|
||||||
### [0.0.2](https://sigyl.com///compare/v0.0.1...v0.0.2) (2020-08-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* include man file ([f7d11cd](https://sigyl.com///commit/f7d11cddccf727859b8e1dbe1a63a6a5a9fa9675))
|
|
||||||
|
|
||||||
### 0.0.1 (2020-08-15)
|
### 0.0.1 (2020-08-15)
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
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,
|
|
||||||
)
|
|
||||||
{
|
|
||||||
kind: 'pipeline',
|
|
||||||
type: 'docker',
|
|
||||||
name: 'build',
|
|
||||||
clone: {
|
|
||||||
disable: false,
|
|
||||||
depth: 0,
|
|
||||||
},
|
|
||||||
services: [
|
|
||||||
images(config).docker() {
|
|
||||||
privileged: true,
|
|
||||||
volumes: [
|
|
||||||
{
|
|
||||||
name: 'dockersock',
|
|
||||||
path: '/var/run',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ca',
|
|
||||||
path: '/etc/docker/certs.d',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'daemonjson',
|
|
||||||
path: '/etc/docker/daemon.json',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
volumes: [
|
|
||||||
{
|
|
||||||
name: 'dockersock',
|
|
||||||
temp: {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ca',
|
|
||||||
host: {
|
|
||||||
path: '/etc/docker/certs.d',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'daemonjson',
|
|
||||||
host: {
|
|
||||||
path: '/etc/docker/daemon.json',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
steps:[
|
|
||||||
build(config)(buildSecrets),
|
|
||||||
],
|
|
||||||
} {
|
|
||||||
trigger +: {
|
|
||||||
event +: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'build',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,17 +1,15 @@
|
||||||
local build = import 'lib/build.libsonnet';
|
local build = import 'lib/build.libsonnet';
|
||||||
local images = import 'lib/images.libsonnet';
|
local images = import 'lib/images.libsonnet';
|
||||||
local environment = import 'lib/node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
local environment = import 'node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
||||||
local compose = import 'lib/node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
|
local compose = import 'node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
|
||||||
local util = import 'lib/util.libsonnet';
|
local util = import 'lib/util.libsonnet';
|
||||||
local login = import 'lib/login.libsonnet';
|
|
||||||
|
|
||||||
|
|
||||||
function(config)
|
|
||||||
function(
|
function(
|
||||||
|
name,
|
||||||
|
root,
|
||||||
buildSecrets,
|
buildSecrets,
|
||||||
publicSecrets,
|
publicSecrets,
|
||||||
secretSecrets,
|
secretSecrets
|
||||||
droneSecrets,
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
kind: 'pipeline',
|
kind: 'pipeline',
|
||||||
|
@ -21,37 +19,77 @@ function(config)
|
||||||
disable: false,
|
disable: false,
|
||||||
depth: 0,
|
depth: 0,
|
||||||
},
|
},
|
||||||
|
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:[
|
steps:[
|
||||||
images(config).scp(
|
compose(
|
||||||
'/%(root)s/%(name)s' % config
|
std.map(
|
||||||
|
function(secret) util.printEnv('env-%s' % name, secret),
|
||||||
|
publicSecrets,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(
|
||||||
|
images.ssh {
|
||||||
|
settings +: {
|
||||||
|
script: [
|
||||||
|
'rm -f env-%s' % name,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
name: 'print env',
|
||||||
|
},
|
||||||
|
images.scp(
|
||||||
|
'%(root)s%(name)s' % { root: root, name: name }
|
||||||
),
|
),
|
||||||
|
images.wait(15),
|
||||||
|
build(buildSecrets),
|
||||||
compose(
|
compose(
|
||||||
std.map(
|
std.map(
|
||||||
function(secret) environment.envSet(secret),
|
function(secret) environment.envSet(secret),
|
||||||
publicSecrets + secretSecrets + buildSecrets,
|
publicSecrets + secretSecrets,
|
||||||
),
|
),
|
||||||
)(
|
)(
|
||||||
images(config).ssh() {
|
images.ssh {
|
||||||
name: 'deploy',
|
name: 'deploy',
|
||||||
settings +: {
|
settings +: {
|
||||||
envs +: std.map(
|
|
||||||
environment.env,
|
|
||||||
droneSecrets,
|
|
||||||
),
|
|
||||||
script +:
|
script +:
|
||||||
std.map(
|
std.map(
|
||||||
function(secret)
|
function(secret)
|
||||||
'export %(env)s=$${%(env)s}' % {
|
'export %(env)s=$${%(env)s}' % {
|
||||||
env: environment.environment(secret)
|
env: environment.environment(secret)
|
||||||
},
|
},
|
||||||
secretSecrets + publicSecrets + buildSecrets + droneSecrets,
|
secretSecrets + publicSecrets,
|
||||||
) +
|
) +
|
||||||
[
|
[
|
||||||
'set -e',
|
'set -e',
|
||||||
'export NAME=%s' % config.name,
|
'cd %(root)s%(name)s' % { root: root, name: name },
|
||||||
'export ROOT=%s' % config.root,
|
'sh .drone/login.sh',
|
||||||
'cd /%(root)s/%(name)s' % config,
|
|
||||||
login,
|
|
||||||
'sh .drone/pull.sh',
|
'sh .drone/pull.sh',
|
||||||
'sh .drone/deploy.sh',
|
'sh .drone/deploy.sh',
|
||||||
]
|
]
|
||||||
|
@ -59,13 +97,6 @@ function(config)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
} {
|
|
||||||
trigger +: {
|
|
||||||
event +: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'deploy',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
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',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,10 +1,8 @@
|
||||||
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';
|
||||||
local login = import 'login.libsonnet';
|
|
||||||
|
|
||||||
function(config)
|
|
||||||
function(secrets)
|
function(secrets)
|
||||||
images(config).docker() {
|
images.docker {
|
||||||
name +: 'build:',
|
name +: 'build:',
|
||||||
environment +: environment.environmentSecrets(secrets),
|
environment +: environment.environmentSecrets(secrets),
|
||||||
volumes: [
|
volumes: [
|
||||||
|
@ -15,10 +13,9 @@ function(config)
|
||||||
],
|
],
|
||||||
commands: [
|
commands: [
|
||||||
'set -e',
|
'set -e',
|
||||||
'export NAME=%s' % config.name,
|
'sh .drone/login.sh',
|
||||||
'export ROOT=%s' % config.root,
|
|
||||||
login,
|
|
||||||
'sh .drone/build.sh',
|
'sh .drone/build.sh',
|
||||||
'sh .drone/push.sh',
|
'sh .drone/push.sh',
|
||||||
|
'sh .drone/logout.sh',
|
||||||
],
|
],
|
||||||
}
|
}
|
|
@ -1,11 +1,12 @@
|
||||||
function (config) {
|
local settings = import 'settings.libsonnet';
|
||||||
docker(): {
|
{
|
||||||
|
docker: {
|
||||||
name: 'docker',
|
name: 'docker',
|
||||||
image: '%(registry)sdocker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f' % config,
|
image: 'docker:dind',
|
||||||
},
|
},
|
||||||
scp(target = ''): {
|
scp(target): settings.ssh {
|
||||||
name: 'scp',
|
name: 'scp',
|
||||||
image: '%(registry)sappleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47' % config,
|
image: 'appleboy/drone-scp:1.6.2',
|
||||||
settings +: {
|
settings +: {
|
||||||
command_timeout: '2m',
|
command_timeout: '2m',
|
||||||
target: target,
|
target: target,
|
||||||
|
@ -14,8 +15,8 @@ function (config) {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ssh(): {
|
ssh: settings.ssh {
|
||||||
image: '%(registry)sappleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea' % config,
|
image: 'appleboy/drone-ssh:1.6.2',
|
||||||
settings +: {
|
settings +: {
|
||||||
envs: [
|
envs: [
|
||||||
'drone_tag',
|
'drone_tag',
|
||||||
|
@ -27,4 +28,11 @@ function (config) {
|
||||||
script: [],
|
script: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
wait(delay): {
|
||||||
|
image: 'alpine',
|
||||||
|
name: 'wait',
|
||||||
|
commands: [
|
||||||
|
'sleep %s' % delay,
|
||||||
|
],
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
|||
|
|
||||||
n=0
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password "$${REGISTRY_PASSWORD}" \\
|
|
||||||
&& break # substitute your command here
|
|
||||||
n=$((n+1))
|
|
||||||
if [ $n -ge 10 ]; then
|
|
||||||
echo "login failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "retrying login..$n"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|||
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"private": true,
|
|
||||||
"name": "@sigyl/jsonnet-drone",
|
|
||||||
"description": "jsonnet to build and deploy with drone",
|
|
||||||
"dependencies": {
|
|
||||||
"@sigyl/jsonnet-compose": "^0.0.2",
|
|
||||||
"@sigyl/jsonnet-drone-environment": "0.0.5"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
local environment = import '../node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
||||||
|
{
|
||||||
|
ssh: {
|
||||||
|
settings +: {
|
||||||
|
host: environment.fromSecret('ssh-host'),
|
||||||
|
port: environment.fromSecret('ssh-port'),
|
||||||
|
username: environment.fromSecret('ssh-user'),
|
||||||
|
key: environment.fromSecret('ssh-key'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
local compose = import 'node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
|
local compose = import '../node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
|
||||||
local environment = import 'node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
local environment = import '../node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
||||||
{
|
{
|
||||||
printEnv(file, env): function(step) compose([
|
printEnv(file, env): function(step) compose([
|
||||||
environment.envSet(env),
|
environment.envSet(env),
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@sigyl/jsonnet-compose@^0.0.2":
|
|
||||||
version "0.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-compose/-/jsonnet-compose-0.0.2.tgz#8900a21e8cd8109929b6042703f8645aacb9bcda"
|
|
||||||
integrity sha512-wWS3CgPeNi/o1pcS6n/4pafxlMD0KC9/RKMZr/ySmzeGNRW++sPuKuxajYse2TNd47uNDdeUSnk4aEeEIKL0zA==
|
|
||||||
|
|
||||||
"@sigyl/jsonnet-drone-environment@0.0.5":
|
|
||||||
version "0.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
|
|
||||||
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
|
|
|
@ -1,14 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "@sigyl/jsonnet-drone",
|
"name": "@sigyl/jsonnet-drone",
|
||||||
"main": "deploy.libsonnet",
|
"version": "0.0.1",
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "jsonnet to build and deploy with drone",
|
"description": "jsonnet to build and deploy with drone",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"publish-npm": "git push --follow-tags origin master && npm publish",
|
"publish": "git push --follow-tags origin master && npm publish",
|
||||||
"release": "standard-version",
|
"release": "standard-version",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
"install": "cd lib && yarn",
|
|
||||||
"prePublishOnly": "cd lib && yarn"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
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,
|
|
||||||
)
|
|
||||||
{
|
|
||||||
kind: 'pipeline',
|
|
||||||
type: 'docker',
|
|
||||||
name: 'print',
|
|
||||||
clone: {
|
|
||||||
disable: false,
|
|
||||||
depth: 0,
|
|
||||||
},
|
|
||||||
steps:[
|
|
||||||
compose(
|
|
||||||
std.map(
|
|
||||||
function(secret) util.printEnv('env-%s' % config.name, secret),
|
|
||||||
buildSecrets +
|
|
||||||
publicSecrets +
|
|
||||||
secretSecrets
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(
|
|
||||||
images(config).ssh() {
|
|
||||||
settings +: {
|
|
||||||
script +: [
|
|
||||||
'rm -f env-%s' % config.name,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
name: 'print env',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
} {
|
|
||||||
trigger +: {
|
|
||||||
event +: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'print',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
kind: 'pipeline',
|
|
||||||
type: 'docker',
|
|
||||||
name: 'register',
|
|
||||||
clone: {
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
trigger +: {
|
|
||||||
event +: {
|
|
||||||
exclude: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,100 +0,0 @@
|
||||||
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)
|
|
||||||
{
|
|
||||||
kind: 'pipeline',
|
|
||||||
type: 'docker',
|
|
||||||
name: 'registry',
|
|
||||||
clone: {
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
services: [
|
|
||||||
images(config).docker() {
|
|
||||||
privileged: true,
|
|
||||||
volumes: [
|
|
||||||
{
|
|
||||||
name: 'dockersock',
|
|
||||||
path: '/var/run',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ca',
|
|
||||||
path: '/etc/docker/certs.d',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'daemonjson',
|
|
||||||
path: '/etc/docker/daemon.json',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
volumes: [
|
|
||||||
{
|
|
||||||
name: 'dockersock',
|
|
||||||
temp: {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ca',
|
|
||||||
host: {
|
|
||||||
path: '/etc/docker/certs.d',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'daemonjson',
|
|
||||||
host: {
|
|
||||||
path: '/etc/docker/daemon.json',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
steps:
|
|
||||||
std.map(
|
|
||||||
function(def) images(config).docker() {
|
|
||||||
name: def.save,
|
|
||||||
environment +: environment
|
|
||||||
.environmentSecrets(config.secrets),
|
|
||||||
volumes: [
|
|
||||||
{
|
|
||||||
name: 'dockersock',
|
|
||||||
path: '/var/run',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
commands: [
|
|
||||||
'set -e',
|
|
||||||
login,
|
|
||||||
|||
|
|
||||||
n=0
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
docker pull %(load)s \\
|
|
||||||
&& docker tag %(load)s $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(save)s \\
|
|
||||||
&& docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(save)s && break
|
|
||||||
n=$((n+1))
|
|
||||||
if [ $n -ge 10 ]; then
|
|
||||||
echo "initialise failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "retrying..$n"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
||| % (config + def),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
config.images,
|
|
||||||
),
|
|
||||||
image_pull_secrets: [
|
|
||||||
'dockerconfigjson'
|
|
||||||
]
|
|
||||||
} {
|
|
||||||
trigger +: {
|
|
||||||
event +: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'registry',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
121
save.libsonnet
121
save.libsonnet
|
@ -1,121 +0,0 @@
|
||||||
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(
|
|
||||||
defs,
|
|
||||||
builtDefs,
|
|
||||||
)
|
|
||||||
{
|
|
||||||
kind: 'pipeline',
|
|
||||||
type: 'docker',
|
|
||||||
name: 'save',
|
|
||||||
clone: {
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
steps: [
|
|
||||||
images(config).ssh() {
|
|
||||||
settings +: {
|
|
||||||
script +: [
|
|
||||||
'mkdir -p /%(root)s/.images/%(name)s/built' % config,
|
|
||||||
'rm -f /%(root)s/.images/%(name)s/*.*' % config,
|
|
||||||
'rm -f /%(root)s/.images/%(name)s/built/*.*' % config,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name: 'mkdir',
|
|
||||||
},
|
|
||||||
] +
|
|
||||||
std.map(
|
|
||||||
function(def)
|
|
||||||
images(config).ssh() {
|
|
||||||
settings +: {
|
|
||||||
envs +: [
|
|
||||||
'registry_domain',
|
|
||||||
'registry_port',
|
|
||||||
'registry_password',
|
|
||||||
'destination_registry'
|
|
||||||
],
|
|
||||||
script +: [
|
|
||||||
login,
|
|
||||||
'docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(save)s' % (config + def),
|
|
||||||
'docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(save)s -o /%(root)s/.images/%(name)s/%(out)s.tar' % (
|
|
||||||
config + def +
|
|
||||||
{
|
|
||||||
out: std.strReplace(def.save, '/', '_'),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'echo "docker load < %(out)s.tar" >> /%(root)s/.images/%(name)s/load.sh' % (
|
|
||||||
config + {
|
|
||||||
out: std.strReplace(def.save, '/', '_'),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(pull)s $${DESTINATION_REGISTRY}/%(root)s/%(name)s/%(pull)s" >> /%(root)s/.images/%(name)s/load.sh' % (
|
|
||||||
config +
|
|
||||||
{
|
|
||||||
pull: def.save,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
} +
|
|
||||||
{
|
|
||||||
name: def.save,
|
|
||||||
},
|
|
||||||
defs
|
|
||||||
) +
|
|
||||||
std.map(
|
|
||||||
function(def)
|
|
||||||
images(config).ssh() {
|
|
||||||
settings +: {
|
|
||||||
envs +: [
|
|
||||||
'registry_domain',
|
|
||||||
'registry_port',
|
|
||||||
'registry_password',
|
|
||||||
'destination_registry',
|
|
||||||
],
|
|
||||||
script +: [
|
|
||||||
login,
|
|
||||||
'docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(save)s' % (config + { save: def }),
|
|
||||||
'docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(save)s -o /%(root)s/.images/%(name)s/built/%(out)s.tar' % (
|
|
||||||
config +
|
|
||||||
{
|
|
||||||
save: def,
|
|
||||||
out: std.strReplace(def, '/', '_'),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'echo "docker load %(out)s.tar" >> /%(root)s/.images/%(name)s/built/load.sh' % (
|
|
||||||
config + {
|
|
||||||
out: std.strReplace(def, '/', '_'),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/%(root)s/%(name)s/%(pull)s ${DESINATION_REGISTRY}/%(root)s/%(name)s/%(pull)s" >> /%(root)s/.images/%(name)s/built/load.sh' % (
|
|
||||||
config +
|
|
||||||
{
|
|
||||||
pull: def,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
} +
|
|
||||||
{
|
|
||||||
name: def,
|
|
||||||
},
|
|
||||||
builtDefs
|
|
||||||
),
|
|
||||||
} {
|
|
||||||
trigger +: {
|
|
||||||
event +: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'save',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
Loading…
Reference in New Issue