Skip to content

Let container tests clone the repo under rootful Docker - #869

Open
rkennke wants to merge 1 commit into
mainfrom
fix/container-tests-docker-safe-directory
Open

rkennke wants to merge 1 commit into
mainfrom
fix/container-tests-docker-safe-directory

Conversation

@rkennke

@rkennke rkennke commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Effect: ./utils/run-containers-tests.sh --container=docker works in its default clone mode with a rootful Docker daemon. Before, every cell failed at the clone step with exit 128, before anything was built.

What does this PR do?:
Clone mode mounts the repo read-only at /source and runs git clone file:///source /workspace inside the container. Under rootful Docker, root in the container doesn't own the host repo, and git refuses to clone it:

fatal: detected dubious ownership in repository at '/source/.git'

The clone command now runs git config --global --add safe.directory /source/.git first. The exception covers only that path, in a container that is discarded after the run. Rootless podman (the default runtime) maps the user's UID, so it never hit this, and nothing changes for it.

Motivation:
Hit on an x64 Linux dev VM with rootful Docker: all seven cells of a test matrix failed at the clone.

Additional Notes:

  • Passing -c safe.directory=… to git clone isn't enough with the glibc image's git 2.34.1 (tested), hence the global config entry.
  • --mount mode needs no change: the only git calls in the build come from utils/compute-version.sh, which already passes -c safe.directory.
  • Not called from CI: nothing in .gitlab-ci.yml, .gitlab/ or .github/ invokes this script.

How to test the change?:

  • bash -n utils/run-containers-tests.sh
  • Rootful Docker, both images: git clone file:///source fails without the entry and succeeds with it (java-profiler-test:glibc-jdk21-x64 with git 2.34.1, java-profiler-test:musl-jdk21-x64 with git 2.47.3).
  • End to end: ./utils/run-containers-tests.sh --container=docker --libc=glibc --arch=x64 --jdk=21 --config=debug --gtest-task=xorshift_ut clones, builds and passes (BUILD SUCCESSFUL); before the change it exited 128 at the clone.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a security review (run the dd:platform-security-review
    skill, or file a request via the PSEC review form).
    bewaire also runs automatically on every PR.
  • This PR doesn't touch any of that.
  • JIRA: [JIRA-XXXX]

🤖 Generated with Claude Code

With a rootful runtime the container's root doesn't own the mounted host
repo, so git refuses to clone file:///source ("detected dubious
ownership") and every clone-mode run exits 128 before building. Trust
exactly /source/.git in the throwaway container before cloning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rkennke
rkennke requested a review from a team as a code owner October 16, 2026 12:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T12:44:21.888442Z 591a886 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

The Git trust entry covers /source/.git before cloning in both shell and test modes and remains confined to the disposable container. Rootful Docker execution was not independently rerun.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 591a886

@dd-octo-sts

dd-octo-sts Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #38902416169 | Commit: 595d009 | Duration: 21m 9s (longest job)

✅ All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - ✅ - -
8-ibm - ✅ - -
8-j9 ✅ ✅ - -
8-librca - - ✅ ✅
8-orcl - ✅ - -
11 - ✅ - -
11-j9 ✅ ✅ - -
11-librca - - ✅ ✅
17 ✅ ✅ - -
17-graal ✅ ✅ - -
17-j9 ✅ ✅ - -
17-librca - - ✅ ✅
21 ✅ ✅ - -
21-graal ✅ ✅ - -
21-librca - - ✅ ✅
25 ✅ ✅ - -
25-graal ✅ ✅ - -
25-librca - - ✅ ✅

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-10-16 13:07:31 UTC

@dd-octo-sts

dd-octo-sts Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

✅ All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 591a8862

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant