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

kcidb-triage tool integration #575

Merged
merged 3 commits into from
Oct 7, 2024
Merged

kcidb-triage tool integration #575

merged 3 commits into from
Oct 7, 2024

Conversation

JenySadadia
Copy link
Collaborator

No description provided.

@JenySadadia
Copy link
Collaborator Author

@helen-fornazier The tool has been deployed on staging. Please test and let me know if it works as expected.
https://console.cloud.google.com/run/detail/us-central1/iss-ed-test-1-kcidb-iss-ed/metrics?project=kernelci-staging

@helen-fornazier
Copy link
Collaborator

@helen-fornazier The tool has been deployed on staging. Please test and let me know if it works as expected. https://console.cloud.google.com/run/detail/us-central1/iss-ed-test-1-kcidb-iss-ed/metrics?project=kernelci-staging

I get this when I try to access the url there, are you able to access it?

image

@JenySadadia
Copy link
Collaborator Author

@helen-fornazier The tool has been deployed on staging. Please test and let me know if it works as expected. https://console.cloud.google.com/run/detail/us-central1/iss-ed-test-1-kcidb-iss-ed/metrics?project=kernelci-staging

I get this when I try to access the url there, are you able to access it?

image

Please open cloud shell, fire the command gcloud beta run services proxy --project kernelci-staging iss-ed-test-1-kcidb-iss-ed --region=us-central1. That will provide you with the link you would be able to access.

@helen-fornazier
Copy link
Collaborator

helen-fornazier commented Sep 25, 2024

I think we need credentials to postgreesql

if I fill the issue part with

image

and when I click on Submit, I get this:

image

To deploy this standalone we usually need:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials.json

But since this is already on kcidb, I'm not entirely sure how this is supposed to be 🤔

maybe @spbnick could shed some light here?

@JenySadadia
Copy link
Collaborator Author

I think we need credentials to postgreesql

if I fill the issue part with

image

and when I click on Submit, I get this:

image

Let me check the error logs.

@spbnick
Copy link
Collaborator

spbnick commented Sep 25, 2024

Submission should be done via the message queue (...kcidb_new), not directly to PostgreSQL. We'll need to figure out what's up there.

@JenySadadia
Copy link
Collaborator Author

