ci: built with jsonnet

This commit is contained in:
Giles 2020-08-20 00:17:19 +01:00
parent f659edb63c
commit 0f943c676f
17 changed files with 293 additions and 0 deletions

1
.drone/build.sh Normal file
View File

@ -0,0 +1 @@
echo 'noting to build'

4
.drone/deploy.sh Normal file
View File

@ -0,0 +1,4 @@
docker stack rm portainer
echo 'sleeping...60'
sleep 60
docker stack deploy -c docker-compose.yml portainer

17
.drone/drone-home.jsonnet Normal file
View File

@ -0,0 +1,17 @@
local secretSecrets = import 'lib/secret-secrets.libsonnet';
local publicSecrets = import 'lib/public-secrets.libsonnet';
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
[
deploy(
'portainer',
'/stack/',
[
'LOCAL_DOCKER_REGISTRY',
'REGISTRY_PASSWORD',
],
publicSecrets,
secretSecrets
),
]

156
.drone/drone-home.yml Normal file
View File

@ -0,0 +1,156 @@
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- local_docker_registry
- registry_password
- local_docker_registry
- guacamole_postgres_db
- guacamole_postgres_user
- guacamole_postgres_password
- registry_password
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- rm -f env-guacamole
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-guacamole # \"local-docker-registry\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-guacamole # \"registry-password\""
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-guacamole # \"local-docker-registry\""
- "echo \"export GUACAMOLE_POSTGRES_DB='$${GUACAMOLE_POSTGRES_DB}'\" >> env-guacamole # \"guacamole-postgres-db\""
- "echo \"export GUACAMOLE_POSTGRES_USER='$${GUACAMOLE_POSTGRES_USER}'\" >> env-guacamole # \"guacamole-postgres-user\""
- "echo \"export GUACAMOLE_POSTGRES_PASSWORD='$${GUACAMOLE_POSTGRES_PASSWORD}'\" >> env-guacamole # \"guacamole-postgres-password\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-guacamole # \"registry-password\""
username:
from_secret: ssh-user
environment:
GUACAMOLE_POSTGRES_DB:
from_secret: guacamole-postgres-db
GUACAMOLE_POSTGRES_PASSWORD:
from_secret: guacamole-postgres-password
GUACAMOLE_POSTGRES_USER:
from_secret: guacamole-postgres-user
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
- name: scp
image: appleboy/drone-scp:1.6.2
settings:
command_timeout: 2m
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
source:
- .
target: /stack/guacamole
username:
from_secret: ssh-user
- name: wait
image: alpine
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:dind
commands:
- set -e
- sh .drone/login.sh
- sh .drone/build.sh
- sh .drone/push.sh
- sh .drone/logout.sh
environment:
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
volumes:
- name: dockersock
path: /var/run
- name: deploy
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- local_docker_registry
- guacamole_postgres_db
- guacamole_postgres_user
- guacamole_postgres_password
- registry_password
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- export GUACAMOLE_POSTGRES_PASSWORD=$${GUACAMOLE_POSTGRES_PASSWORD}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- export LOCAL_DOCKER_REGISTRY=$${LOCAL_DOCKER_REGISTRY}
- export GUACAMOLE_POSTGRES_DB=$${GUACAMOLE_POSTGRES_DB}
- export GUACAMOLE_POSTGRES_USER=$${GUACAMOLE_POSTGRES_USER}
- set -e
- cd /stack/guacamole
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username:
from_secret: ssh-user
environment:
GUACAMOLE_POSTGRES_DB:
from_secret: guacamole-postgres-db
GUACAMOLE_POSTGRES_PASSWORD:
from_secret: guacamole-postgres-password
GUACAMOLE_POSTGRES_USER:
from_secret: guacamole-postgres-user
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
services:
- name: docker
image: docker:dind
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
...

View File

@ -0,0 +1 @@
[]

View File

@ -0,0 +1 @@
[]

1
.drone/login.sh Normal file
View File

@ -0,0 +1 @@
docker login ${LOCAL_DOCKER_REGISTRY} --username client --password "${REGISTRY_PASSWORD}"

1
.drone/logout.sh Normal file
View File

@ -0,0 +1 @@
docker logout ${LOCAL_DOCKER_REGISTRY}

6
.drone/package.json Normal file
View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"@sigyl/jsonnet-drone": "^0.0.5"
}
}

1
.drone/pull.sh Normal file
View File

@ -0,0 +1 @@
echo 'noting to pull'

1
.drone/push.sh Normal file
View File

@ -0,0 +1 @@
echo 'noting to push'

55
.drone/yarn-error.log Normal file
View File

@ -0,0 +1,55 @@
Arguments:
/usr/local/Cellar/node/11.9.0/bin/node /usr/local/Cellar/yarn/1.13.0/libexec/bin/yarn.js
PATH:
/Users/giles/.cargo/bin:/Users/giles/.local/bin:/Users/giles/Library/Python/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/usr/local/share/dotnet/sdk:/usr/local/share/dotnet/sdk/2.2.101:/opt/X11/bin:~/.dotnet/tools:/usr/local/bin:/usr/local/Cellar/openssl/1.0.2j/bin/openssl
Yarn version:
1.13.0
Node version:
12.13.1
Platform:
darwin x64
Trace:
Error: getaddrinfo ENOTFOUND registry.yarnpkg.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)
npm manifest:
{
"private": true,
"scripts": {
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
},
"dependencies": {
"@sigyl/jsonnet-drone": "^0.0.3"
}
}
yarn manifest:
No manifest
Lockfile:
# 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==
"@sigyl/jsonnet-drone@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.0.2.tgz#64572524155eaa2c2b8bda6102f238a0269cafbb"
integrity sha512-1/EZR5Vbo8oKAm+R31XIzsS6VZxcEIcRLyrLi53JQ0+z+CWLPvrUwiq0homBysYJhqk1XRzYF6+ctwbbmmzxrA==
dependencies:
"@sigyl/jsonnet-compose" "^0.0.2"
"@sigyl/jsonnet-drone-environment" "0.0.5"

21
.drone/yarn.lock Normal file
View File

@ -0,0 +1,21 @@
# 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==
"@sigyl/jsonnet-drone@^0.0.5":
version "0.0.5"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.0.5.tgz#1017714cfcdb637d36faa4206b29fd4277bfb37f"
integrity sha512-6npYDgXWGblimBYDIRNeNZX20qZmuhQYhSj9hWucXm9i+IKIrxX/3B0gf9JDNXgbK4s4QY95WBrnimeAeMfddg==
dependencies:
"@sigyl/jsonnet-compose" "^0.0.2"
"@sigyl/jsonnet-drone-environment" "0.0.5"

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
.log

3
.versionrc Normal file
View File

@ -0,0 +1,3 @@
{
"tagMessageInChangeLog": true
}

3
git-hooks/pre-commit Executable file
View File

@ -0,0 +1,3 @@
drone jsonnet --source .drone/drone-home.jsonnet --target .drone/drone-home.yml --stream \
&& git add .drone/drone-home.yml \
&& echo "jsonnet built"

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"private": true,
"name": "portainer",
"version": "0.0.1",
"description": "remote access",
"scripts": {
"release": "standard-version",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://sigyl.com/git/stack/portainer"
},
"author": "Giles Bradshaw",
"license": "ISC",
"devDependencies": {
"standard-version": "git+https://github.com/gilesbradshaw/standard-version.git"
}
}