Skip to content

fix(hrr): do not disable git ownership for the version stamp - #14342

Merged
danielbolsson merged 3 commits into
developfrom
users/danielbolsson/hrr-version-stamp-ownership
Oct 28, 2026
Merged

danielbolsson merged 3 commits into
developfrom
users/danielbolsson/hrr-version-stamp-ownership

Conversation

@danielbolsson

@danielbolsson danielbolsson commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

JIRA ID : AIRUNTIME-3091

Summary

  • The version stamp wrote a temporary git config with safe.directory = * and pointed GIT_CONFIG_GLOBAL at it.
  • Git then trusts every directory, including a repository planted above a source tree the build user does not own, and will run that repository's commands as the builder.
  • The stamp no longer disables the ownership check. A checkout the builder does not own reports unknown.

Test plan

  • python3 projects/hrr/tests/scripts/test_version_stamp.py: an owned checkout still stamps a revision; with GIT_TEST_ASSUME_DIFFERENT_OWNER=1 the stamp reports unknown (fails on develop's stamp)

Issue Tracking

JIRA ID : AIRUNTIME-3091

The stamp wrote a git config that trusted every directory, so a tree
the build user does not own could run that repository's commands.
Leave the ownership check on and report unknown when git refuses.

Signed-off-by: Daniel Olsson <Daniel.Olsson@amd.com>
@danielbolsson
danielbolsson requested a review from a team as a code owner October 27, 2026 10:00
Copilot AI balanced review requested due to automatic review settings October 27, 2026 10:00

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@therock-pr-bot

therock-pr-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@andraghetti andraghetti left a comment

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.

Checked on gbt350: a parent repo with core.fsmonitor runs its command through develop's stamp and not through this one. The MI350 gate matches develop apart from the generated-file drift that #14241 fixed after this branch's base.

…p check by behaviour

AIRUNTIME-3091. _out_dir and file(MAKE_DIRECTORY) only served the removed
gitconfig; file(WRITE) creates the missing parent itself. The test now runs
the stamp with GIT_TEST_ASSUME_DIFFERENT_OWNER=1 and expects unknown, which
fails on develop's stamp, and drops the assertion on the header that passed
there too.
@danielbolsson
danielbolsson merged commit a356769 into develop Oct 28, 2026
78 of 80 checks passed
@danielbolsson
danielbolsson deleted the users/danielbolsson/hrr-version-stamp-ownership branch October 28, 2026 12:23
ywang103-amd pushed a commit that referenced this pull request Oct 28, 2026
JIRA ID : AIRUNTIME-3091

## Summary
- The version stamp wrote a temporary git config with `safe.directory =
*` and pointed `GIT_CONFIG_GLOBAL` at it.
- Git then trusts every directory, including a repository planted above
a source tree the build user does not own, and will run that
repository's commands as the builder.
- The stamp no longer disables the ownership check. A checkout the
builder does not own reports `unknown`.

## Test plan
- [x] `python3 projects/hrr/tests/scripts/test_version_stamp.py`: an
owned checkout still stamps a revision; with
`GIT_TEST_ASSUME_DIFFERENT_OWNER=1` the stamp reports `unknown` (fails
on develop's stamp)

## Issue Tracking

JIRA ID : AIRUNTIME-3091

---------

Signed-off-by: Daniel Olsson <Daniel.Olsson@amd.com>
@andraghetti andraghetti mentioned this pull request Oct 28, 2026
1 task done
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

danielbolsson added a commit that referenced this pull request Oct 29, 2026
…heck (#14458)

JIRA ID : AIRUNTIME-3091

## Motivation
`test_checkout_owned_by_someone_else_reports_unknown` (added by #14342)
fails in the `HRR script tests` job on #13256 (run 40687541194): the
stamp reports a revision, not `unknown`. That job is not a container
job; it runs on a hosted ubuntu-24.04 runner with git 2.56.0 as user
`runner`. Git there trusts every directory (a `safe.directory = *` in
its system/global config), so `GIT_TEST_ASSUME_DIFFERENT_OWNER=1` has no
effect and reading the revision is correct. The test only means
something where git enforces the ownership check.

## Technical Details
`projects/hrr/tests/scripts/test_version_stamp.py`: probe git once at
import, in the checkout the stamp reads (not a throwaway repo, so a
checkout trusted through `safe.directory` in the user's git config also
skips), with the same environment the test uses. If git does not refuse
the repository, `unittest.skipUnless` skips the ownership test. Where
git does enforce the check the test is unchanged and still fails against
a stamp that bypasses it. The env setup moves into a shared `git_env()`
helper.

## Issue Tracking
JIRA ID : AIRUNTIME-3091

## Test Plan
- `python3 -m unittest test_version_stamp` with a normal git (test runs,
passes).
- Same with `HOME` pointing at a `~/.gitconfig` holding `safe.directory
= *` (test skipped, owned-repo test passes).
- Negative control: add `-c safe.directory=*` to the stamp's `git
rev-parse` and run with a normal git (test fails).

## Test Result
- Normal git 2.43.0: 2 run, OK. `unittest discover` over
`projects/hrr/tests/scripts`: 152 tests OK.
- `safe.directory = *` in HOME gitconfig: OK (skipped=1).
- Negative control: FAILED (failures=1); change reverted.

## Submission Checklist
- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#provide-pull-request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants