Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
!src
!deps
!utils/build
!utils/build.config
!utils/certs
!utils/ci
Expand Down
35 changes: 22 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -832,29 +832,34 @@ pipeline {
' --target build-ci' +
' --build-arg REPOS="' + prRepos() + '"' +
' --build-arg POINT_RELEASE=.7' +
" --build-arg PYTHON_VERSION=${env.PYTHON_VERSION}" +
" --build-arg DAOS_DEPS_INSTALL=yes"
" --build-arg PYTHON_VERSION=${env.PYTHON_VERSION}"
}
}
steps {
script {
sh label: 'Collect dependency RPMs built into the image',
script: 'mkdir -p rpms/deps && ' +
'cp /home/daos/rpms/deps/*.rpm rpms/deps/ 2>/dev/null || true'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you remove stderr from the log? 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it actually fail?

Suggested change
'cp /home/daos/rpms/deps/*.rpm rpms/deps/ 2>/dev/null || true'
'cp /home/daos/rpms/deps/*.rpm rpms/deps/ 2>/dev/null'

job_step_update(
sconsBuild(parallel_build: true,
stash_files: 'ci/test_files_to_stash.txt',
build_deps: 'no',
stash_opt: true,
scons_exe: 'utils/build/build_daos.sh',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand you plan to clean it up with another PR? 😅

scons_args: sconsArgs() +
' PREFIX=/opt/daos TARGET_TYPE=release'))
sh label: 'Generate RPMs',
script: './ci/rpm/gen_rpms.sh el9 "' + env.DAOS_RELVAL + '"'
' TARGET_TYPE=release'))
sh label: 'Build DAOS RPMs',
script: 'DISTRO=el9 DAOS_RELVAL="' + env.DAOS_RELVAL +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undocummented argument?

'" utils/build/build_packages.sh daos'
Comment on lines +852 to +853

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it is a little bit easier to follow what is quoted and what is not this way.

Suggested change
script: 'DISTRO=el9 DAOS_RELVAL="' + env.DAOS_RELVAL +
'" utils/build/build_packages.sh daos'
script: "DISTRO=el9 DAOS_RELVAL='${env.DAOS_RELVAL}'" +
' utils/build/build_packages.sh daos'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not think about such change at all ...

// Go binaries need to be instrumented in order to work reliably
// with valgrind. We do this in a separate build because we don't
// want to ship the instrumented binaries.
job_step_update(
sconsBuild(parallel_build: true,
build_deps: 'no',
scons_exe: 'utils/build/build_daos.sh',
scons_args: sconsArgs() +
' BUILD_GO_VALGRIND=1 PREFIX=/opt/daos TARGET_TYPE=release'))
' BUILD_GO_VALGRIND=1 TARGET_TYPE=release'))
sh label: 'Stash valgrind install tree for NLT',
script: 'tar -C / -cf opt-daos-valgrind.tar opt/daos'
stash(name: 'opt-daos-valgrind', includes: 'opt-daos-valgrind.tar')
Expand Down Expand Up @@ -887,26 +892,30 @@ pipeline {
filename 'utils/docker/Dockerfile.leap.15'
label 'docker_runner'
additionalBuildArgs dockerBuildArgs(repo_type: 'stable',
parallel_build: true,
deps_build: true) +
deps_build: true,
parallel_build: true) +
Comment on lines +895 to +896

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a funny one. 😆 What is the point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same order in leap and el9 build

