Skip to content

XRAY-139364 - Automatically set VSC properties from local git on uploaded artifacts#484

Open
attiasas wants to merge 10 commits into
jfrog:mainfrom
attiasas:local_git_detection
Open

XRAY-139364 - Automatically set VSC properties from local git on uploaded artifacts#484
attiasas wants to merge 10 commits into
jfrog:mainfrom
attiasas:local_git_detection

Conversation

@attiasas

@attiasas attiasas commented Jun 7, 2026

Copy link
Copy Markdown

feat(artifactory): attach local git VCS properties to published artifacts (XRAY-139364)

Following:

Summary

Extends artifact VCS property collection beyond CI environment variables. When CI VCS props are missing or incomplete, the CLI now discovers local git metadata (vcs.url, vcs.revision, vcs.branch) from the working directory and attaches it to artifacts during upload/publish flows. User-provided properties still take precedence over both CI and local git values.

Changes

  • Core VCS utilities (artifactory/utils/civcs/):
    • Add local git discovery via upstream .git search
    • Add MergeWithUserProps and SetCIVcsPropsToConfig with precedence: user props > CI props > local git props
    • Refactor VCS property keys to shared constants; add DeriveSearchDirFromFileSpec for path pattern resolution
  • artifactory/utils/vcs.go: Add FindDotGit to locate a git repo root from a given directory
  • Publish/upload commands wired to local VCS fallback

@attiasas attiasas changed the title Local git detection XRAY-139364 - Automatically set VSC properties from local git on uploaded artifacts Jun 7, 2026
@reshmifrog reshmifrog added improvement Automatically generated release notes safe to test Approve running integration tests on a pull request labels Jun 10, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Jun 10, 2026

func DeriveSearchDirFromFileSpec(pattern string, isRegexp bool) string {
if isRegexp {
return "."

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 does this mean , root directory i'm guessing?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Assume root looks like:
/a/b
/c

Let's break it down to components:
/ -> root
/a -> in (a)
. -> THIS dir path
/a/./ -> still in /a
/a/./b -> in /a/b
.. -> go "up" one level
/a/./b/.. -> /a/b/.. -> /a
/a/./b/../.. -> /a/.. -> /
/a/./b/../../c -> /c

So every directory has an implicit '.' directory that refers to itself, and an implicit '..' directory that refers to its parent.

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

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants