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

Fix GetDeployment function when Devfile SchemaVersion is less than 2.1.0 #161

Merged

Conversation

valaparthvi
Copy link
Contributor

Signed-off-by: Parthvi Vala [email protected]

What does this PR do?:

When GetDeployment is called for a Devfile schemaVersion less than 2.1.0. Currently it fails with error "top-level attributes is not supported in devfile schema version 2.0.0".

Which issue(s) this PR fixes:

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:

Use the following devfile for example:

devfile.yaml ```yaml commands: - exec: commandLine: npm install component: runtime group: isDefault: true kind: build workingDir: ${PROJECTS_ROOT} id: devbuild - exec: commandLine: npm install component: runtime group: kind: build workingDir: ${PROJECTS_ROOT} id: build - exec: commandLine: npm start component: runtime group: isDefault: true kind: run workingDir: ${PROJECTS_ROOT} id: devrun - exec: commandLine: npm start component: runtime group: kind: run workingDir: ${PROJECTS_ROOT} id: run components: - container: endpoints: - name: 3000-tcp targetPort: 3000 image: registry.access.redhat.com/ubi8/nodejs-12:1-36 memoryLimit: 1024Mi mountSources: true name: runtime metadata: language: nodejs name: vwcwtk projectType: nodejs schemaVersion: 2.0.0 starterProjects: - git: remotes: origin: https://github.com/odo-devfiles/nodejs-ex.git name: nodejs-starter ```

I reproduced this issue with odo. You can use odo dev with the Devfile and see the error.
I'll add the unit test once the changes have been approved.

@openshift-ci openshift-ci bot requested review from kim-tsao and yangcao77 January 14, 2023 10:10
Copy link
Contributor

@kim-tsao kim-tsao left a comment

Choose a reason for hiding this comment

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

The changes look good but can we update the test case coverage?

if err != nil {
return nil, err
var globalAttributes attributes.Attributes
// attributes is not supported in versions less than 2.0.0, so we skip it
Copy link
Contributor

Choose a reason for hiding this comment

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

update comment to say less than 2.0.1

@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Base: 59.52% // Head: 59.55% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (9245925) compared to base (4d107dd).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #161      +/-   ##
==========================================
+ Coverage   59.52%   59.55%   +0.03%     
==========================================
  Files          36       36              
  Lines        4225     4226       +1     
==========================================
+ Hits         2515     2517       +2     
- Misses       1561     1562       +1     
+ Partials      149      147       -2     
Impacted Files Coverage Δ
pkg/devfile/generator/generators.go 65.23% <100.00%> (+1.33%) ⬆️
pkg/devfile/generator/utils.go 89.80% <100.00%> (-0.35%) ⬇️

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.

Signed-off-by: Parthvi Vala <[email protected]>
@valaparthvi valaparthvi force-pushed the fix-GetDeployment-with-200-schema-version branch from 720cb4a to 0756f8e Compare January 17, 2023 06:55
@openshift-ci
Copy link

openshift-ci bot commented Jan 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kim-tsao, valaparthvi

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

@valaparthvi
Copy link
Contributor Author

@kim-tsao What would it take to merge this PR? I see all checks pass and it has both lgtm and approved labels.

@kim-tsao kim-tsao merged commit 0d04f79 into devfile:main Jan 18, 2023
@kim-tsao
Copy link
Contributor

@kim-tsao What would it take to merge this PR? I see all checks pass and it has both lgtm and approved labels.

@valaparthvi I realized you do not have permissions to merge this. It's merged now

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

Successfully merging this pull request may close these issues.

2 participants