diff options
author | EuAndreh <eu@euandre.org> | 2021-07-25 16:00:57 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-07-25 16:00:57 -0300 |
commit | 301a644485dac428e6ef09396bbc9f7c3180849b (patch) | |
tree | c1b7eac20494127ce283a29a4da6e08be9f3e765 /aux/ci | |
parent | src/xyz/euandreh/queue.scm: Update mdpo to 0.3.63 (diff) | |
download | package-repository-301a644485dac428e6ef09396bbc9f7c3180849b.tar.gz package-repository-301a644485dac428e6ef09396bbc9f7c3180849b.tar.xz |
aux/: Update
Diffstat (limited to 'aux/ci')
-rwxr-xr-x | aux/ci/ci-build.sh | 17 | ||||
-rwxr-xr-x | aux/ci/git-post-receive.sh | 9 | ||||
-rwxr-xr-x | aux/ci/git-pre-push.sh | 5 | ||||
-rwxr-xr-x | aux/ci/report.sh | 11 |
4 files changed, 27 insertions, 15 deletions
diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh index be97866..17e9e37 100755 --- a/aux/ci/ci-build.sh +++ b/aux/ci/ci-build.sh @@ -3,10 +3,17 @@ set -eux PROJECT="$1" LOGS_DIR="$2" -read -r _ SHA _ # oldrev newrev refname +SHA="$3" FILENAME="$(date -Is)-$SHA.log" LOGFILE="$LOGS_DIR/$FILENAME" +mkdtemp() { + name="$(echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" + rm -f "$name" + mkdir "$name" + echo "$name" +} + { echo "Starting CI job at: $(date -Is)" @@ -26,24 +33,24 @@ EOF git notes append -m "$NOTE" cd - + git fetch origin refs/notes/*:refs/notes/* sh aux/ci/report.sh -n "$PROJECT" -o public rsync -av public/ "/srv/http/$PROJECT/" --delete - printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s" "$STATUS" + printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s\n\n" "$STATUS" } trap finish EXIT unset GIT_DIR REMOTE="$PWD" - cd "$(mktemp -d)" + cd "$(mkdtemp)" git clone "$REMOTE" . git config --global user.email git@euandre.org git config --global user.name 'EuAndreh CI' - git fetch origin refs/notes/*:refs/notes/* git annex get ||: if [ -f aux/guix/with-container.sh ]; then - RUNNER='./aux/guix/with-container.sh' + RUNNER='sh aux/guix/with-container.sh' else RUNNER='sh -c' fi diff --git a/aux/ci/git-post-receive.sh b/aux/ci/git-post-receive.sh index 167ac4a..426bff3 100755 --- a/aux/ci/git-post-receive.sh +++ b/aux/ci/git-post-receive.sh @@ -9,6 +9,13 @@ for n in $(seq 0 $((GIT_PUSH_OPTION_COUNT - 1))); do fi done +# shellcheck disable=2034 +read -r _oldrev SHA _refname + PROJECT="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix LOGS_DIR="/opt/ci/$PROJECT/logs" -"/opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR" +sh "/opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR" "$SHA" ||: + +echo 'To retrigger the build, run:' +echo "cd /srv/http/$PROJECT.git/" +echo "sh /opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR" "$SHA" diff --git a/aux/ci/git-pre-push.sh b/aux/ci/git-pre-push.sh index cccd6e5..eaaa7bd 100755 --- a/aux/ci/git-pre-push.sh +++ b/aux/ci/git-pre-push.sh @@ -2,12 +2,13 @@ set -eux TLD="$(cat aux/tld.txt)" +. aux/lib.sh PROJECT="$(basename "$PWD")" LOGS_DIR="/opt/ci/$PROJECT/logs" -REMOTE_GIT_DIR="/srv/git/$PROJECT.git" +REMOTE_GIT_DIR="/srv/http/$PROJECT.git" -DESCRIPTION="$(mktemp)" +DESCRIPTION="$(mkstemp)" if [ -f description ] then cp description "$DESCRIPTION" diff --git a/aux/ci/report.sh b/aux/ci/report.sh index 69dbea3..1aa41a0 100755 --- a/aux/ci/report.sh +++ b/aux/ci/report.sh @@ -2,6 +2,8 @@ set -eu TLD="$(cat aux/tld.txt)" +. aux/lib.sh + while getopts 'n:o:' flag; do case "$flag" in n) @@ -32,14 +34,9 @@ FAIL='❌' mkdir -p "$OUTDIR/ci-logs" "$OUTDIR/ci-data" -OUT="$(mktemp)" +OUT="$(mkstemp)" chmod 644 "$OUT" -git fetch origin refs/notes/ci-data:refs/notes/ci-data ||: & -git fetch origin refs/notes/ci-logs:refs/notes/ci-logs ||: & -git fetch origin refs/notes/commits:refs/notes/commits ||: & -wait - for c in $(git notes list | cut -d\ -f2); do DATA="$(git notes --ref=refs/notes/ci-data show "$c")" FILENAME="$(echo "$DATA" | cut -d\ -f2)" @@ -64,7 +61,7 @@ cat <<EOF >> "$OUT" </head> <body> <h1> - CI logs for <a href="https://$TLD/$PROJECT/">$PROJECT</a> + CI logs for <a href="https://$TLD/$PROJECT/en/">$PROJECT</a> </h1> <ul> EOF |