From a041bfde568e7735ab19b1e8806d943cbfdde022 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 15 Apr 2019 17:27:39 -0400 Subject: [PATCH] Update submit_image_build, add crontab --- contrib/crontab | 22 ++++++++++++++++++++++ contrib/submit_image_build | 8 +++----- 2 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 contrib/crontab diff --git a/contrib/crontab b/contrib/crontab new file mode 100644 index 0000000..f835a3d --- /dev/null +++ b/contrib/crontab @@ -0,0 +1,22 @@ +# Daily refreshes +0 20 * * * chronic /usr/local/bin/submit_image_build -n "Daily scheduled build image refresh" archlinux +30 20 * * * chronic /usr/local/bin/submit_image_build -n "Daily scheduled build image refresh" alpine/edge +0 21 * * * chronic /usr/local/bin/submit_image_build -n "Daily scheduled build image refresh" -a amd64 debian/sid +30 21 * * * chronic /usr/local/bin/submit_image_build -n "Daily scheduled build image refresh" nixos/unstable +0 22 * * * chronic /usr/local/bin/submit_image_build -n "Daily scheduled build image refresh" -a amd64 ubuntu/disco + +# Weekly refreshes +30 19 * * 0 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" nixos/19.03 +30 19 * * 1 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" -a amd64 debian/buster +30 19 * * 2 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" -a amd64 debian/stretch +30 19 * * 3 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" -a amd64 ubuntu/bionic +30 19 * * 4 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" -a amd64 ubuntu/cosmic +30 19 * * 5 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" alpine/3.9 +30 19 * * 6 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" -a amd64 freebsd/current +0 19 * * 0 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" fedora/29 + +# Monthly +0 18 1 * 0 chronic /usr/local/bin/submit_image_build -n "Monthly scheduled build image refresh" -a amd64 freebsd/11.x +0 18 2 * 0 chronic /usr/local/bin/submit_image_build -n "Monthly scheduled build image refresh" -a amd64 freebsd/12.x +0 18 3 * 0 chronic /usr/local/bin/submit_image_build -n "Monthly scheduled build image refresh" ubuntu/xenial +0 18 4 * 0 chronic /usr/local/bin/submit_image_build -n "Weekly scheduled build image refresh" alpine/3.8 diff --git a/contrib/submit_image_build b/contrib/submit_image_build index 42f7a7c..47a78aa 100755 --- a/contrib/submit_image_build +++ b/contrib/submit_image_build @@ -8,7 +8,7 @@ import sys import yaml opts, args = getopt(sys.argv[1:], "n:p:t:u:a:") -usage = f"Usage: {sys.argv[0]} -t token [-n note] [-u builds url] [-p images path] [-a arch] image" +usage = f"Usage: {sys.argv[0]} [-n note] [-u builds url] [-p images path] [-a arch] image" if len(args) != 1: print(usage) @@ -16,14 +16,12 @@ if len(args) != 1: opts = { key: value for (key, value) in opts } -if not "-t" in opts: - print(usage) - sys.exit(1) +with open("/etc/sr.ht/image-refresh-token") as f: + token = f.read().strip() arch = opts.get("-a", "x86_64") note = opts.get("-n") path = opts.get("-p", "/var/lib/images") -token = opts.get("-t") url = opts.get("-u", "https://builds.sr.ht") image = args[0] -- 2.38.5