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 dev store information about currently forwarded ports #5703

Merged

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Apr 28, 2022

What type of PR is this:

/kind feature

What does this PR do / why we need it:

See issue.

The PR updates the image used to run tests on IBM Cloud to be able to run tests as non-root user, to make a new test relying on user rights pass.

Which issue(s) this PR fixes:

Fixes #5676

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

The values for the forwarded ports are obtained through the PortWriter, from the text written by the low level port forwarder. This is because we need to get the information of the local port when we are using random ports (with --random-ports flag).

@netlify
Copy link

netlify bot commented Apr 28, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 6382aba
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/62737191b8476c0008aafa94

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Apr 28, 2022
@openshift-ci openshift-ci bot requested review from rm3l and valaparthvi April 28, 2022 14:08
@odo-robot
Copy link

odo-robot bot commented Apr 28, 2022

Unit Tests on commit f6c43f5 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 28, 2022

Windows Tests (OCP) on commit f6c43f5 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 28, 2022

Kubernetes Tests on commit f6c43f5 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 28, 2022

Validate Tests on commit f6c43f5 finished successfully.
View logs: TXT HTML

@feloy feloy force-pushed the feature-5676/odo-state-file branch 2 times, most recently from 949f06f to fce2b60 Compare April 28, 2022 20:16
@odo-robot
Copy link

odo-robot bot commented Apr 28, 2022

OpenShift Tests on commit f6c43f5 finished successfully.
View logs: TXT HTML

@feloy feloy force-pushed the feature-5676/odo-state-file branch 12 times, most recently from 882b584 to c1523ef Compare April 29, 2022 16:24
Copy link
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

Just a very first quick look. I am yet to review the other changes in this PR :)

@rm3l rm3l self-requested a review May 2, 2022 16:09
pkg/odo/cli/dev/dev.go Outdated Show resolved Hide resolved
pkg/odo/cli/dev/writer.go Outdated Show resolved Hide resolved
pkg/state/state.go Outdated Show resolved Hide resolved
tests/integration/devfile/cmd_dev_test.go Show resolved Hide resolved
@feloy feloy force-pushed the feature-5676/odo-state-file branch 3 times, most recently from 9a4d0a9 to 816ddb3 Compare May 3, 2022 14:12
.ibm/images/Dockerfile Outdated Show resolved Hide resolved
tests/integration/devfile/cmd_dev_test.go Outdated Show resolved Hide resolved
@feloy feloy force-pushed the feature-5676/odo-state-file branch 2 times, most recently from f50bff5 to fc6d6b9 Compare May 3, 2022 17:41
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label May 4, 2022
@feloy feloy force-pushed the feature-5676/odo-state-file branch from 02b56ba to 6382aba Compare May 5, 2022 06:41
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label May 5, 2022
@sonarcloud
Copy link

sonarcloud bot commented May 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

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

No Coverage information No Coverage information
0.0% 0.0% Duplication

Comment on lines +6 to +7
// SetForwardedPorts sets the forwarded ports in the state file and saves it to the file, updating the metadata
SetForwardedPorts(fwPorts []api.ForwardedPort) error
Copy link
Member

Choose a reason for hiding this comment

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

Thinking out loud - why do we want business layer to get involved with storing the state? Isn't this something that odo "CLI" is interested in doing? Maybe a different implementation using odo as library would not want to store the state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In any case, we want to create an abstraction for the state, hence this package.
For me, it is a business concern, as it is a way to be able to give to the CLI the state of the Dev session at any time. Any other CLI would be interested in getting this state.

@dharmit
Copy link
Member

dharmit commented May 5, 2022

/approve

@openshift-ci
Copy link

openshift-ci bot commented May 5, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharmit

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 May 5, 2022
@rm3l
Copy link
Member

rm3l commented May 5, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label May 5, 2022
@openshift-merge-robot openshift-merge-robot merged commit bd8e78a into redhat-developer:main May 5, 2022
cdrage pushed a commit to cdrage/odo that referenced this pull request Aug 31, 2022
…eloper#5703)

* Save state (forwarded ports + PID + timestamp) to local file and cleanup

* Integration tests

* Documentation

* Update docs/website/versioned_docs/version-3.0.0/command-reference/dev.md

Co-authored-by: Armel Soro <armel@rm3l.org>

* Fail when an error happens writing state file
In case of error during initialization, odo dev cleanup the resources

* Fix typo

* Test localPort matches a number

* Remove PID and timestamp from state + rename to devstate.json

* Run IBM cloud tests as non root

* Fix doc

* Review

* Remove reference to PID/timestamp from doc

Co-authored-by: Armel Soro <armel@rm3l.org>
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 dev - should store information about currently forwarded ports.
4 participants