diff options
author | Daniil Baturin <daniil@baturin.org> | 2021-01-31 01:43:19 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2021-01-31 01:48:56 +0700 |
commit | de0e7e483ba0e3b059b74899c28aff95f4293726 (patch) | |
tree | 3c9cb8d6b0f2d10360e7707f45be134407796dd2 | |
parent | d930d384e4b49bc59a0394b7a67808b4110fdcca (diff) | |
download | community.vyos.net-de0e7e483ba0e3b059b74899c28aff95f4293726.tar.gz community.vyos.net-de0e7e483ba0e3b059b74899c28aff95f4293726.zip |
Add a nightly builds pages.
Not yet public, until nightly builds on S3 are public.
-rwxr-xr-x | scripts/list-nightly-builds.py | 69 | ||||
-rw-r--r-- | site/get/nightly-builds.md | 9 | ||||
-rw-r--r-- | soupault.conf | 12 |
3 files changed, 90 insertions, 0 deletions
diff --git a/scripts/list-nightly-builds.py b/scripts/list-nightly-builds.py new file mode 100755 index 0000000..6de4058 --- /dev/null +++ b/scripts/list-nightly-builds.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +# +# Builds a list of nightly builds from S3 +# +# Requires the following environment variables: +# SNAPSHOTS_BUCKET +# AWS_ACCESS_KEY_ID +# AWS_SECRET_ACCESS_KEY + +import os +import re +import json + +import boto3 + +import jinja2 + +from functools import cmp_to_key + +bucket = os.getenv("SNAPSHOTS_BUCKET") + +def make_link(s, f): + f = re.sub(r'\s+', '+', f) + return "https://s3.amazonaws.com/{0}/{1}".format(bucket, f) + +def compare(l, r): + try: + regex = r'\-(\d+)\-' + l_date = int(re.search(regex, l).group(1)) + r_date = int(re.search(regex, r).group(1)) + if l_date == r_date: + return 0 + elif l_date > r_date: + return 1 + else: + return -1 + except: + return(-1) + + +s3 = boto3.client('s3') +object_listing = s3.list_objects_v2(Bucket=bucket, Prefix='rolling') +data = object_listing['Contents'] + +files = [] +for f in data: + files.append(f['Key']) + +file_names = list(set(map(lambda s: re.sub(r'rolling/(.*?)', r'\1', s), files))) +file_names.sort(reverse=True, key=cmp_to_key(compare)) + +builds = [] + +for name in file_names: + build = {} + build['file'] = name + build['link'] = make_link('rolling', name) + + builds.append(build) + +tmpl = jinja2.Template(""" +<ul> +{% for b in builds %} + <li><a href="{{b.link}}">{{b.file}}</a></li> +{% endfor %} +</ul> +""") + +print(tmpl.render(builds=builds)) diff --git a/site/get/nightly-builds.md b/site/get/nightly-builds.md new file mode 100644 index 0000000..2222876 --- /dev/null +++ b/site/get/nightly-builds.md @@ -0,0 +1,9 @@ +# VyOS nightly builds + +VyOS nightly builds are automatically produced from the `current` branch every day. +They include all the latest code from maintainers and community contributors. + +Nightly builds _do not receive any testing_ before upload. They can be broken in the most bizzare ways, +up to and including failing to boot. They are only for testing latest code. + +## Available builds diff --git a/soupault.conf b/soupault.conf index a8bda40..192dc23 100644 --- a/soupault.conf +++ b/soupault.conf @@ -42,6 +42,7 @@ selector = "main" action = "insert_before" +# Generates a list of available snapshots from S3 [widgets.list-snapshots] widget = "exec" command = "scripts/list-snapshots.py" @@ -50,3 +51,14 @@ page = "get/snapshots.md" profile = "live" + +# Generates a list of nightly builds from S3 +[widgets.list-nightly-builds] + widget = "exec" + command = "scripts/list-nightly-builds.py" + selector = "div#content" + action = "append_child" + + page = "get/nightly-builds.md" + profile = "live" + |