Browse Source

Centralize logging and ensure sane build number

Ensure full build logs are always persisted. The new build_number
function always increments the build number index, so we need to cache
it at the earliest possible moment in main. Thus, build_number should
only be called once and only once.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
pull/4/head
Shawn Webb 11 months ago
parent
commit
b1b9109a7c
Signed by: shawn.webb <shawn.webb@hardenedbsd.org> GPG Key ID: FF2E67A277F8E1FA
4 changed files with 24 additions and 12 deletions
  1. +17
    -10
      bin/ci.sh
  2. +5
    -1
      lib/log.sh
  3. +1
    -1
      lib/publish.sh
  4. +1
    -0
      lib/util.sh

+ 17
- 10
bin/ci.sh View File

@@ -25,6 +25,7 @@
# SUCH DAMAGE.

. ./lib/build.sh
. ./lib/log.sh
. ./lib/publish.sh
. ./lib/util.sh

@@ -40,17 +41,23 @@ main() {
HBSD_TARGET=amd64
HBSD_TARGET_ARCH=amd64
HBSD_NOCLEAN="-DNO_CLEAN"
HBSD_LOGDIR=/build/logs/13-current.amd64

assert_unlocked && \
lock_build && \
update_codebase && \
build_hardenedbsd && \
build_release && \
stage_release && \
sign_release && \
publish_release && \
kick_publisher_tires && \
unlock_build
HBSD_BUILDNUMBER=$(build_number)
HBSD_BUILD_LOG=${HBSD_LOGDIR}/${HBSD_BUILDNUMBER}.log

(
assert_unlocked && \
lock_build && \
update_codebase && \
build_hardenedbsd && \
build_release && \
stage_release && \
sign_release && \
publish_release && \
kick_publisher_tires && \
unlock_build
) | build_log
return ${?}
}



+ 5
- 1
lib/log.sh View File

@@ -30,6 +30,10 @@ log_info() {
}

log_err() {
logger -p usr.err HBSDBUILD_ERROR: $*
logger -p user.err HBSDBUILD_ERROR: $*
return ${?}
}

build_log() {
tee ${HBSD_BUILD_LOG} 2>&1
}

+ 1
- 1
lib/publish.sh View File

@@ -25,7 +25,7 @@
# SUCH DAMAGE.

publish_release() {
mv ${HBSD_STAGEDIR} ${HBSD_PUBDIR}/$(build_number)
mv ${HBSD_STAGEDIR} ${HBSD_PUBDIR}/${HBSD_BUILDNUMBER}
return ${?}
}



+ 1
- 0
lib/util.sh View File

@@ -51,6 +51,7 @@ assert_unlocked() {
return 0
}

# The build_number function must be called EXACTLY ONCE.
build_number() {
local n



Loading…
Cancel
Save