Here are the error logs:

  File "/usr/local/lib/python3.9/site-packages/kcidb/issue_editor/kcidb_triage_server.py", line 130, in submit_issue
    submission_id = client.submit(report)
  File "/usr/local/lib/python3.9/site-packages/kcidb/__init__.py", line 84, in submit
    return self.mq_publisher.publish(data)
  File "/usr/local/lib/python3.9/site-packages/kcidb/mq/__init__.py", line 110, in publish
    return self.future_publish(data).result()
  File "/usr/local/lib/python3.9/site-packages/google/cloud/pubsub_v1/publisher/futures.py", line 66, in result
    return super().result(timeout=timeout)
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.9/site-packages/google/cloud/pubsub_v1/publisher/_batch/thread.py", line 274, in _commit
    response = self._client._gapic_publish(
  File "/usr/local/lib/python3.9/site-packages/google/cloud/pubsub_v1/publisher/client.py", line 267, in _gapic_publish
    return super().publish(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/google/pubsub_v1/services/publisher/client.py", line 1067, in publish
    response = rpc(
  File "/usr/local/lib/python3.9/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/google/api_core/retry/retry_unary.py", line 293, in retry_wrapped_func
    return retry_target(
  File "/usr/local/lib/python3.9/site-packages/google/api_core/retry/retry_unary.py", line 153, in retry_target
    _retry_error_helper(
  File "/usr/local/lib/python3.9/site-packages/google/api_core/retry/retry_base.py", line 212, in _retry_error_helper
    raise final_exc from source_exc
  File "/usr/local/lib/python3.9/site-packages/google/api_core/retry/retry_unary.py", line 144, in retry_target
    result = target()
  File "/usr/local/lib/python3.9/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/google/api_core/grpc_helpers.py", line 78, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.PermissionDenied: 403 User not authorized to perform this action.

Submission is happening using message queue but it's not able to find KCIDB credentials for client.submit. How does authentication work for other cloud run services?

@spbnick
Copy link
Collaborator

spbnick commented Sep 25, 2024

Right, you're not supposed to interact between deployments and submit your issues/incidents from one deployment to another. Let alone to reach from one project into another. You need to use your deployment's submission queue. Moreover, you don't need to have a "configuration file". You can pass all the configuration you need via the service environment.

Check out run_deploy() in kcidb/cloud/run.sh. You can see examples of using environment variables. If you need anything (such as the project and topic name), pass it via environment variables. You already have project in that function, you only need to add the (deployment's) topic name. Regarding the origin, I would say it should be maestro, since only Maestro folks will be using it.

However, check with Gustavo, because an issue UI is a priority for ProFUSION now, AFAIK. Perhaps you don't even need to do this.

@JenySadadia
Copy link
Collaborator Author

Right, you're not supposed to interact between deployments and submit your issues/incidents from one deployment to another. Let alone to reach from one project into another. You need to use your deployment's submission queue.

Could you please explain how to use deployment submission queue? Looking at the documentation here, should I use kcidb_new?

Check out run_deploy() in kcidb/cloud/run.sh. You can see examples of using environment variables. If you need anything (such as the project and topic name), pass it via environment variables.

Okay, I'll make changes.

However, check with Gustavo, because an issue UI is a priority for ProFUSION now, AFAIK. Perhaps you don't even need to do this.

Thanks for bringing attention to this. I checked with @padovan and @helen-fornazier. It turns out that we need this deployment for testing purposes and ProFusion will be developing a final version.

@JenySadadia
Copy link
Collaborator Author

JenySadadia commented Sep 27, 2024

Hello @spbnick
I tried to add environment variable topic and use it with run_deploy. It seems like not working and I'm getting
None when I tried to use both the variables from the issue editor:

print("project name:", os.environ.get("project"))
print("topic name:", os.environ.get("topic"))

Here is the deployment I tried with these changes.

I'm a bit confused between env variables and command line args implementations in cloud script and maybe messed up there.
Your help will be much appreciated.

cloud Outdated Show resolved Hide resolved
cloud Outdated Show resolved Hide resolved
kcidb/cloud/run.sh Outdated Show resolved Hide resolved
@JenySadadia
Copy link
Collaborator Author

@helen-fornazier Deployment https://console.cloud.google.com/run/detail/us-central1/iss-ed-test-2-kcidb-iss-ed/metrics?cloudshell=true&project=kernelci-staging did work and I'm able to submit issues and incidents.
Please test the tool and let me know if anything's wrong.

Below are the responses I got while testing the tool:

submit_issue:
{
  "issue_id": "maestro:6ebc39b62a499a7d5941de6e98b231e5613b161d",
  "issue_version": 0,
  "submission_id": "12429416962151915"
}
submit_incident:
{
  "submission_id": "12429213719411014"
}

@spbnick How do I verify these submissions in DB/dashboard?

@spbnick
Copy link
Collaborator

spbnick commented Sep 30, 2024

@spbnick How do I verify these submissions in DB/dashboard?

In theory, each complete deployment includes an instance of Grafana set up to access the PostgreSQL database. However, due to the limited and convoluted support for deploying Grafana dashboards we only deploy an empty Grafana instance, and then we manually load it with dashboards, as necessary. However, since we're still in the transition period between our Grafana versions and different dashboards, I don't have anything that already has issue support to offer you for loading into an instance.

As such, the only thing you have now is to connect with a PostgreSQL client to you instance's database, and check manually that you get everything in, and perhaps generate notifications using the command-line tools. Otherwise we'll have to limit ourselves to reviews and tests, deploy this, see how it goes, fix any issues, and repeat.

@helen-fornazier
Copy link
Collaborator

@JenySadadia the new deployment is working, thanks!

@JenySadadia
Copy link
Collaborator Author

@spbnick As @helen-fornazier has confirmed the tool is working fine, could you please review the source code of the editor?

@JenySadadia JenySadadia requested a review from spbnick October 2, 2024 09:38
Copy link
Collaborator

@spbnick spbnick left a comment

Choose a reason for hiding this comment

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

Looks pretty good, thank you, Jeny!

I left some comments and requests inline.

kcidb/issue_editor/kcidb_triage_server.py Outdated Show resolved Hide resolved
kcidb/issue_editor/kcidb_triage_server.py Outdated Show resolved Hide resolved
kcidb/issue_editor/kcidb_triage_server.py Outdated Show resolved Hide resolved
kcidb/issue_editor/templates/index.html Outdated Show resolved Hide resolved
kcidb/issue_editor/kcidb_triage_server.py Outdated Show resolved Hide resolved
kcidb/issue_editor/templates/index.html Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@spbnick spbnick left a comment

Choose a reason for hiding this comment

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

Looks great! I have one last nitpick. Thank you, Jeny!

setup.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@spbnick spbnick left a comment

Choose a reason for hiding this comment

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

Thank you, Jeny ❤️

@JenySadadia JenySadadia merged commit 811a4ba into main Oct 7, 2024
6 checks passed
@JenySadadia JenySadadia deleted the kcidb-issue-editor branch October 7, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants