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

parsing devfile downloads resource files #139

Merged
merged 7 commits into from
Sep 20, 2022
Merged

Conversation

mike-hoang
Copy link
Contributor

@mike-hoang mike-hoang commented Aug 16, 2022

Signed-off-by: Michael Hoang mhoang@redhat.com

What does this PR do?:

Downloads all resources files from a stack to the local root folder if it doesn’t already exist (will not overwrite files).

The resource files will only be downloaded in the following cases:

# with a valid registry url and id
parent:
  id: nodejs
  registryUrl: https://registry.devfile.io
# with a raw GitHub file link that points to a devfile
parent:
  uri: https://raw.githubusercontent.com/devfile/registry/main/stacks/nodejs/devfile.yaml
# with a relative path
parent:
  uri: ./parent/devfile.yaml

Which issue(s) this PR fixes:

fixes devfile/api#46

PR acceptance criteria:

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Open new test/doc issues under the devfile/api repo
  • Check each criteria if:
  • There is a separate tracking issue. Add the issue link under the criteria
    or
  • test/doc updates are made as part of this PR
  • If unchecked, explain why it's not needed

How to test changes / Special notes to the reviewer:

Signed-off-by: Michael Hoang <mhoang@redhat.com>
Signed-off-by: Michael Hoang <mhoang@redhat.com>
Copy link
Collaborator

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

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

This PR only handles stacks from registry. what about parent reference from a URL? or from a local path (absolute/relative URI)?

pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

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

add more comments, so other prople will have better understanding of the code for future maintenance.

pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
Signed-off-by: Michael Hoang <mhoang@redhat.com>
@codecov-commenter
Copy link

Codecov Report

Base: 57.67% // Head: 57.72% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (6391190) compared to base (053629a).
Patch coverage: 52.09% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #139      +/-   ##
==========================================
+ Coverage   57.67%   57.72%   +0.05%     
==========================================
  Files          35       35              
  Lines        3794     3960     +166     
==========================================
+ Hits         2188     2286      +98     
- Misses       1485     1537      +52     
- Partials      121      137      +16     
Impacted Files Coverage Δ
pkg/devfile/parser/parse.go 51.00% <28.57%> (-2.64%) ⬇️
pkg/util/util.go 39.25% <66.34%> (+4.69%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mike-hoang mike-hoang marked this pull request as ready for review September 19, 2022 17:23
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/util/util_test.go Outdated Show resolved Hide resolved
pkg/util/util_test.go Outdated Show resolved Hide resolved
pkg/util/util_test.go Outdated Show resolved Hide resolved
pkg/util/util_test.go Show resolved Hide resolved
pkg/util/util_test.go Show resolved Hide resolved
@mike-hoang mike-hoang changed the title parsing devfile downloads stack files parsing devfile downloads resource files Sep 20, 2022
Signed-off-by: Michael Hoang <mhoang@redhat.com>
Copy link
Collaborator

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

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

look good to me. thanks for the change

@openshift-ci openshift-ci bot added the lgtm label Sep 20, 2022
@openshift-ci
Copy link

openshift-ci bot commented Sep 20, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mike-hoang, yangcao77

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants