-
Notifications
You must be signed in to change notification settings - Fork 22
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
Github Access method #36
Conversation
@Skarlso Thank you for your contribution. |
bd99448
to
d6c5c68
Compare
d6c5c68
to
b6bba92
Compare
Output for make test:
|
06c933a
to
c0863c2
Compare
) | ||
|
||
// Type is the access type of GitHub registry. | ||
const Type = "github" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use GitHub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That contradicts with other types like ociRegistry, not? If we call this GitHub
should we call the others like OCIRegistry
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially,
so far the Consumer type for OCI is also complete Camel Case, while the access method types always start with a lower case letter.
We have to decide, whether we want to stick to this or align it.
Another related problem:
The convention for labelling Matcher types is as follows:
- by default a matcher with the label of the comsumer type is used
- there are non-consumer type matchers that use lower case names to not conflict with consumer types.
So, if we decide to use lower case consumer types. we have to look for another way to distinguish them form the non consumer type matchers.
|
||
When("the commit sha is of the right length but contains invalid characters", func() { | ||
It("errors", func() { | ||
accessMethod := ocmgithub.New( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
Expect(err).To(MatchError(ContainSubstring("commit contains invalid characters for a SHA"))) | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to be complete, you could add some test passing credentials:
- create a local credentials context
- compose an oci context using this
- compose an ocm context using these
- set credentials for a consumer
- and check whether the credentials reach the downloader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Agreed, I'm actually working on that right now. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of done.
To outline the problem would take too long, but basically, the http client is buried in the github library and cannot be nicely mocked out unless I do something in the production code, which is not okay.
Even if I try setting up some RoundTrip mocks, the oauth2 will override that and ignore the base if another token provider exist.
Therefor, we only verify that the cred is being called at least and check what happens when it errors.
49ecfdd
to
265143d
Compare
265143d
to
e538d78
Compare
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #20
Special notes for your reviewer:
The following things have been changed:
github
The following manual test has been applied:
resources.yaml
Then try downloading resources with this patch using the following component descriptor:
Using the following command:
Update the github paths accordingly and set
GITHUB_TOKEN
environment property.Release note: