Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a prefix path to TUF client #159

Merged
merged 8 commits into from
Sep 10, 2024
Merged

feat: add a prefix path to TUF client #159

merged 8 commits into from
Sep 10, 2024

Conversation

jonnystoten
Copy link
Member

This is to allow us to store new policy files in the production TUF repository under a testing delegation, and for clients to opt-in to using this testing delegation when retrieving policy from TUF.

If the prefix path is set, it is prepended to every target path on download with path.Join. For example, if the prefix path is testing and we download the target a/b, the TUF client with actually download testing/a/b.

Also get the latest testdata from tuf-dev.

@jonnystoten jonnystoten requested a review from a team as a code owner September 10, 2024 11:59
@jonnystoten jonnystoten changed the title Add a prefix path to TUF client feat: add a prefix path to TUF client Sep 10, 2024
@github-actions github-actions bot added bug Something isn't working feature labels Sep 10, 2024
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.24%. Comparing base (206b33c) to head (76a699f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
+ Coverage   68.17%   68.24%   +0.06%     
==========================================
  Files          41       41              
  Lines        2423     2428       +5     
==========================================
+ Hits         1652     1657       +5     
  Misses        495      495              
  Partials      276      276              
Flag Coverage Δ
unittests 68.24% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tuf/tuf.go Outdated Show resolved Hide resolved
policy/types.go Outdated Show resolved Hide resolved
@jonnystoten jonnystoten removed the bug Something isn't working label Sep 10, 2024
Copy link
Contributor

@kipz kipz left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@whalelines whalelines left a comment

Choose a reason for hiding this comment

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

I thought this approach did not work with tuf-on-ci?

}
}

var validPathPrefix = regexp.MustCompile("^[a-z0-9_-]*$")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var validPathPrefix = regexp.MustCompile("^[a-z0-9_-]*$")
var validPathPrefix = regexp.MustCompile("^[a-z0-9_-]+$")

It should have at least one character, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the default is empty to read from the root.

tuf/tuf.go Outdated Show resolved Hide resolved
tuf/tuf.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the bug Something isn't working label Sep 10, 2024
@jonnystoten
Copy link
Member Author

Ha, the bug label keeps getting added because the title contains fix. I'll fix the regex for this.

Screenshot 2024-09-10 at 16 32 37

@jonnystoten jonnystoten removed the bug Something isn't working label Sep 10, 2024
@jonnystoten jonnystoten merged commit c029bcf into main Sep 10, 2024
7 checks passed
@jonnystoten jonnystoten deleted the tuf-prefix-path branch September 10, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants