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

Display error message when odo dev fails on podman and clean resources #6522

Merged

Conversation

valaparthvi
Copy link
Contributor

@valaparthvi valaparthvi commented Jan 20, 2023

Signed-off-by: Parthvi Vala pvala@redhat.com

What type of PR is this:
/kind bug

What does this PR do / why we need it:
This PR ensures odo dev on podman exits with actual failure from podman and also cleans up pod if it was created.

Which issue(s) this PR fixes:

Fixes #6487

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

  1. odo init --devfile nodejs --starter nodejs-starter --name my-nodejs-app
  2. sed -i "s/registry.access.redhat.com\/ubi8\/nodejs-16:latest/adsffdfe/" devfile.yaml
  3. ODO_EXPERIMENTAL_MODE=true odo dev --platform=podman

For 6501

  1. export PODMAN_CMD=echo
  2. ODO_EXPERIMENTAL_MODE=true odo dev --platform=podman

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for odo-docusaurus-preview ready!

Name Link
🔨 Latest commit 5879bd0
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/63cf7cd22bbffa000830c7bc
😎 Deploy Preview https://deploy-preview-6522--odo-docusaurus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 20, 2023
@odo-robot
Copy link

odo-robot bot commented Jan 20, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jan 20, 2023

NoCluster Tests on commit 38ed02a finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jan 20, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jan 20, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jan 20, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jan 20, 2023

Windows Tests (OCP) on commit 38ed02a finished with errors.
View logs: TXT HTML

@valaparthvi valaparthvi requested review from rm3l and removed request for rnapoles-rh January 21, 2023 05:03
Comment on lines 86 to 88
// the last line is an empty new line; so we revert to the second last line for error
errLine := out[len(out)-2]
err = fmt.Errorf("%s: %s\n%s", err, string(exiterr.Stderr), errLine)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want to display only the last non-blank line, and not the entire content?
This seems very specific to a use-case where the error message would be in the last non-blank line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The last non-blank line points to the error. But, perhaps we can show the whole log in case of failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On a second thought, the last line (err line) usually sums up the core issue, so showing just that should be fine. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer for the first versions to display the complete output, to have the maximum of information. If we consider it is too much, we could reduce it

Comment on lines 17 to 24
compName := odocontext.GetComponentName(ctx)
appName := odocontext.GetApplication(ctx)
name, err := util.NamespaceKubernetesObject(compName, appName)
if err != nil {
return nil
}
o.deployedPod = &corev1.Pod{}
o.deployedPod.SetName(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this related to this PR? What is the problem fixed by this change?

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 case of some failures, pod is still created, this change attempts at fixing this problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to fix the problem why deployedPod is null when a Pod is actually deployed

Copy link
Contributor Author

@valaparthvi valaparthvi Jan 24, 2023

Choose a reason for hiding this comment

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

Podman creates the pod even if something is incorrect with the manifest, for e.g. non-existent image.

I've modified the code to check if the pod exists before marking it as deployed.

@valaparthvi valaparthvi changed the title Display error message when odo dev fails on podman and clean resources WIP: Display error message when odo dev fails on podman and clean resources Jan 23, 2023
@openshift-ci openshift-ci bot added 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 Jan 23, 2023
@valaparthvi valaparthvi changed the title WIP: Display error message when odo dev fails on podman and clean resources Display error message when odo dev fails on podman and clean resources Jan 23, 2023
@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 Jan 23, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jan 24, 2023
…s on error

Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jan 24, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jan 24, 2023
@feloy feloy closed this Jan 24, 2023
@feloy feloy reopened this Jan 24, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 24, 2023

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 0 Code Smells

No Coverage information No Coverage information
0.3% 0.3% Duplication

@feloy
Copy link
Contributor

feloy commented Jan 24, 2023

/override windows-integration-test/Windows-test
Flaky e2e test

@openshift-ci
Copy link

openshift-ci bot commented Jan 24, 2023

@feloy: Overrode contexts on behalf of feloy: windows-integration-test/Windows-test

In response to this:

/override windows-integration-test/Windows-test
Flaky e2e test

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.

@openshift-merge-robot openshift-merge-robot merged commit e3e8b34 into redhat-developer:main Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. 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 on podman exits in case of failure without an error message
3 participants