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

Labels trigger Jira issue creation #265

Merged
merged 12 commits into from
Sep 28, 2023
Merged

Labels trigger Jira issue creation #265

merged 12 commits into from
Sep 28, 2023

Conversation

nedbat
Copy link
Contributor

@nedbat nedbat commented Sep 27, 2023

This has the basic functionality, except:

  • The project is hardcoded to "TODO"
  • I think we need an environment variable for where to find jira-info.yaml, so that staging and production can differ.
  • There's no error handling if someone labels a PR "jira:bogus"

The commits are roughly partitioned into separate work, but I had to re-think some things about how the jira ticket is stashed in the comments, and I didn't go back to try to make it a straight path.

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (dd0d10d) 83.71% compared to head (b33718c) 89.45%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #265      +/-   ##
==========================================
+ Coverage   83.71%   89.45%   +5.74%     
==========================================
  Files          38       38              
  Lines        2916     2778     -138     
  Branches      306      282      -24     
==========================================
+ Hits         2441     2485      +44     
+ Misses        442      264     -178     
+ Partials       33       29       -4     
Files Coverage Δ
openedx_webhooks/__init__.py 74.60% <100.00%> (ø)
openedx_webhooks/auth.py 100.00% <100.00%> (ø)
openedx_webhooks/bot_comments.py 100.00% <100.00%> (ø)
openedx_webhooks/info.py 98.48% <100.00%> (+4.45%) ⬆️
openedx_webhooks/labels.py 100.00% <ø> (ø)
openedx_webhooks/settings.py 75.00% <100.00%> (-11.37%) ⬇️
openedx_webhooks/types.py 100.00% <100.00%> (ø)
tests/conftest.py 97.43% <100.00%> (+0.17%) ⬆️
tests/fake_github.py 96.95% <ø> (ø)
tests/fake_jira.py 91.30% <ø> (+13.42%) ⬆️
... and 16 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nedbat nedbat force-pushed the nedbat/label-for-jira branch from 22d79b5 to 6a2f954 Compare September 27, 2023 19:51
@nedbat nedbat requested a review from feanil September 27, 2023 20:41
Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

A couple of questions but generally looks good to deploy.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious about why you didn't just stick to the module namespace. That's a pattern common in Django so it was familiar. What you've done is not complicated but I'm just trying to understand what lead you in this direction? Especially once you pull the test settings into their on settings file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this when I thought we'd have parallel environment variables for Jira settings, and it was awkward to parse them and mock them. Now we aren't doing that, this does seem over-complicated. I can undo it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I think let's un-do it. You want to do that in this PR or a follow-up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

# A label of jira:xyz means we want a Jira issue in the xyz Jira.
label_names = set(lbl["name"] for lbl in pr["labels"])
desired.jira_nicks = {name.partition(":")[-1] for name in label_names if name.startswith("jira:")}

desired.jira_initial_status = "Needs Triage"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an assumption about what states are expected in any given Jira project that is added. We should probably document this somewhere. ie. "Setting up a Jira Project to work with openedx-webhooks". I'm also okay with something small in the README for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it turns out, we never use this value at the moment. We'll get issues created, and then fix up the initial status somehow. Ideally, we wouldn't have to specify the initial status, the project could just set it implicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've deleted it.

Ned Batchelder added 3 commits September 28, 2023 12:46
Full disclosure: I haven't thought hard about what rescanning should do
now, and haven't added the new label->Jira logic into the rescan tests.
@nedbat nedbat force-pushed the nedbat/label-for-jira branch from 6a2f954 to 8ebae19 Compare September 28, 2023 17:03
Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

:shipit:

@nedbat nedbat merged commit 03bc64d into master Sep 28, 2023
4 checks passed
@nedbat nedbat deleted the nedbat/label-for-jira branch September 28, 2023 18:41
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.

2 participants