Skip to content

fix: adds if block to match revision with remote branches - #320

Merged
san-zrl merged 4 commits into
cbomkit:mainfrom
OpsMx:fix-branch
Jan 16, 2026
Merged

san-zrl merged 4 commits into
cbomkit:mainfrom
OpsMx:fix-branch

Conversation

@re-Tick

@re-Tick re-Tick commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@re-Tick
re-Tick requested a review from a team as a code owner January 14, 2026 07:36
Signed-off-by: re-Tick <[email protected]>
@re-Tick

re-Tick commented Jan 14, 2026

Copy link
Copy Markdown
Contributor Author

issue: #319

@san-zrl san-zrl 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.

Hi @re-Tick - Thank you for your interest in cbomkit and for submitting this PR. Before accepting it I have some questions on your suggested changes:

  1. CBOMkit also accepts package urls i(e.g., pkg:github/mastercard/client-encryption-java@1b27c1d) as github repo urls. This this case the revision is the commit id which is not a branch. The setBranch method is also called when cloning repos specified in this form. Did you test if your code still runs with package urls?
  2. Why did you change the location of the cbomkit backend docker image to docker.io/library/cbomkit:${CBOMKIT_VERSION}?

@re-Tick

re-Tick commented Jan 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @san-zrl — pushed a small fix in the PR. Summary and rationale below.

What I found

  • pkg:github/mastercard/client-encryption-java@1b27c1d succeeded because it hit the if (commit != null) path (exact commit present).

  • pkg:maven/io.quarkus/[email protected] succeeded because the GitHub repo contains a branch/tag named 3.18.1 (no v prefix).

  • pkg:maven/aws.sdk.kotlin/[email protected] failed because the github repository uses the tag v1.5.120 — calling .setBranch(revision.value()) with 1.5.120 does not match v1.5.120, so clone/checkout failed.

What I changed

Replaced the strict .setBranch(revision.value()) with logic that uses .getAllRefs() and added an if block to compare revision with the base of refs path (stripping refs/heads/* and refs/remotes/* prefixes) to have an option to pass the branch name from programs without having to add ref/remotes.

Effect: branch lookups now succeed, whether the ref is refs/heads/<name> or refs/remotes/<remote>/<name> without requiring callers to supply the refs/... or refs/remotes/origin/.... in branch

@re-Tick

re-Tick commented Jan 15, 2026 •

Copy link
Copy Markdown
Contributor Author

And reverted Dockerfile and makefile changes

@re-Tick
re-Tick requested a review from san-zrl January 15, 2026 16:13
@re-Tick re-Tick changed the title fix: adds setbranch to clone git repo fix: adds if block to match revision with remote branches Jan 15, 2026
@san-zrl

san-zrl commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for the updates! I will look into them and come back to you asap.

@san-zrl san-zrl 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.

Hi @re-Tick - Works as expected. Thanks a lot for your contribution to CBOMkit!

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.

2 participants