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

Base git repository working #104

Merged
merged 11 commits into from
Aug 11, 2020

Conversation

somtochiama
Copy link
Member

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 9, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @somtochiama. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Jul 9, 2020
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 9, 2020
@somtochiama
Copy link
Member Author

/assign @justinsb

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2020
log.WithValues("path", name).Error(err, "error reading channel")
return nil, err
}
fmt.Println(string(b))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this looks like leftover debug code. It's OK to log with a very high verbosity (e.g. 4 or 6) instead, but I would probably just delete it - it's most valuable when you're first developing/debugging.


channel := &Channel{}
if err := yaml.Unmarshal(b, channel); err != nil {
return nil, fmt.Errorf("error parsing channel %s: %v", name, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

(If you did want to log the bytes, this could be a good place to log it - when something has gone wrong. If we were debugging this, the first thing we would ask is "what is the contents of channel?")


var filePath string
if r.subDir == "" {
filePath = fmt.Sprintf("packages/%v/%v/manifest.yaml", packageName, id)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use path.Join you can probably avoid the repetition here: https://play.golang.org/p/-XheAesp5eZ

(Note: path.Join and not filepath.Join, because even on windows we want a url-style path with forward slashes)

if err != nil{
return nil, err
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing defer file.Close() I think.

I think you can also just do ioutil.ReadFile though, which is probably easier

return nil, err
}

file, err := os.Open(repoDir + "/" + url)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: using filepath.Join is generally easier & safer when constructing paths (and here, it's a filesystem path, so you want filepath, not path!)


// checks for subdirectories
if strings.Contains(url, ".git//") {
newURL := strings.Split(url, ".git//")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: if you use strings.SplitN(url, ".git//", 2) you will only split on the first .git//, and not drop any other segments.

An alternative would be to check that newURL ends up with len(.) == 2

(urlTokens or tokens or urlComponents or components might also be a more descriptive name, as it isn't really a URL)

@justinsb
Copy link
Contributor

As there's a conflict, a few last nits that it's worth looking at before we merge

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2020
@somtochiama somtochiama requested a review from justinsb July 31, 2020 17:39
@justinsb
Copy link
Contributor

This looks great, thanks @somtochiama

/approve
/lgtm
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Aug 10, 2020
@justinsb
Copy link
Contributor

Thanks @somtochiama - tests are happy, and I'm happy :-)

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, SomtochiAma

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 3048457 into kubernetes-sigs:master Aug 11, 2020
@somtochiama somtochiama deleted the git-repository branch August 20, 2020 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants