-
Notifications
You must be signed in to change notification settings - Fork 355
SRE-3893 build: Consolidate build scripts #19016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| * | ||
| !src | ||
| !deps | ||
| !utils/build | ||
| !utils/build.config | ||
| !utils/certs | ||
| !utils/ci | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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' | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can it actually fail?
Suggested change
|
||||||||||
| 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', | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 + | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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') | ||||||||||
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a funny one. 😆 What is the point?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. . |
||||||||||
| } | ||||||||||
| } | ||||||||||
| post { | ||||||||||
|
|
||||||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seem the new solution is different from the previous one. Previously
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, |
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||||||
|
|
@@ -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, | ||||||||||
|
|
@@ -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, | ||||||||||
|
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. | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what
Suggested change
|
||||||||||
|
|
||||||||||
| ```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). | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH it breaks the streamline simplicity of your solution that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
|
||||||||||
| RPMs, DAOS RPMs, or both with `fpm`. The build type defaults to `all`, | ||||||||||
| and verification defaults to `yes`. | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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>/repodata`, producing a complete RPM repository. | ||||||||||
|
|
||||||||||
| After each nonempty package group is built, the script runs | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Repetitions.
Suggested change
|
||||||||||
| 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 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initially I thought
Suggested change
|
||||||
| -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the point of replacing |
||||||
| 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[@]}" | ||||||
There was a problem hiding this comment.
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? 🤔