From 757ebdd4ee37f6e575ed980e276b10169c499dad Mon Sep 17 00:00:00 2001 From: lxsang Date: Fri, 26 Jun 2020 01:34:09 +0200 Subject: [PATCH] use atd for task planning --- ci/router.lua | 12 ++---------- ci/scripts/antos.sh | 37 ++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/ci/router.lua b/ci/router.lua index 9d7625f..9605e22 100644 --- a/ci/router.lua +++ b/ci/router.lua @@ -47,16 +47,8 @@ function NotfoundController:index(...) local path = WWW_ROOT..DIR_SEP.."scripts"..DIR_SEP..repository..".sh" if ulib.exists(path) then - result("Build done, log file: https://ci.iohub.dev/log/"..repository.."_"..branch..".txt") - local cmd = "/bin/bash "..path.." "..branch - local handle = io.popen(cmd) - local f = io.open(WWW_ROOT..DIR_SEP.."log"..DIR_SEP..repository.."_"..branch..".txt", "w") - for line in handle:lines() do - f:write(line) - f:write("\n") - end - handle:close() - f:close() + result("Build action triggered, log file will soon be available at: https://ci.iohub.dev/log/"..repository.."_"..branch..".txt") + os.execute("at now -f "..path) else fail("No build script found") end diff --git a/ci/scripts/antos.sh b/ci/scripts/antos.sh index 15928ea..7a8e5dd 100644 --- a/ci/scripts/antos.sh +++ b/ci/scripts/antos.sh @@ -1,25 +1,28 @@ #! /bin/bash -BRANCH="master" +BRANCH="ci" REPO="https://github.com/lxsang/antos.git" DEST="/opt/www/htdocs/os" if [ ! -z $1 ]; then BRANCH="$1" fi -echo "Build date: $(date)" -echo "Building AntOS using branch $BRANCH..." -if [ -d "/tmp/ci" ]; then - echo "Clean up /tmp/ci" - rm -rf /tmp/ci/* -else - echo "Creating /tmp/ci" - mkdir -p "/tmp/ci" -fi -cd /tmp/ci || (echo "Unable to change directory to /tmp/ci" && exit 1) -echo "Cloning Antos (branch $BRANCH) to /tmp/ci..." -git clone -b "$BRANCH" --single-branch --depth=1 "$REPO" -npm i @types/jquery -cd antos || (echo "Unable to change directory to source code folder" && exit 1) -BUILDDIR="$DEST" make release -echo "Done!" +{ + echo "Build date: $(date)" + echo "Building AntOS using branch $BRANCH..." + if [ -d "/tmp/ci" ]; then + echo "Clean up /tmp/ci" + rm -rf /tmp/ci/* + else + echo "Creating /tmp/ci" + mkdir -p "/tmp/ci" + fi + cd /tmp/ci || (echo "Unable to change directory to /tmp/ci" && exit 1) + echo "Cloning Antos (branch $BRANCH) to /tmp/ci..." + git clone -b "$BRANCH" --single-branch --depth=1 "$REPO" + npm i @types/jquery + cd antos || (echo "Unable to change directory to source code folder" && exit 1) + BUILDDIR="$DEST" make release + echo "Done!" +} > "/opt/www/htdocs/ci/log/antos_$BRANCH.txt" +