-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.py
82 lines (73 loc) · 2.7 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import base64
import json
import os
import requests
def load_manifest(path):
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "manifests", path), "rb") as fp:
return base64.b64encode(fp.read()).decode("utf-8")
def get_release():
return {
"os": {
"type": "coreos",
"channel": "stable",
"version": "1688.4.0",
"manifests": {
"etcd": load_manifest("os/etcd.sh"),
"master": load_manifest("os/master.sh"),
"node": load_manifest("os/node.sh"),
},
},
"kubernetes": {
"version": "v1.10.0",
"images": {
"kube-dns": {
"kubedns": "gcr.io/google_containers/kubedns-amd64:1.6",
"dnsmasq": "gcr.io/google_containers/kube-dnsmasq-amd64:1.3",
}
},
"manifests": {
"kube-dns": load_manifest("kubernetes/dns.yml"),
},
},
"kel": {
"bundles": {
"api": "git-6ab87870",
"router": "git-f9563af8",
},
"images": {
"bundle-builder": "quay.io/kelproject/bundle-builder",
"bundle-runner": "quay.io/kelproject/bundle-runner",
"api-cache": "redis:3.0",
"api-database": "postgres:9.5",
"api-web": "quay.io/kelproject/bundle-runner",
"router": "quay.io/kelproject/bundle-runner",
},
"manifests": {
"kel-system": load_manifest("kel/kel-system.yml"),
"kel-builds": load_manifest("kel/kel-builds.yml"),
"router": load_manifest("kel/router.yml"),
"api-cache": load_manifest("kel/api-cache.yml"),
"api-database": load_manifest("kel/api-database.yml"),
"api-web": load_manifest("kel/api-web.yml"),
},
},
}
def main():
with open("manifest.json", "w") as fp:
fp.write(json.dumps(get_release()))
with open("channels.json", "w") as fp:
r = requests.get("https://storage.googleapis.com/release.kelproject.com/distro/channels.json")
if r.ok:
channels = json.loads(r.content.decode("utf-8"))
else:
channels = {"stable": None, "beta": None, "dev": {}}
git_tag = os.environ.get("TRAVIS_TAG", "")
if git_tag:
version, channel = git_tag.split("-")
channels[channel] = version
else:
channels["dev"][os.environ["TRAVIS_BRANCH"]] = os.environ["BUILD_TAG"]
fp.write(json.dumps(channels))
if __name__ == "__main__":
main()