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

odo deploy command #5228

Merged

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Nov 12, 2021

/kind feature

What does this PR do / why we need it:

Which issue(s) this PR fixes:

Fixes #5151

  • odo deploy should trigger a default deploy command (group.kind: deploy.) and execute it based on how it is defined
  • during push, do not deploy components referenced in a devfile command

PR acceptance criteria:

How to test changes / Special notes to the reviewer:

@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. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation labels Nov 12, 2021
@feloy
Copy link
Contributor Author

feloy commented Nov 12, 2021

Updating devfile/api to the HEAD of main is not possible due to devfile/api#675, I updated to commit before "add annotation to container spec and add validation to it (#661)" instead

@netlify
Copy link

netlify bot commented Nov 15, 2021

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

🔨 Explore the source changes: 00d67eb

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

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

@feloy feloy requested review from dharmit and valaparthvi and removed request for mohammedzee1000 and rnapoles-rh November 15, 2021 14:10
@feloy feloy force-pushed the feature-5151/odo-deploy branch 3 times, most recently from 042d170 to 1d82d29 Compare November 17, 2021 06:59
@feloy feloy changed the title [wip] odo deploy command odo deploy command Nov 17, 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 Nov 17, 2021
@feloy
Copy link
Contributor Author

feloy commented Nov 17, 2021

Updating devfile/api to the HEAD of main is not possible due to devfile/api#675, I updated to commit before "add annotation to container spec and add validation to it (#661)" instead

This problem has been fixed in devfile/api

Copy link
Member

@dharmit dharmit left a comment

Choose a reason for hiding this comment

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

Only docs review.

docs/website/docs/command-reference/deploy.md Outdated Show resolved Hide resolved
odo can be used to deploy components in a similar manner they would be deployed by a CI/CD system,
by first building the images of the containers to deploy, then by deploying the Kubernetes resources
necessary to deploy the components.
Copy link
Member

Choose a reason for hiding this comment

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

Should we clarify here that odo deploy works only for devfiles having schemaVersion 2.2.0 or above? Or is that not accurate and odo deploy would work if it finds the required key-values even if the devfile schemaVersion was below 2.2.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is accurate. If the devfile revision is lower than 2.2.0, the devfile library will not validate the file:

 ✗  invalid devfile schema. errors :
- commands.6.composite.group.kind: commands.6.composite.group.kind must be one of the following: "build", "run", "test", "debug"

docs/website/docs/command-reference/deploy.md Outdated Show resolved Hide resolved
- a command referencing an `Image` component that, when applied, will build the image of the container to deploy,
- a command referencing a `Kubernetes` component that, when applied, will create Kubernetes resources in the cluster.

With the following example `devfile.yaml` file, a container image will be built by using the `Dockerfile` present in the directory,
Copy link
Member

Choose a reason for hiding this comment

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

IMO, having a fully functional devfile would help here. That way, we can address the point of odo deploy support for devfile 2.2.0 or higher (if we need to.)

Copy link
Contributor Author

@feloy feloy Nov 23, 2021

Choose a reason for hiding this comment

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

I would prefer not to add a complete devfile. There are a lot of mandatory parts in the devfile that won't be related to this subject, that will make a very long file and will be difficult for the reader to focus on the important parts
I added the schemaVersion to highlight that it should be >= 2.2.0

Copy link
Member

Choose a reason for hiding this comment

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

OK. Makes sense. If you think adding a link to a fully functional devfile would make sense, then you could add it. Otherwise, it's OK. We can revisit the discussion if anyone asks for such a devfile. 😄

docs/website/docs/command-reference/deploy.md Outdated Show resolved Hide resolved
Copy link
Member

@dharmit dharmit left a comment

Choose a reason for hiding this comment

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

Reviewed only the integration test to figure out how to and what to test for odo deploy.

@feloy
Copy link
Contributor Author

feloy commented Nov 23, 2021

