~comcloudway/builds.sr.ht

a041bfde568e7735ab19b1e8806d943cbfdde022 — Drew DeVault 5 years ago 9ea208f
Update submit_image_build, add crontab
2 files changed, 25 insertions(+), 5 deletions(-)

A contrib/crontab
M contrib/submit_image_build
A contrib/crontab => contrib/crontab +22 -0
@@ 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

M contrib/submit_image_build => contrib/submit_image_build +3 -5
@@ 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]