diff --git a/jenkins/runlocal b/jenkins/runlocal index 18f715332a..f904e35890 100755 --- a/jenkins/runlocal +++ b/jenkins/runlocal @@ -1,19 +1,24 @@ #!/bin/bash -e - +# # Build the Pbench Server RPM and container, and run functional tests locally. -# Requires a Fedora, CentOS, or RHEL environment to run. - +# # NOTE WELL: By default, when the functional tests are run, the infrastructure # pod and Pbench Server container are left running by default. Add the switch, # `--cleanup` to direct `jenkins/run-server-func-tests` to cleanup when # finished (success or failure). +# +# Also NOTE: This relies on the incremental build capabilities of Make -- if +# you wish to build from source you should first issue the following commands: +# +# WORKSPACE_TMP=${WORKSPACE_TMP:-${HOME}} jenkins/run make -C server/rpm distclean +# WORKSPACE_TMP=${WORKSPACE_TMP:-${HOME}} jenkins/run make -C dashboard clean +# -# Build the pbench-server RPM locally, then build the containers locally, and -# then run the functional tests against the locally built CI container image. export PB_SERVER_IMAGE_NAME=pbench-server # We use the current user name as the tag to avoid any conflict with what the CI # environment does. +export PB_CONTAINER_REG=images.paas.redhat.com/pbench export PB_SERVER_IMAGE_TAG=${USER} # We use the image pull policy of `never` here to ensure our locally built image @@ -21,32 +26,17 @@ export PB_SERVER_IMAGE_TAG=${USER} export PB_SERVER_IMAGE_PULL_POLICY=never # Create an RPM from the current source tree and double check it exists. -make -C server/rpm clean rpm -export RPM_PATH=${HOME}/rpmbuild/RPMS/noarch/pbench-server-*.rpm +# Set the workspace to the home directory so that the RPM built inside the +# container will be available after it exits. +export WORKSPACE_TMP=${WORKSPACE_TMP:-${HOME}} +jenkins/run make -C server/rpm ci +export RPM_PATH=${WORKSPACE_TMP}/rpmbuild/RPMS/noarch/'pbench-server-*.rpm' +# _Don't_ quote the expansion of ${RPM_PATH}: we _want_ it to be globbed! +# shellcheck disable=SC2086 ls -ld ${RPM_PATH} # Create a Pbench Dashboard deployment -WORKSPACE_TMP=${WORKSPACE_TMP:-${HOME}} jenkins/run make -C dashboard clean build - -source /etc/os-release - -if [[ -z ${BASE_IMAGE} ]]; then - major=${VERSION_ID%%.*} - if [[ ${ID} == "fedora" ]]; then - # Any Fedora is okay. - BASE_IMAGE=${ID}:${major} - elif [[ ${ID} == "centos" && "${major}" == "9" ]]; then - # Only CentOS 9 is supported - BASE_IMAGE=${ID}:stream${major} - elif [[ ${ID} == "rhel" && "${major}" == "9" ]]; then - # Only RHEL 9 is supported - BASE_IMAGE=ubi${major}:latest - else - echo "Unsupported local OS, ${ID}:${VERSION_ID}" >&2 - exit 1 - fi - export BASE_IMAGE -fi +jenkins/run make -C dashboard build # Build the canned Pbench Server container from the RPM built above. server/pbenchinacan/container-build.sh diff --git a/server/pbenchinacan/container-build.sh b/server/pbenchinacan/container-build.sh index 443c3acd49..24cb988c1e 100755 --- a/server/pbenchinacan/container-build.sh +++ b/server/pbenchinacan/container-build.sh @@ -50,7 +50,7 @@ buildah config \ buildah copy $container ${RPM_PATH} /tmp/pbench-server.rpm buildah run $container dnf update -y -if [[ "${BASE_IMAGE}" == *"ubi9:latest" || "${BASE_IMAGE}" == *"centos:stream9" ]]; then +if [[ "${BASE_IMAGE}" == *"ubi9:"* || "${BASE_IMAGE}" == *"centos:stream9" ]]; then buildah run $container dnf install -y --nodocs \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm fi