Skip to content

Commit e90047c

Browse files
authored
Merge pull request ceph#62324 from phlogistonjohn/jjm-bwc-fix-70470-clang-2
build-with-container: fix container build on docker and clang setup on ubuntu jammy [v2]
2 parents 58bffab + 9f44155 commit e90047c

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

install-deps.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ fi
2323
DIR=/tmp/install-deps.$$
2424
trap "rm -fr $DIR" EXIT
2525
mkdir -p $DIR
26-
if test $(id -u) != 0 ; then
27-
SUDO=sudo
28-
fi
26+
wrap_sudo
2927
# enable UTF-8 encoding for programs like pip that expect to
3028
# print more than just ascii chars
3129
export LC_ALL=C.UTF-8
@@ -134,7 +132,7 @@ function install_pkg_on_ubuntu {
134132
fi
135133
if test -n "$missing_pkgs"; then
136134
local shaman_url="https://shaman.ceph.com/api/repos/${project}/master/${sha1}/ubuntu/${codename}/repo"
137-
in_jenkins && echo -n "CI_DEBUG: Downloading $shaman_url ... "
135+
ci_debug "Downloading $shaman_url ... "
138136
$SUDO curl --silent --fail --write-out "%{http_code}" --location $shaman_url --output /etc/apt/sources.list.d/$project.list
139137
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get update -y -o Acquire::Languages=none -o Acquire::Translation=none || true
140138
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get install --allow-unauthenticated -y $missing_pkgs

run-make-check.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ function run() {
4747
fi
4848
local aiomax="$((65536 * procs))"
4949
if [ "$(/sbin/sysctl -n fs.aio-max-nr )" -lt "${aiomax}" ]; then
50-
$DRY_RUN sudo /sbin/sysctl -q -w fs.aio-max-nr="${aiomax}"
50+
wrap_sudo
51+
$DRY_RUN $SUDO /sbin/sysctl -q -w fs.aio-max-nr="${aiomax}" || true
5152
fi
5253

5354
CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}

src/script/build-with-container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def build_container(ctx):
459459
cmd = [
460460
ctx.container_engine,
461461
"build",
462-
"--pull=always",
462+
"--pull",
463463
"-t",
464464
ctx.image_name,
465465
f"--build-arg=JENKINS_HOME={ctx.cli.homedir}",

src/script/buildcontainer-setup.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
install_container_deps() {
44
source ./src/script/run-make.sh
5+
# set JENKINS_HOME in order to have the build container look as much
6+
# like an existing jenkins build environment as possible
7+
export JENKINS_HOME=/ceph
58
prepare
69
}
710

@@ -39,7 +42,7 @@ case "${CEPH_BASE_BRANCH}~${DISTRO_KIND}" in
3942
;;
4043
*~*ubuntu*)
4144
apt-get update
42-
apt-get install -y wget reprepro curl
45+
apt-get install -y wget reprepro curl software-properties-common lksctp-tools libsctp-dev protobuf-compiler ragel libc-ares-dev
4346
install_container_deps
4447
;;
4548
*)

src/script/lib-build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ function ci_debug() {
3232
fi
3333
}
3434

35+
function wrap_sudo() {
36+
# set or unset the SUDO env var so that scripts already running
37+
# as root do not call into sudo to escalate privs
38+
if test $(id -u) != 0 ; then
39+
SUDO=sudo
40+
else
41+
SUDO=""
42+
fi
43+
}
44+
3545
# get_processors returns 1/2 the value of the value returned by
3646
# the nproc program OR the value of the environment variable NPROC
3747
# allowing the user to tune the number of cores visible to the

src/script/run-make.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ function prepare() {
5858
ci_debug "Getting clang-19"
5959
wget https://download.ceph.com/qa/llvm.sh
6060
chmod +x llvm.sh
61-
$DRY_RUN sudo ./llvm.sh 19
61+
wrap_sudo
62+
$DRY_RUN $SUDO ./llvm.sh 19
6263
rm llvm.sh
6364
fi
6465
fi

0 commit comments

Comments
 (0)