1- #! /bin/sh -eu
1+ #! /bin/sh -eux
22
3- if [ -n " ${CI+} " ]
3+ # Placeholders to annotate the Github actions logs
4+ trace_on () { true ; }
5+ trace_off () { true ; }
6+ section_start () { true ; }
7+ section_end () { true ; }
8+
9+ if [ -n " ${CI+x} " ]
410then
11+ if [ -n " ${GITHUB_ACTION+x} " ]
512 set -x
6- export PS4=' (${0}:${LINENO}): - [$?] $ '
13+ then
14+ # Functions to annotate the Github actions logs
15+ trace_on () { set -x; }
16+ trace_off () {
17+ { set +x; } 2> /dev/null
18+ }
19+
20+ section_start_internal () {
21+ echo " ::group::$1 "
22+ trace_on
23+ }
24+
25+ section_end_internal () {
26+ echo " ::endgroup::"
27+ trace_on
28+ }
29+
30+ section_start () {
31+ trace_off
32+ section_start_internal " $@ "
33+ }
34+ section_end () {
35+ trace_off
36+ section_end_internal
37+ }
38+ else
39+ export PS4=' (${0}:${LINENO}): - [$?] $ '
40+ fi
741fi
842
943if [ " $# " -eq 0 ] || [ " $# " -gt 2 ]
2458URL=https://www.domjudge.org/releases/domjudge-${VERSION} .tar.gz
2559FILE=domjudge.tar.gz
2660
61+ section_start " Download DOMjudge tarball"
2762echo " [..] Downloading DOMjudge version ${VERSION} ..."
2863
2964if ! wget --quiet " ${URL} " -O ${FILE}
3368fi
3469
3570echo " [ok] DOMjudge version ${VERSION} downloaded as domjudge.tar.gz" ; echo
71+ section_end
3672
73+ section_start " Build domserver container"
3774echo " [..] Building Docker image for domserver..."
3875./build-domjudge.sh " ${NAMESPACE} /domserver:${VERSION} "
3976echo " [ok] Done building Docker image for domserver"
77+ section_end
4078
79+ section_start " Build judgehost container (with intermediate image)"
4180echo " [..] Building Docker image for judgehost using intermediate build image..."
4281./build-judgehost.sh " ${NAMESPACE} /judgehost:${VERSION} "
4382echo " [ok] Done building Docker image for judgehost"
83+ section_end
4484
85+ section_start " Build judgehost container (judging chroot)"
4586echo " [..] Building Docker image for judgehost chroot..."
4687docker build -t " ${NAMESPACE} /default-judgehost-chroot:${VERSION} " -f judgehost/Dockerfile.chroot .
4788echo " [ok] Done building Docker image for judgehost chroot"
89+ section_end
4890
91+ section_start " Push instructions"
4992echo " All done. Image ${NAMESPACE} /domserver:${VERSION} and ${NAMESPACE} /judgehost:${VERSION} created"
5093echo " If you are a DOMjudge maintainer with access to the domjudge organization on Docker Hub, you can now run the following command to push them to Docker Hub:"
5194echo " $ docker push ${NAMESPACE} /domserver:${VERSION} && docker push ${NAMESPACE} /judgehost:${VERSION} && docker push $NAMESPACE }/default-judgehost-chroot:${VERSION} "
@@ -54,3 +97,4 @@ echo "$ docker tag ${NAMESPACE}/domserver:${VERSION} ${NAMESPACE}/domserver:late
5497docker tag ${NAMESPACE} /judgehost:${VERSION} ${NAMESPACE} /judgehost:latest && \
5598docker tag ${NAMESPACE} /default-judgehost-chroot:${VERSION} ${NAMESPACE} /default-judgehost-chroot:latest && \
5699docker push ${NAMESPACE} /domserver:latest && docker push ${NAMESPACE} /judgehost:latest && docker push ${NAMESPACE} /default-judgehost-chroot:latest"
100+ section_end
0 commit comments