" -t ${sanitized_JOB_NAME()}-leap15" +
' --target build-ci' +
' --build-arg POINT_RELEASE=.6' +
" --build-arg PYTHON_VERSION=${env.PYTHON_VERSION}" +
" --build-arg DAOS_DEPS_INSTALL=yes"
" --build-arg PYTHON_VERSION=${env.PYTHON_VERSION}"
}
}
steps {
script {
sh label: 'Collect dependency RPMs built into the image',
script: 'mkdir -p rpms/deps && ' +
'cp /home/daos/rpms/deps/*.rpm rpms/deps/ 2>/dev/null || true'
job_step_update(
sconsBuild(parallel_build: true,
stash_files: 'ci/test_files_to_stash.txt',
build_deps: 'no',
stash_opt: true,
scons_exe: 'utils/build/build_daos.sh',
scons_args: sconsArgs() +
' PREFIX=/opt/daos TARGET_TYPE=release'))
sh label: 'Generate RPMs',
script: './ci/rpm/gen_rpms.sh suse.lp156 "' + env.DAOS_RELVAL + '"'
' TARGET_TYPE=release'))
sh label: 'Build DAOS RPMs',
script: 'DISTRO=suse.lp156 DAOS_RELVAL="' + env.DAOS_RELVAL +
'" utils/build/build_packages.sh daos'
Comment on lines +917 to +918

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
script: 'DISTRO=suse.lp156 DAOS_RELVAL="' + env.DAOS_RELVAL +
'" utils/build/build_packages.sh daos'
script: "DISTRO=suse.lp156 DAOS_RELVAL='${env.DAOS_RELVAL}'" +
' utils/build/build_packages.sh daos'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

}
}
post {
Expand Down
9 changes: 0 additions & 9 deletions ci/rpm/build_deps.sh

This file was deleted.

15 changes: 4 additions & 11 deletions ci/rpm/build_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@ if [ -e "${ci_envs}" ]; then
source "${ci_envs}"
fi

: "${TARGET:=centos9}"

: "${TARGET:=el9}"
artdir="${PWD}/artifacts/${TARGET}"
rpmdir="${PWD}/rpms"
rm -rf "$artdir"
mkdir -p "$artdir"
mkdir -p "$artdir/daos"

if [ -d /home/daos/rpms/ ]; then
if [ -d /home/daos/rpms/deps ]; then
mkdir -p "$artdir/deps"
cp /home/daos/rpms/deps/*.rpm "${artdir}/deps"
fi
cp /home/daos/rpms/daos/*.rpm "${artdir}/daos"
if [ -d "${rpmdir}" ]; then
cp -r "${rpmdir}"/* "${artdir}"
fi

createrepo "$artdir"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seem the new solution is different from the previous one. Previously createrepo was called only once. Now you call it twice: deps + daos, right? Does it make any difference down the stream?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, createrepo takes everything what is in ./rpms/.
It is called first only with rpms/deps as we do not know if we also create daos RPMs.
Next it is called for entire repo (deps+daos) replacing an old metadata with the new one.

35 changes: 0 additions & 35 deletions ci/rpm/gen_rpms.sh

This file was deleted.

35 changes: 0 additions & 35 deletions ci/rpm/install_deps.sh

This file was deleted.

63 changes: 58 additions & 5 deletions docs/dev/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,18 +336,18 @@ To build the Docker image directly from GitHub, run the following command:

```bash
$ docker build https://github.com/daos-stack/daos.git#master \
-f utils/docker/Dockerfile.el.8 -t daos
-f utils/docker/Dockerfile.el.9 -t daos
```

or from a local tree:

```bash
$ docker build . -f utils/docker/Dockerfile.el.8 -t daos
$ docker build . -f utils/docker/Dockerfile.el.9 -t daos
```

This creates a Rocky Linux 8 image, fetches the latest DAOS version from GitHub,
This creates a Rocky Linux 9 image, fetches the latest DAOS version from GitHub,
builds it, and installs it in the image.
For Ubuntu and other Linux distributions, replace Dockerfile.el.8 with
For Ubuntu and other Linux distributions, replace Dockerfile.el.9 with
Dockerfile.ubuntu or the appropriate version of interest.

### Simple Docker Setup
Expand Down Expand Up @@ -403,7 +403,7 @@ refer to the next section.
The DAOS build process now covers building RPMs for both DAOS and dependencies
specified in [`utils/build.config`](../../utils/build.config) (or those that we
build regularly with `--build-deps=yes`). The complete list of RPMs is defined
in the [`utils/rpms/build_packages.sh`](../../utils/rpms/build_packages.sh)
in the [`utils/build/build_packages.sh`](../../utils/build/build_packages.sh)
script. The RPM (and deb) build process uses
[FPM](https://fpm.readthedocs.io/en/latest/getting-started.html). Essentially,
it creates rpm packages after a DAOS build. Regardless of how that build is done,
Expand All @@ -428,3 +428,56 @@ In order to properly upgrade a 3rd party component, do all of the following:
1. Update the `utils/rpms/<component>.changelog` file to document the change and
make sure the file is referenced by the
`RPM_CHANGELOG="<component>.changelog"` variable in `utils/rpms/<component>.sh`.

## Unified DAOS Build Procedure

The scripts under [`utils/build`](../../utils/build) provide a straightforward,
Comment thread
janekmi marked this conversation as resolved.
four-step workflow from installing pre-built dependencies to producing the
final RPMs. The same workflow is used by CI, Docker image builds, and bare-host
builds; none of the scripts are Docker-specific.

For standard builds, the scripts handle the underlying `scons` details.
Advanced users can still invoke `scons` directly or pass additional options
and variables through the `build_*` scripts to produce different binary
variants.

1. **`install_deps.sh [DISTRO]`** installs pre-built dependency RPMs (e.g.
`argobots-devel`, `mercury-devel`, `libfabric-devel`) matching the versions
expected by the current tree, so that the subsequent build steps can reuse
them instead of rebuilding from source (`USE_INSTALLED=all`). `DISTRO` is
not the OS distro itself, but the standardized RPM naming suffix used by
the DAOS project's own package repos (e.g. `el9`, `suse.lp155`,
`suse.lp156`); if omitted, it's auto-detected from `/etc/os-release`.
Missing packages are reported but do not fail the script, since
dependencies can also be built from source in the next step. Set
`DAOS_DEPS_EXT_REPO` to pull in a custom RPM set published by the DAOS
project (e.g. from [packages.daos.io](https://packages.daos.io/)) as
an extra dnf-format repo, registered only for the duration of the script.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what dnf-format means in this context. And actually you adding a yum repository. So, I would go with the following.

Suggested change
an extra dnf-format repo, registered only for the duration of the script.
an extra repo, registered only for the duration of the script.


```bash
$ DAOS_DEPS_EXT_REPO=https://packages.daos.io/v2.8.0/EL9/packages/x86_64/ \
utils/build/install_deps.sh el9
```
1. **`build_deps.sh`** builds any dependency not already satisfied by
`install_deps.sh` from source, via `scons install --build-deps=only`.
1. **`build_daos.sh`** builds and installs DAOS itself with scons
(`USE_INSTALLED=all` to reuse the dependencies from the previous steps).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear from the text if it is something the user has to add themselve or is it an automatic bit?

1. **`build_packages.sh [deps|daos|all] [yes|no]`** builds dependency

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH it breaks the streamline simplicity of your solution that build_packages.sh calls verify_packages.sh. IMHO verify_packages.sh ought to be a separate step. Please consider unless it requires changes in pipeline-lib or something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be discussed. Starting from this PR, RPM verification has become an integral part of the build process. It remains a separate script for only two reasons:

  • verification will be further developed in the future
  • users still have the option to disable it during the RPM build process and run it separately

RPMs, DAOS RPMs, or both with `fpm`. The build type defaults to `all`,
and verification defaults to `yes`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only implied the second argument is about the verification of the produced packages. You may want to introduce it properly here.


RPMs are written to the `deps/` and `daos/` subdirectories under
`RPM_OUTPUT_DIR`, which defaults to `<repo_root>/rpms`. For supported RPM
distributions, the script also generates repository metadata under
Comment on lines +470 to +471

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a "RPM distribution"? I think without the "RPM" bit it is clear you mean a Linux distribution. Because you mean a Linux distribution, don't you?

Suggested change
`RPM_OUTPUT_DIR`, which defaults to `<repo_root>/rpms`. For supported RPM
distributions, the script also generates repository metadata under
`RPM_OUTPUT_DIR`, which defaults to `<repo_root>/rpms`. For supported
distributions, the script also generates repository metadata under

`<RPM_OUTPUT_DIR>/repodata`, producing a complete RPM repository.

After each nonempty package group is built, the script runs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a package group?

`verify_packages.sh`. With the default `yes` setting, validation findings
fail the build. With `no`, verification still runs, but noncritical findings
are reported as warnings. Missing tools, unsupported configurations, and
other critical setup errors remain fatal. `verify_packages.sh` can also be
invoked separately.

`DISTRO` selects the distribution suffix used in package names, such as
`el9` or `suse.lp156`. It is detected from `/etc/os-release` when unset.
Set `RPM_OUTPUT_DIR` to change the output repository location.
Comment on lines +481 to +483

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repetitions.

Suggested change
`DISTRO` selects the distribution suffix used in package names, such as
`el9` or `suse.lp156`. It is detected from `/etc/os-release` when unset.
Set `RPM_OUTPUT_DIR` to change the output repository location.

92 changes: 92 additions & 0 deletions utils/build/build_daos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash
# Copyright 2026 Hewlett Packard Enterprise Development LP
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
set -euo pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# shellcheck source=utils/build/build_utils.sh
source "${script_dir}/build_utils.sh"

usage() {
cat <<EOF
Usage: ${0##*/} [SCONS_OPTION]... [VARIABLE=VALUE]...

