From de0e7e483ba0e3b059b74899c28aff95f4293726 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 31 Jan 2021 01:43:19 +0700 Subject: Add a nightly builds pages. Not yet public, until nightly builds on S3 are public. --- scripts/list-nightly-builds.py | 69 ++++++++++++++++++++++++++++++++++++++++++ site/get/nightly-builds.md | 9 ++++++ soupault.conf | 12 ++++++++ 3 files changed, 90 insertions(+) create mode 100755 scripts/list-nightly-builds.py create mode 100644 site/get/nightly-builds.md 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(""" + +""") + +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" + -- cgit v1.2.3