k8s-lbry: Refactors package script to use github releases.

This commit is contained in:
Ryan McGuire 2019-06-16 20:47:39 -04:00
parent 0e736ced8a
commit 84ef8ea231
4 changed files with 61 additions and 34 deletions

View file

@ -1,4 +1,3 @@
index.yaml
*.tgz *.tgz
values-dev.yaml values-dev.yaml
values-staging.yaml values-staging.yaml

View file

@ -0,0 +1,4 @@
index.yaml
kick-ascii
.gitignore
completion.bash.inc

View file

@ -0,0 +1,44 @@
apiVersion: v1
entries:
k8s-lbry:
- apiVersion: v1
appVersion: "1.0"
created: "2019-06-16T20:45:37.131503885-04:00"
description: LBRY on Kubernetes with Helm
digest: 0e28fad6b25fcbf79ea30390a65340c50422e84408a86f6e366abdfb1c471cf0
home: https://github.com/lbryio/lbry-docker/tree/master/contrib/k8s-lbry
maintainers:
- email: ryan@enigmacurry.com
name: EnigmaCurry
- email: leopere [at] nixc [dot] us
name: Leopere
name: k8s-lbry
urls:
- https://github.com/lbryio/lbry-docker/releases/download/k8s-lbry-0.1.5/k8s-lbry-0.1.5.tgz
version: 0.1.5
mysql:
- appVersion: 5.7.14
created: "2019-06-16T20:45:37.133445969-04:00"
description: Fast, reliable, scalable, and easy to use open-source relational
database system.
digest: dacef52f53a395059131064cfdc7ae39ae2d7be2580440575d1532dfaa3fd2b8
engine: gotpl
home: https://www.mysql.com/
icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png
keywords:
- mysql
- database
- sql
maintainers:
- email: o.with@sportradar.com
name: olemarkus
- email: viglesias@google.com
name: viglesiasce
name: mysql
sources:
- https://github.com/kubernetes/charts
- https://github.com/docker-library/mysql
urls:
- charts/mysql-0.19.0.tgz
version: 0.19.0
generated: "2019-06-16T20:45:36.911335647-04:00"

View file

@ -19,7 +19,7 @@ VALUES=${VALUES:-$BASEDIR/values-dev.yaml}
DEFAULT_VALUES_URL=${DEFAULT_VALUES_URL:-https://raw.githubusercontent.com/lbryio/lbry-docker/master/contrib/k8s-lbry/values.yaml} DEFAULT_VALUES_URL=${DEFAULT_VALUES_URL:-https://raw.githubusercontent.com/lbryio/lbry-docker/master/contrib/k8s-lbry/values.yaml}
## HELM_REPO - The stable helm chart repository for this chart: ## HELM_REPO - The stable helm chart repository for this chart:
HELM_REPO=${HELM_REPO:-https://k8s-lbry.sfo2.digitaloceanspaces.com} HELM_REPO=${HELM_REPO:-https://lbryio.github.io/lbry-docker/contrib/k8s-lbry/}
## TILLER_HOST - The host that runs tiller ## TILLER_HOST - The host that runs tiller
TILLER_HOST=${TILLER_HOST:-localhost} TILLER_HOST=${TILLER_HOST:-localhost}
@ -32,9 +32,11 @@ CERTMANAGER_VERSION=v0.7.1
NGINX_ENABLE_HTTPS=${NGINX_ENABLE_HTTPS:-false} NGINX_ENABLE_HTTPS=${NGINX_ENABLE_HTTPS:-false}
## Mysql Database snapshot download url: ## Mysql Database snapshot download url:
## TODO: Use lbry owned bucket for this:
CHAINQUERY_SNAPSHOT_URL=${CHAINQUERY_SNAPSHOT_URL:-https://lbry-chainquery-mysql-dump.sfo2.digitaloceanspaces.com/chainquery_height_560900.mysql-backup.tar.gz} CHAINQUERY_SNAPSHOT_URL=${CHAINQUERY_SNAPSHOT_URL:-https://lbry-chainquery-mysql-dump.sfo2.digitaloceanspaces.com/chainquery_height_560900.mysql-backup.tar.gz}
## lbrycrd snapshot download url: ## lbrycrd snapshot download url:
## TODO: Use lbry owned bucket for this:
LBRYCRD_SNAPSHOT_URL=${LBRYCRD_SNAPSHOT_URL:-https://lbry-chainquery-mysql-dump.sfo2.digitaloceanspaces.com/lbrycrd-566588-snapshot.tar.gz} LBRYCRD_SNAPSHOT_URL=${LBRYCRD_SNAPSHOT_URL:-https://lbry-chainquery-mysql-dump.sfo2.digitaloceanspaces.com/lbrycrd-566588-snapshot.tar.gz}
LBRYCRD_RPC_USER=${LBRYCRD_RPC_USER:-lbry} LBRYCRD_RPC_USER=${LBRYCRD_RPC_USER:-lbry}
@ -44,9 +46,6 @@ LBRYCRD_RPC_PASSWORD=${LBRYCRD_RPC_PASSWORD:-lbry}
## defaults to $NAMESPACE (k8s-lbry) ## defaults to $NAMESPACE (k8s-lbry)
RUN_ALIAS=${RUN_ALIAS:-$NAMESPACE} RUN_ALIAS=${RUN_ALIAS:-$NAMESPACE}
## Package bucket (ignore this, only used by developer of this package)
PACKAGE_BUCKET=${PACKAGE_BUCKET:-"s3://k8s-lbry"}
exe() { ( echo "## $*"; $*; ) } exe() { ( echo "## $*"; $*; ) }
setup() { setup() {
@ -285,35 +284,16 @@ package() {
PACKAGE="k8s-lbry-$1.tgz" PACKAGE="k8s-lbry-$1.tgz"
## Build Helm package repository and upload to s3
if which s3cmd > /dev/null; then
if s3cmd info $PACKAGE_BUCKET > /dev/null; then
# Download all remote releases, to re-include in new index.yaml
exe s3cmd sync $PACKAGE_BUCKET .
# Check if release already exists
s3_url="$PACKAGE_BUCKET/$PACKAGE"
if s3cmd info "$s3_url"; then
echo "$s3_url already exists. Aborting."
exit 1
fi
# Package release and rebuild repository # Package release and rebuild repository
exe helm dependency update exe helm dependency update
exe helm package . exe helm package .
exe helm repo index . exe helm repo index --merge index.yaml .
## Replace URLs in index to point to github releases:
# Publish packages to s3 sed -i 's|- k8s-lbry-\(.*\).tgz$|- https://github.com/lbryio/lbry-docker/releases/download/k8s-lbry-\1/k8s-lbry-\1.tgz|g' index.yaml
exe s3cmd put --acl-public index.yaml "$PACKAGE" $PACKAGE_BUCKET echo "Created package: $PACKAGE"
exe s3cmd put --acl-public charts/*.tgz $PACKAGE_BUCKET/charts/ echo "Next steps: "
else echo " 1) Create new github release (https://github.com/lbryio/lbry-docker/releases) and upload $PACKAGE"
echo "s3cmd is not setup, run s3cmd --configure" echo " 2) Commit index.yaml and push to github"
exit 1
fi
else
echo "s3cmd is not installed"
exit 1
fi
) )
} }