-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add ability to clone private git repos #376
Conversation
996509f
to
b47da88
Compare
api/v1/service/resource/resource.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
readmePath := fmt.Sprintf("%s/%s/%s/%s/README.md", clonePath, strings.ToLower(p.Kind), p.Name, p.Version) |
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.
Should we change this to
readmePath := fmt.Sprintf("%s/%s/%s/%s", catalogPath, strings.ToLower(p.Kind), p.Name, p.Version
readme := readmePath + "/README.md"
This would be more easy to read I think
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.
I don't have any strong preferences. I am fine with either
api/v1/service/resource/resource.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
yamlPath := fmt.Sprintf("%s/%s/%s/%s/%s.yaml", clonePath, strings.ToLower(p.Kind), p.Name, p.Version, p.Name) |
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.
same as above
@@ -38,6 +38,7 @@ type Catalog struct { | |||
Org string | |||
Type string | |||
URL string | |||
SshUrl string |
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.
SshUrl string | |
SSHURL string |
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.
@pratap0007 the reason why I have done it like SshUrl
so that in config.yaml we can parse the value sshUrl
api/pkg/db/migration/202202191725_add_ssh_url_column_in_catalogs_table.go
Outdated
Show resolved
Hide resolved
|
||
cloneUrl := spec.URL | ||
|
||
if spec.SSHUrl != "" { |
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.
so SSHURL will be given more priority if specified ?
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.
as of now yes. Or should we try to attempt with both the urls?
|
||
cloneUrl := spec.URL | ||
|
||
if spec.SSHUrl != "" { |
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.
how would user used their credentials for private repo?
this is just ssh url
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.
may be mounting volume at certain path 🤔 i guess
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.
? if yes?
wouldn't that work with http url?
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.
With current codebase the ability to clone private repos was there but it was incomplete - - Dockerfile for API was missing the openssh-clients - SSH URL needs to be parsed in case of private repos - Added one extra column ssh_url in catalogs table which stores the ssh url if passed - Add db-migration for the same Signed-off-by: vinamra28 <vinjain@redhat.com>
5bac797
to
c24b54a
Compare
c24b54a
to
152c83c
Compare
@vinamra28 |
152c83c
to
57e43fc
Compare
I'll raise a follow up PR for that |
615a41f
to
73b8e27
Compare
- With providing support for reading private catalogs there is a need to serve the readme and yaml as the client of Hub API will not be able to access the Readme and Yaml from the git provider directly - Clients of Hub APIs will get the copy of Readme and YAML which was there at the time catalog refresh was done. This will ensure that the same copy is made available - The endpoints will return the string content after reading the file from the repo which was cloned in the target directory Signed-off-by: vinamra28 <vinjain@redhat.com>
As of now Hub UI was fetching the readme and yaml directly from the git provider such Github, Gitlab or Bitbucket. In case of private git repos, UI was incapable of fetching the content directly as it requires authentication. To solve this two endpoints were introduced by Hub API `/readme` and `/yaml` which will do the needful. Updating UI to make API calls to the Hub server instead of git provider directly. Signed-off-by: vinamra28 <vinjain@redhat.com>
73b8e27
to
ad441bc
Compare
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lgtm |
Changes
Add ability to clone private git repos
With current codebase the ability to clone private repos was there but
it was incomplete -
Add
/readme
and/yaml
Endpointsserve the readme and yaml as the client of Hub API will not be able to
access the Readme and Yaml from the git provider directly
there at the time catalog refresh was done. This will ensure that the
same copy is made available
from the repo which was cloned in the target directory
Update UI to fetch README and YAML from Hub APIs
As of now Hub UI was fetching the readme and yaml directly from the git
provider such Github, Gitlab or Bitbucket. In case of private git repos,
UI was incapable of fetching the content directly as it requires
authentication. To solve this two endpoints were introduced by Hub API
/readme
and/yaml
which will do the needful. Updating UI to make APIcalls to the Hub server instead of git provider directly.
Signed-off-by: vinamra28 vinjain@redhat.com
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make api-check
make ui-check
See the contribution guide for more details.