Skip to content

Conversation

@baum
Copy link
Collaborator

@baum baum commented Dec 5, 2025

Dockerfile.spdk: pass SPDK_GIT_COMMIT to RPM build

Issue: #1660

Pass SPDK git commit hash via build argument. In ceph-nvmeof context SPDK is used as a git submodule and the .git directory is not available in the container build context, automatic detection via git rev-parse fails. The commit hash is now provided by the parent Makefile as the SPDK_GIT_COMMIT build argument to Dockerfile.spdk.

SPDK git commit calculation and build flow:

  1. Makefile calculates: git rev-parse HEAD:spdk (submodule commit from parent repo)
  2. Exported as SPDK_GIT_COMMIT environment variable
  3. Passed via docker-compose.yaml as build arg to Dockerfile.spdk
  4. Dockerfile.spdk accepts as ARG and passes to RPM build: SPDK_GIT_COMMIT=$SPDK_GIT_COMMIT rpmbuild/rpm.sh
  5. SPDK's mk/spdk.common.mk uses it to set: COMMON_CFLAGS += -DSPDK_GIT_COMMIT=$(SPDK_GIT_COMMIT)
  6. Compiled into SPDK binaries and exposed in version info

Copy link
Collaborator

@gbregman gbregman left a comment

Choose a reason for hiding this comment

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

We already tried to use the same method with other env variables, like NVMEOF_GIT_COMMIT and it didn't work in downstream. As I said, something is different in the way containers are used in the downstream versions. The variables from the Dockerfile are not set. When you open a shell in the gateway container and display the environment you don't see all these values.

As I understand, they might have changed the way they build the downstream, we should check it again. But at least as of two weeks ago, this didn't work.

Signed-off-by: Alexander Indenbaum <aindenba@redhat.com>
@baum
Copy link
Collaborator Author

baum commented Dec 7, 2025

As I understand, they might have changed the way they build the downstream, we should check it again. But at least as of two weeks ago, this didn't work.

Thank you for looking into this, @gbregman . Rebased the PR on the current 25.09 spdk branch. To avoid any surprises or breakage downstream, let’s make sure we discuss the proposed changes with the teams/people responsible for the downstream builds before we proceed.

It might be a good idea to make spdk SHA report consistent (Issue: #1660), see current demo (unsecured) Display logs https://github.com/ceph/ceph-nvmeof/actions/runs/20001536464/job/57357871175:

nvmeof-1    | [07-Dec-2025 08:44:52] INFO config.py:118 (1): SPDK Git commit: b13321d7fa0a8266ed92f015b054083187b49152
...
nvmeof-1    | [07-Dec-2025 08:44:52] INFO config.py:128 (1): SPDK_GIT_COMMIT: b13321d7fa0a8266ed92f015b054083187b49152
...
nvmeof-1    | [2025-12-07 08:44:56.342329] Starting SPDK v25.09 git sha1 7b53b7d88a4aa2286b41627585282f32e438639b / DPDK 25.07.0 initialization...

Using the change above this inconsistency is resolved.

...
nvmeof-1    | [07-Dec-2025 09:45:43] INFO config.py:118 (1): SPDK Git commit: ba92355563a53273c2bc3ea0b6c735eb0da838dc
...
nvmeof-1    | [07-Dec-2025 09:45:43] INFO config.py:128 (1): SPDK_GIT_COMMIT: ba92355563a53273c2bc3ea0b6c735eb0da838dc
...
nvmeof-1    | [2025-12-07 09:45:47.651172] Starting SPDK v25.09 git sha1 ba92355563a53273c2bc3ea0b6c735eb0da838dc / DPDK 25.07.0 initialization...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

2 participants