Skip to content

Commit

Permalink
added helm chart and github pages based chart repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Place1 committed Mar 8, 2020
1 parent 33325c2 commit 9d57280
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 27 deletions.
27 changes: 0 additions & 27 deletions build-and-push.py

This file was deleted.

Binary file added docs/charts/wg-access-server-0.0.9.tgz
Binary file not shown.
13 changes: 13 additions & 0 deletions docs/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
entries:
wg-access-server:
- apiVersion: v2
appVersion: 0.0.9
created: "2020-03-08T15:27:38.5587792+11:00"
description: A Wireguard VPN Access Server
digest: e8d795290f577d5d5678619dac42e1a667407aa7128a682da30f26db9f383a1c
name: wg-access-server
urls:
- https://place1.github.io/wg-access-server/charts/wg-access-server-0.0.9.tgz
version: 0.0.9
generated: "2020-03-08T15:27:38.5581672+11:00"
42 changes: 42 additions & 0 deletions publish.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python3
import urllib.request
import subprocess
import json
import yaml

# print the latest tags so we don't have to google our own
# image to check :P
r = urllib.request.urlopen('https://registry.hub.docker.com/v2/repositories/place1/wg-access-server/tags?page_size=10') \
.read() \
.decode('utf-8')
tags = json.loads(r).get('results', [])
print('current docker tags:', sorted([t.get('name') for t in tags], reverse=True))

# tag the new image
version = input('Version: ')
docker_tag=f"place1/wg-access-server:{version}"
# subprocess.run(['docker', 'build', '-t', docker_tag, '.'])

# update the helm chart and quickstart manifest
with open('deploy/helm/wg-access-server/Chart.yaml', 'r+') as f:
chart = yaml.load(f)
chart['version'] = version
chart['appVersion'] = version
f.seek(0)
yaml.dump(chart, f, default_flow_style=False)
f.truncate()
with open('deploy/k8s/quickstart.yaml', 'w') as f:
subprocess.run(['helm', 'template', '--name-template', 'quickstart', 'deploy/helm/wg-access-server/'], stdout=f)
subprocess.run(['helm', 'package', 'deploy/helm/wg-access-server/', '--destination', 'docs/charts/'])
subprocess.run(['helm', 'repo', 'index', 'docs/', '--url', 'https://place1.github.io/wg-access-server'])

# commit changes
subprocess.run(['git', 'add', 'deploy'])

# tag the current commit
subprocess.run(['git', 'tag', '-a', f'v{version}', '-m', f'v{version}'])

# push everything
subprocess.run(['git', 'push'])
subprocess.run(['git', 'push', '--tags'])
subprocess.run(['docker', 'push', docker_tag])

0 comments on commit 9d57280

Please sign in to comment.