From c59e0795735a862760845d6733b53166c5fba4fd Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 14 May 2017 01:57:25 +0200 Subject: contrib: rethink jenkins jobs with build slave approach Previously, the idea was to run a test remotely via SSH. This has moved to operating an actual jenkins build slave on the main unit, which simplifies things. Also, previously (in the old osmo-gsm-tester), there was a daemon running, accepting new trials by a directory appearing. Now, we're directly launching a test run, which simplifies things. Remove all SSH stuff from the "run" script. Compose the checksums of the built binary-tars in the actual build jobs. In the "run" job, only combine those checksums to one file. (Otherwise we would compose the sums after transmitting over the network to the build slave.) Instead of storing trials in a common location on the system, just keep one trial in the workspace per run. After the run, tar up the trial dir to enable easy archiving of build results. The common location on the system might still be a good idea if we're one day going to move to concurrent runs with scheduling of hardware resources, but so far we're having simple one-shot runs. Change-Id: I129f5189ce2bebd761bc752b158fb8778b31010e --- contrib/jenkins-osmo-bts-octphy.sh | 8 +++++-- contrib/jenkins-osmo-bts-sysmo.sh | 8 +++++-- contrib/jenkins-osmo-bts-trx.sh | 8 +++++-- contrib/jenkins-osmo-nitb.sh | 8 +++++-- contrib/jenkins-run.sh | 46 ++++++++++++++------------------------ 5 files changed, 41 insertions(+), 37 deletions(-) (limited to 'contrib') diff --git a/contrib/jenkins-osmo-bts-octphy.sh b/contrib/jenkins-osmo-bts-octphy.sh index a4a57e4..4045948 100755 --- a/contrib/jenkins-osmo-bts-octphy.sh +++ b/contrib/jenkins-osmo-bts-octphy.sh @@ -61,6 +61,10 @@ for dep in $deps; do done # build the archive that is going to be copied to the tester -rm "$base"/*.tgz || true +rm "$base"/*.tgz "$base"/*.md5 || true cd "$prefix" -tar czf "$base/osmo-bts-octphy.build-${BUILD_NUMBER}.tgz" * +this="osmo-bts-octphy.build-${BUILD_NUMBER}" +tar="${this}.tgz" +tar czf "$base/$tar" * +cd "$base" +md5sum "$tar" > "${this}.md5" diff --git a/contrib/jenkins-osmo-bts-sysmo.sh b/contrib/jenkins-osmo-bts-sysmo.sh index 5e6c9d9..f321b8c 100755 --- a/contrib/jenkins-osmo-bts-sysmo.sh +++ b/contrib/jenkins-osmo-bts-sysmo.sh @@ -65,6 +65,10 @@ for dep in $deps; do done # build the archive that is going to be copied to the tester and then to the BTS -rm "$base"/*.tgz || true +rm "$base"/*.tgz "$base"/*.md5 || true cd "$prefix_real" -tar cvzf "$base/osmo-bts-sysmo.build-${BUILD_NUMBER}.tgz" * +this="osmo-bts-sysmo.build-${BUILD_NUMBER}" +tar="${this}.tgz" +tar czf "$base/$tar" * +cd "$base" +md5sum "$tar" > "${this}.md5" diff --git a/contrib/jenkins-osmo-bts-trx.sh b/contrib/jenkins-osmo-bts-trx.sh index fb49a75..652913f 100755 --- a/contrib/jenkins-osmo-bts-trx.sh +++ b/contrib/jenkins-osmo-bts-trx.sh @@ -60,6 +60,10 @@ for dep in $deps; do done # build the archive that is going to be copied to the tester -rm "$base"/*.tgz || true +rm "$base"/*.tgz "$base"/*.md5 || true cd "$prefix" -tar czf "$base/osmo-bts-trx.build-${BUILD_NUMBER}.tgz" * +this="osmo-bts-trx.build-${BUILD_NUMBER}" +tar="${this}.tgz" +tar czf "$base/$tar" * +cd "$base" +md5sum "$tar" > "${this}.md5" diff --git a/contrib/jenkins-osmo-nitb.sh b/contrib/jenkins-osmo-nitb.sh index 61d6e2f..6a2420b 100755 --- a/contrib/jenkins-osmo-nitb.sh +++ b/contrib/jenkins-osmo-nitb.sh @@ -60,6 +60,10 @@ for dep in $deps; do done # build the archive that is going to be copied to the tester -rm "$base"/*.tgz || true +rm "$base"/*.tgz "$base"/*.md5 || true cd "$prefix" -tar czf "$base/osmo-nitb.build-${BUILD_NUMBER}.tgz" * +this="osmo-nitb.build-${BUILD_NUMBER}" +tar="${this}.tgz" +tar czf "$base/$tar" * +cd "$base" +md5sum "$tar" > "${this}.md5" diff --git a/contrib/jenkins-run.sh b/contrib/jenkins-run.sh index 7d796b5..87d29bf 100755 --- a/contrib/jenkins-run.sh +++ b/contrib/jenkins-run.sh @@ -1,37 +1,25 @@ #!/bin/sh set -e -x -if [ -z "$OSMO_GSM_TESTER_REMOTE_MAIN_UNIT" ]; then - echo "To run the tests from jenkins, a main unit host must be defined." - echo "e.g. OSMO_GSM_TESTER_REMOTE_MAIN_UNIT=\"user@10.9.8.7\"" -fi +# remove older trial dirs and *-run.tgz, if any +trial_dir_prefix="trial-" +rm -rf "$trial_dir_prefix"* || true -osmo_gsm_tester_host="$OSMO_GSM_TESTER_REMOTE_MAIN_UNIT" -osmo_gsm_tester_src="${OSMO_GSM_TESTER_REMOTE_SRC:-/usr/local/src/osmo-gsm-tester}" -osmo_gsm_tester_dir="/var/tmp/osmo-gsm-tester/trials" -tmp_dir="/var/tmp/osmo-gsm-tester/.prep-trials" +# Expecting *.tgz artifacts to be copied to this workspace from the various +# jenkins-*.sh runs, via jenkins job configuration. Compose a trial dir: +trial_dir="${trial_dir_prefix}$BUILD_NUMBER" +mkdir -p "$trial_dir" -#trial_name="$NODE_NAME-$BUILD_TAG" -trial_name="trial-$BUILD_NUMBER" -local_trial_base="./compose_trial" -local_trial_dir="$local_trial_base/$trial_name" +mv *.tgz "$trial_dir" +cat *.md5 >> "$trial_dir/checksums.md5" +rm *.md5 -rm -rf "$local_trial_base" || true -mkdir -p "$local_trial_dir" +# OSMO_GSM_TESTER_OPTS is a way to pass in e.g. logging preferences from the +# jenkins build job. +python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS -# Add archives from other jenkins builds. -# This jenkins job must be configured to copy *.tgz artifacts to the -# workspace from the various jenkins*bts*.sh runs. -mv $WORKSPACE/*.tgz "$local_trial_dir" -cd "$local_trial_dir" -md5sum *.tgz > checksums.md5 -cd - +# no need to keep extracted binaries +rm -rf "$trial_dir/inst" || true -ssh "$osmo_gsm_tester_host" "$osmo_gsm_tester_src/contrib/trials-cleanup.sh" - -ssh "$osmo_gsm_tester_host" "mkdir -p $tmp_dir" -scp -r "$local_trial_dir" $osmo_gsm_tester_host:$tmp_dir/ -ssh "$osmo_gsm_tester_host" "mv $tmp_dir/$trial_name $osmo_gsm_tester_dir" -trial_dir="$osmo_gsm_tester_dir/$trial_name" - -ssh "$osmo_gsm_tester_host" "python3 -u $osmo_gsm_tester_src/src/osmo-gsm-tester.py $trial_dir -T $OSMO_GSM_TESTER_OPTS" +# tar up all results for archiving (optional) +tar czf "$trial_dir"-run.tgz "$trial_dir" -- cgit v1.2.3