Conversation
entities/buildinfo.go
Outdated
| // PRIORITY 2: If SHA1 doesn't match, check by artifact name | ||
| // This handles non-deterministic/asymmetric package managers (Maven WAR, Docker images with timestamps) | ||
| // where rebuilding produces different checksums but represents the same logical artifact | ||
| if !exists && mergeArtifact.Name != "" { |
There was a problem hiding this comment.
isnt !exists redundant since whenever it is set to true immediately it is set to break. WDYT?
There was a problem hiding this comment.
I think without !exists, we'd always check by name, even after finding a SHA1 match, which would cause incorrect double-merging.
entities/buildinfo.go
Outdated
| } | ||
|
|
||
| // Similarly for OriginalDeploymentRepo | ||
| if merged.OriginalDeploymentRepo == "" && artifact1.OriginalDeploymentRepo != "" { |
There was a problem hiding this comment.
is this mixing information between 2 different objects? If yes we should only pick either one of them instead copying data from one to another object same goes to path as well.
7ac525e to
0cfabe7
Compare
entities/buildinfo.go
Outdated
| // PRIORITY 1: Check SHA1 first - if checksums match, artifacts are identical | ||
| // This works for deterministic/symmetric package managers (Go, NPM with lockfiles, etc.) | ||
| // where the same input always produces the same output checksum | ||
| if mergeArtifact.Sha1 != "" { |
There was a problem hiding this comment.
isn't it concerning that sha1 is not present?
should we atleast warn?
can we identify those scenarios where this fields will be empty?
There was a problem hiding this comment.
Good point, we have added a WARN, Thanks!
0cfabe7 to
dc6552e
Compare
dc6552e to
a23e652
Compare
a23e652 to
b2f8b64
Compare
b2f8b64 to
587ba5a
Compare
587ba5a to
d19fbb3
Compare
9d76cc0 to
d179107
Compare
Fix Maven SNAPSHOT artifact duplicate entries in build info
Problem
When running
jf mvn installfollowed byjf mvn deploywith the same build name/number, Maven SNAPSHOT artifacts (especially WARs) appeared as duplicates in build info, causing Release Bundle v2 creation to fail:Root Cause
mergeArtifacts()compared artifacts only by SHA1. Maven SNAPSHOT WARs get new SHA1s on each rebuild (timestamps, bundled dependencies), so the merge logic treated them as different artifacts.Solution
Updated
mergeArtifacts()with a two-priority strategy:Priority 1: SHA1 Match → Skip
Priority 2: Name + Path Match → Replace
JFROG_CLI_MERGE_BUILD_INFO_ARTIFACTS_BY_NAMEenv var (default: enabled)isSameLogicalArtifact()confirms same directory/repo → replace with newer artifactNo Match → Add as New
New Functions
isSameLogicalArtifact(existing, new)extractPathDir(path)Disable name-based merging (SHA1 only)
export JFROG_CLI_MERGE_BUILD_INFO_ARTIFACTS_BY_NAME=FALSE