Skip to content

Commit 75472c2

Browse files
ceph-pr-api: update to run in a container (via bwc)
Update the ceph-pr-api tests so that the build and tests that this job runs are done so inside a container. The build task is updated to be more similar to how builds are typically done now for 'make check', with a few tweaks. Then for running the tests we reuse the build container image created for the build, install a few extra (ephemeral) dependencies in it and then fire off the dashboard script that runs the api tests. Signed-off-by: John Mulligan <phlogistonjohn@asynchrono.us>
1 parent 0791b42 commit 75472c2

3 files changed

Lines changed: 49 additions & 10 deletions

File tree

ceph-pr-api/build/api

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
11
#!/bin/bash -e
2-
cd src/pybind/mgr/dashboard
3-
timeout 7200 ./run-backend-api-tests.sh
2+
3+
NPMCACHE=${HOME}/npmcache
4+
export NPMCACHE # used by bwc function (silence shellcheck warning)
5+
CB_SCRIPT_DIR=../../../scripts
6+
INNER_SCRIPT_DIR=build.scripts
7+
8+
# this script needs to be run inside the build image rather than
9+
# on the build host. So create an intermediate location for scripts
10+
# that bootstrap the test env than can be executed by a bwc custom
11+
# command.
12+
mkdir -p "${INNER_SCRIPT_DIR}"
13+
cp "${CB_SCRIPT_DIR}/dashboard/install-backend-api-test-deps.sh" \
14+
"${INNER_SCRIPT_DIR}"
15+
chmod +x "${INNER_SCRIPT_DIR}/install-backend-api-test-deps.sh"
16+
17+
# TODO: either we have this hack or we update the dashboard script
18+
# and the things it calss to avoid a bunch of hardcoded sudo calls.
19+
# For now, this is the easier choice.
20+
cat > "${INNER_SCRIPT_DIR}/install-fake-sudo.sh" <<EOF
21+
#!/bin/sh
22+
set -x
23+
echo '#!/bin/sh' > /usr/local/bin/sudo
24+
echo 'exec "\$@"' >> /usr/local/bin/sudo
25+
chmod +x /usr/local/bin/sudo
26+
EOF
27+
chmod +x "${INNER_SCRIPT_DIR}/install-fake-sudo.sh"
28+
29+
bwc 2 -e custom -- \
30+
"./${INNER_SCRIPT_DIR}/install-backend-api-test-deps.sh" \
31+
'&&' "./${INNER_SCRIPT_DIR}/install-fake-sudo.sh" \
32+
'&&' sudo ls \
33+
'&&' cd src/pybind/mgr/dashboard \
34+
'&&' ./run-backend-api-tests.sh

ceph-pr-api/build/build

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ if [[ "$DOCS_ONLY" = true || "$CONTAINER_ONLY" = true || "$GHA_ONLY" == true ]];
1414
exit 0
1515
fi
1616

17-
n_build_jobs=$(get_nr_build_jobs)
18-
n_test_jobs=$(($(nproc) / 4))
19-
export CHECK_MAKEOPTS="-j${n_test_jobs} -N -Q"
20-
export BUILD_MAKEOPTS="-j${n_build_jobs}"
21-
export FOR_MAKE_CHECK=1
22-
timeout 2h ./src/script/run-make.sh \
23-
--cmake-args '-DWITH_TESTS=OFF -DENABLE_GIT_VERSION=OFF'
17+
NPROC=$(nproc)
18+
NPMCACHE=${HOME}/npmcache
19+
export NPMCACHE # used by bwc function (silence shellcheck warning)
20+
cat >.env <<EOF
21+
NPROC=${NPROC}
22+
MAX_PARALLEL_JOBS=${NPROC}
23+
JENKINS_HOME=${JENKINS_HOME}
24+
REWRITE_COVERAGE_ROOTDIR=${PWD}/src/pybind/mgr/dashboard/frontend
25+
CONFIGURE_ARGS=-DWITH_TESTS=OFF
26+
EOF
27+
28+
bwc_login
29+
bwc_populate_npm_cache
30+
bwc 4 -e build
31+
npm_cache_info
2432
sleep 5
2533
ps -ef | grep ceph || true

ceph-pr-api/config/definitions/ceph-pr-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
- shell:
6969
!include-raw-verbatim:
7070
- ../../../scripts/build_utils.sh
71+
- ../../../scripts/bwc.sh
7172
- ../../build/build
72-
- ../../../scripts/dashboard/install-backend-api-test-deps.sh
7373
- ../../build/api
7474

7575
# This job seems to get aborted more often than others. Multiple times in the past week,

0 commit comments

Comments
 (0)