@dharmit thanks for the review on doc, I made the changes

Copy link
Member

@dharmit dharmit left a comment

Choose a reason for hiding this comment

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

Still reviewing the code. But it's a lot of files, so not waiting till I'm done.

// RecommendedCommandName is the recommended command name
const RecommendedCommandName = "deploy"

// LoginOptions encapsulates the options for the odo command
Copy link
Member

Choose a reason for hiding this comment

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

s/LoginOptions/DeployOptions/g on this file, maybe?

return false, nil
}

// AddKubernetesComponentToDevfile adds service definition to devfile as an inlined Kubernetes component
Copy link
Member

Choose a reason for hiding this comment

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

It's no longer just service definition. You moved the code but forgot to update the comment.

return addKubernetesComponent(crd, name, componentContext, devfile, devfilefs.DefaultFs{})
}

// AddKubernetesComponent adds the crd information to a separate file and adds the uri information to a devfile component
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// AddKubernetesComponent adds the crd information to a separate file and adds the uri information to a devfile component
// addKubernetesComponent adds the crd information to a separate file and adds the uri information to a devfile component

return devfileData
}

// GetComponentsToPush returns the list of Kubernetes components to push,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// GetComponentsToPush returns the list of Kubernetes components to push,
// GetKubernetesComponentsToPush returns the list of Kubernetes components to push,

pkg/devfile/components.go Outdated Show resolved Hide resolved
@feloy feloy requested a review from dharmit November 23, 2021 15:15
@feloy
Copy link
Contributor Author

feloy commented Nov 23, 2021

/test v4.9-integration-e2e

[Fail] odo devfile registry command tests [BeforeEach] When executing registry commands with the registry is not present Should successfully add the registry 

@kadel
Copy link
Member

kadel commented Nov 23, 2021

/approve

@openshift-ci
Copy link

openshift-ci bot commented Nov 23, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kadel

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

@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 Nov 23, 2021
@sonarcloud
Copy link

sonarcloud bot commented Nov 24, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

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

No Coverage information No Coverage information
3.2% 3.2% Duplication

@feloy
Copy link
Contributor Author

feloy commented Nov 24, 2021

/test psi-kubernetes-integration-e2e

[Fail] odo link command tests for OperatorHub Operators are installed in the cluster when a component and a service are deployed when a storage is added and deployed when a link between the component and the service is created [It] should run odo push successfully 

@feloy
Copy link
Contributor Author

feloy commented Nov 24, 2021

/test psi-kubernetes-integration-e2e

[Fail] odo link command tests for OperatorHub when one component is deployed when another component is deployed [It] should link the two components successfully without service binding operator 

@@ -10,8 +10,8 @@ import (
"github.com/pkg/errors"
)

// simpleCommand is a command implementation for non-composite commands
type simpleCommand struct {
// execCommand is a command implementation for non-composite commands
Copy link
Member

Choose a reason for hiding this comment

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

Should the file be renamed to command_exec.go as well?

@dharmit
Copy link
Member

dharmit commented Nov 24, 2021

/lgtm

#5228 (comment) is not a blocker and can be done separately. However, in case you change it in this PR, can you please ask Tomas to lgtm it again if I'm not around tomorrow?

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Nov 24, 2021
@openshift-merge-robot openshift-merge-robot merged commit ac478e9 into redhat-developer:main Nov 24, 2021
anandrkskd pushed a commit to anandrkskd/odo that referenced this pull request Dec 7, 2021
* Update devfile library

* deploy cmd

* Init "odo deploy" command reference

* Integration test

* Fix odo deploy

* Filter components to apply during odo push

* Output

* Remove redondant level 1 title

* Doc review

* Use server-side apply to apply Kubernetes components

* Review

* Replace PROJECT_ROOT with PROJECTS_ROOT
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. 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.

odo deploy should trigger a default deploy command (group.kind: deploy.) and execute all the defined steps
4 participants