Build DAOS with scons, assuming the dependencies are already built.

The script always runs:

scons install --config=force --build-deps=no [defaults] "\$@"

and applies these defaults unless the same option or variable is given on the
command line:

--jobs <nproc> number of parallel jobs
USE_INSTALLED=all reuse dependencies already installed on the system
PREFIX=/opt/daos installation prefix

Options:
-c run scons -c command

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I thought command is the value of the -c argument. 😂

Suggested change
-c run scons -c command
-c run `scons -c` command

-h, --help show this help and exit

Any other argument is forwarded verbatim to scons, e.g.:

${0##*/} BUILD_TYPE=debug COMPILER=clang --jobs 8
EOF
}

check_help "$@"
check_scons

jobs_set=false
prefix_set=false
use_installed_set=false
install_set=false
build_deps_set=false
for arg in "$@"; do
case "$arg" in
-c)
scons -c
exit 0
;;
-j | --jobs )
jobs_set=true
;;
PREFIX=*)
prefix_set=true
;;
USE_INSTALLED=*)
use_installed_set=true
;;
install)
install_set=true
;;
--build-deps=*)
build_deps_set=true
;;
esac
done

SCONS_ARGS=()
if ! "$install_set"; then
SCONS_ARGS+=(install)
fi
Comment on lines +72 to +74

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of replacing install with the user-provided install?

if ! "$build_deps_set"; then
SCONS_ARGS+=(--build-deps=no )
fi
if ! "$jobs_set"; then
SCONS_ARGS+=(--jobs "$(nproc)")
fi
if ! "$use_installed_set"; then
SCONS_ARGS+=("USE_INSTALLED=all")
fi
if ! "$prefix_set"; then
SCONS_ARGS+=("PREFIX=/opt/daos")
fi
SCONS_ARGS+=("$@")

echo "Building DAOS using scons with args:"
echo "${SCONS_ARGS[*]}"

scons "${SCONS_ARGS[@]}"
Loading
Loading