Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

allow .devfile.yaml #5138

Merged
openshift-merge-robot merged 6 commits into
redhat-developer:mainfrom
anandrkskd:dev/allow-.devfile
Oct 25, 2021
Merged

allow .devfile.yaml #5138
openshift-merge-robot merged 6 commits into
redhat-developer:mainfrom
anandrkskd:dev/allow-.devfile

Conversation

@anandrkskd
Copy link
Copy Markdown
Contributor

@anandrkskd anandrkskd commented Oct 12, 2021

Signed-off-by: anandrkskd anandrkskd@gmail.com

What type of PR is this?
/kind feature

What does this PR do / why we need it:

This PR adds a feature with which we can use .devfile.yaml without adding --devfile flag.
With this PR in, odo will prefer devfile.yaml and if not present will use .devfile.yaml if .devfile.yaml exists.

Which issue(s) this PR fixes:

Fixes #3126

PR acceptance criteria:

How to test changes / Special notes to the reviewer:
Simplest way to check if .devfile.yaml is used without using --devfile flag

git clone https://github.com/openshift/nodejs-ex && cd nodejs-ex

odo create nodejs 

mv devfile.yaml .devfile.yaml

odo push

@openshift-ci openshift-ci Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. labels Oct 12, 2021
@netlify
Copy link
Copy Markdown

netlify Bot commented Oct 12, 2021

✔️ Deploy Preview for odo-docusaurus-preview ready!

🔨 Explore the source changes: 801451f

🔍 Inspect the deploy log: https://app.netlify.com/sites/odo-docusaurus-preview/deploys/617637b00131ac00073d0f62

😎 Browse the preview: https://deploy-preview-5138--odo-docusaurus-preview.netlify.app

@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Oct 12, 2021
@anandrkskd
Copy link
Copy Markdown
Contributor Author

@dharmit, @feloy can you give early PR review?
The feature is working, all left for this PR is adding test and cleaning up the code.

@anandrkskd anandrkskd changed the title [WIP] allow .devfile.yaml allow .devfile.yaml Oct 13, 2021
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Oct 13, 2021
@feloy
Copy link
Copy Markdown
Contributor

feloy commented Oct 13, 2021

@anandrkskd , I can see this error:

odo create nodejs
mv devfile.yaml .devfile.yaml
odo describe
 ✗  open /[...]/devfile.yaml: no such file or directory

In this case, it should be able to find the .devfile.yaml

Comment on lines +15 to +19
for _, devFile := range possibleDevfileNames {
if util.CheckPathExists(filepath.Join(contexDir, devFile)) {
return devFile
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens if both the possible devfiles are present? Shouldn't we raise an error in that case? Which devfile gets precedence in case both are present?
And, would it help to sort the possibleDevfileNames before iterating over it? Can we ensure that every iteration on possibleDevfileNames follows the same order?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • We discussed this point with Anand. He first wanted to raise an error if both files were present, I campaigned for not doing this, so we can have a more generic function, trying to find the file in a >2 number of different names (imagine we want to also check for the yml extension...). But the discussion is open...

  • An array is ordered and will always be iterated in the same order. The maps are not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we set a preference key for the user to determine their default devfile? I remember Gerald asked(on the channel) if he could use devfile-v2.yaml as his default devfile without using --devfile flag.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can we set a preference key for the user to determine their default devfile

We can do that, but I think it's a different feature than what this PR adds to odo.
I think we can have a different issue for adding that feature to odo.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, it should be a separate issue which requires its own discussion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we set a preference key for the user to determine their default devfile? I remember Gerald asked(on the channel) if he could use devfile-v2.yaml as his default devfile without using --devfile flag.

I don't think that uses should be allowed to change default devfile. If they want to use something else then devfile.yaml or .devfile.yaml they can do and should use --devfile flag. Gerald's use case was specific and the only reason he needed this was to work around the fact that odo supports v2 but che doesn't

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Based on the discussion above, I am okay with not raising an error, but I would prefer that we log the devfile that we are going to use.

@valaparthvi
Copy link
Copy Markdown
Contributor

@anandrkskd Can you resolve merge conflicts here?

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Oct 18, 2021
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Oct 18, 2021
@feloy
Copy link
Copy Markdown
Contributor

feloy commented Oct 20, 2021

I have updated the tests to rename the devfile.yaml to .devfile.yaml just after odo create to check that all tests are still passing:

feloy#8

We probably don't want to keep these tests as is, as using .devfile.yaml is a minor behaviour and we don't want to miss errors when devfile is not renamed, and it would cost too much time to run all tests with both names.

/approve

@valaparthvi I let you lgtm when it is ok for you

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Oct 20, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feloy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Oct 20, 2021
@feloy
Copy link
Copy Markdown
Contributor

feloy commented Oct 20, 2021

@anandrkskd It would be nice to have a more complete test with a .devfile.yaml file, covering the most important odo commands

@valaparthvi valaparthvi added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Oct 21, 2021
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Oct 25, 2021
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Oct 25, 2021
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
3.9% 3.9% Duplication

@anandrkskd
Copy link
Copy Markdown
Contributor Author

It would be nice to have a more complete test with a .devfile.yaml file, covering the most important odo commands

@feloy do you mean testcases covering service/link scenarios using .devfile.yaml ?

@dharmit
Copy link
Copy Markdown
Member

dharmit commented Oct 25, 2021

/lgtm

@anandrkskd can you open a new issue for the tests as we discussed?

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Oct 25, 2021
@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@anandrkskd
Copy link
Copy Markdown
Contributor Author

can you open a new issue for the tests as we discussed?

Issue created for tests at #5167

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

11 similar comments
@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@anandrkskd
Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-bot
Copy link
Copy Markdown

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit a9998bf into redhat-developer:main Oct 25, 2021
@anandrkskd anandrkskd deleted the dev/allow-.devfile branch October 13, 2022 11:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow .devfile.yaml

7 participants