-
Notifications
You must be signed in to change notification settings - Fork 244
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 Dev and Project labeling / refactoring labeling and annotations #5551
Add Dev and Project labeling / refactoring labeling and annotations #5551
Conversation
✔️ Deploy Preview for odo-docusaurus-preview canceled. 🔨 Explore the source changes: 6e42019 🔍 Inspect the deploy log: https://app.netlify.com/sites/odo-docusaurus-preview/deploys/6231e96af8aa1f0007ed8fbe |
@cdrage: The label(s) 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. |
<!-- Thank you for opening a PR! Here are some things you need to know before submitting: 1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines 2. Label this PR accordingly with the '/kind' line 3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests 4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline Documentation: If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing --> **What type of PR is this:** <!-- Add one of the following kinds: /kind bug /kind tests /kind documentation Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well. --> /kind feature /kind cleanup **What does this PR do / why we need it:** In this PR we: * Correctly name all the labels in a more concise manner (ex. Project Type is an annotation) * Add Dev and Deploy mode labels to both `odo dev` and `odo deploy` commands so that we can intuitively retrieve what components are in deploy or dev mode * Somewhat refactors how we do labeling **Which issue(s) this PR fixes:** <!-- Specifying the issue will automatically close it when this PR is merged --> 1/2 of PR's for redhat-developer#5405 **PR acceptance criteria:** - [X] Unit test - [X] Integration test - [X] Documentation **How to test changes / Special notes to the reviewer:** N/A Signed-off-by: Charlie Drage <charlie@charliedrage.com>
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 note that this PR does not fix #5546, that's ok for me (I prefer that it is fixed as part of another PR)
@cdrage Can you try to get this PR in as soon as possible? I think it will be helpful for the odo delete PR that I am working on. |
You will need to run
|
pkg/component/labels/labels.go
Outdated
// ComponentDeployLabel ... | ||
const ComponentDeployLabel = "Deploy" | ||
// ComponentUnknownLabel is the label that is used to display something we do not know | ||
const ComponentUnknownLabel = "<unknown>" |
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.
This is not used anywhere.
pkg/component/labels/labels.go
Outdated
const ComponentDeployName = "Deploy" | ||
|
||
// ComponentNoneName ... | ||
const ComponentNoneName = "None" |
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.
This is not used anywhere.
pkg/component/component.go
Outdated
@@ -413,13 +415,14 @@ func getRemoteComponentMetadata(client kclient.ClientInterface, componentName st | |||
// Annotations | |||
component.Annotations = fromCluster.GetAnnotations() | |||
|
|||
// Mark the component status as pushed | |||
component.Status.State = componentlabels.ComponentPushedName |
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.
This should probably use StateTypePushed
from types.go
pkg/component/labels/labels.go
Outdated
const ComponentNoneName = "None" | ||
|
||
// ComponentPushedName ... | ||
const ComponentPushedName = "Pushed" |
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.
This is not used as a label or its value it should not be in this file.
Similar constant is already defined in pkg/component/types.go
"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" | ||
"github.com/devfile/api/v2/pkg/devfile" | ||
"github.com/devfile/library/pkg/devfile/parser" | ||
parsercommon "github.com/devfile/library/pkg/devfile/parser/data/v2/common" | ||
dfutil "github.com/devfile/library/pkg/util" | ||
|
||
applabels "github.com/redhat-developer/odo/pkg/application/labels" |
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.
can we keep the import grouping as it were?
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
// Since `odo deploy` can theoretically deploy a deployment as well with the same instance name | ||
// we make sure that we are retrieving the deployment with the Dev mode, NOT Deploy. | ||
selectorLabels := componentlabels.GetLabels(a.ComponentName, a.AppName, false) | ||
selectorLabels[componentlabels.OdoModeLabel] = componentlabels.ComponentDevName |
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.
wouldn't it be better to include OdoModeLabel
in componentlabels.GetLabels
?
It will be safer and it it will be automatically used everywhere where it is needed.
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 think so unless there is a refactor with the GetLabels and how we do it elsewhere (it'd break odo push
tests).
I did think of your solution, but found I was changing WAYYY too many places where the GetLabels code is. Especially in parts of the code where you would have to modify multiple functions just to pass in "Dev" or "Deploy" from the pkg/cli
layer.
@cdrage I'm no longer blocked on this, so take your time. |
/retest |
…labels Signed-off-by: Charlie Drage <charlie@charliedrage.com>
Kudos, SonarCloud Quality Gate passed!
|
/retest
|
/retest
|
/test v4.9-integration-e2e |
/lgtm |
@@ -254,7 +266,7 @@ func (a Adapter) Push(parameters common.PushParameters) (err error) { | |||
|
|||
a.deployment, err = a.Client.WaitForDeploymentRollout(a.deployment.Name) | |||
if err != nil { | |||
return errors.Wrap(err, "error while waiting for deployment rollout") | |||
return errors.Wrapf(err, "Failed to update config to component deployed.") |
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.
There's a separate PR for removing the occurrences of errors.Wrapf
, but wherever you are modifying things, can you make sure to use fmt.Errorf
? Otherwise, I think, we will end up having errors.Wrapf
occurrences if that PR goes in before yours.
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.
@feloy WDYT? I see you already lgtm
'd this PR. Since you are working on the other PR, I am OK by adding LGTM back to this PR if you would prefer this one to go in first.
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.
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.
/lgtm
/approve |
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…edhat-developer#5551) * Add Dev and Project labeling / refactoring labeling and annotations <!-- Thank you for opening a PR! Here are some things you need to know before submitting: 1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines 2. Label this PR accordingly with the '/kind' line 3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests 4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline Documentation: If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing --> **What type of PR is this:** <!-- Add one of the following kinds: /kind bug /kind tests /kind documentation Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well. --> /kind feature /kind cleanup **What does this PR do / why we need it:** In this PR we: * Correctly name all the labels in a more concise manner (ex. Project Type is an annotation) * Add Dev and Deploy mode labels to both `odo dev` and `odo deploy` commands so that we can intuitively retrieve what components are in deploy or dev mode * Somewhat refactors how we do labeling **Which issue(s) this PR fixes:** <!-- Specifying the issue will automatically close it when this PR is merged --> 1/2 of PR's for redhat-developer#5405 **PR acceptance criteria:** - [X] Unit test - [X] Integration test - [X] Documentation **How to test changes / Special notes to the reviewer:** N/A Signed-off-by: Charlie Drage <charlie@charliedrage.com> * Review update / renaming Signed-off-by: Charlie Drage <charlie@charliedrage.com> * Review changes. Adds tests for generateDeploymentObjectMeta. Changes labels Signed-off-by: Charlie Drage <charlie@charliedrage.com>
What type of PR is this:
/kind feature
/kind cleanup
What does this PR do / why we need it:
In this PR we:
is an annotation)
odo dev
andodo deploy
commands so that we can intuitively retrieve what components are in
deploy or dev mode
Which issue(s) this PR fixes:
1/2 of PR's for #5405
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer:
N/A
Signed-off-by: Charlie Drage charlie@charliedrage.com