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

Add jira --map-issue option #117

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Add jira --map-issue option #117

merged 1 commit into from
Nov 5, 2024

Conversation

kkaarreell
Copy link
Collaborator

Adds jira --map-issue option that enables user to map id from the issue-config file to an existing Jira issue.
For example:

newa jira --map-issue jira_epic=RHEL-12345 ...

@kkaarreell kkaarreell self-assigned this Nov 4, 2024
@kkaarreell
Copy link
Collaborator Author

@ep69
Copy link

ep69 commented Nov 5, 2024

I gave it try and it works.

What I'm not 100% sure about is how to behave when the specified mapping is wrong (user mistake):

$ snewa event --erratum 140235 jira --issue-config newa/jira.yaml --map-issue jira_task=CRYPTO-15442
11/05/2024 11:15:12 AM Using --state-dir=/var/tmp/newa/run-12
[2024-11-05 11:15:15,061] [event   ] Erratum release RHEL-10.0.GA transformed to a compose RHEL-10.0-Nightly
[2024-11-05 11:15:15,066] [event   ] Artifact job E: 140235 @ RHEL-10.0.GA written to /var/tmp/newa/run-12/event-140235-RHEL-10.0.GA.yaml
[2024-11-05 11:15:15,069] [jira    ] Discovered erratum job E: 140235 @ RHEL-10.0.GA in /var/tmp/newa/run-12/event-140235-RHEL-10.0.GA.yaml
[2024-11-05 11:15:16,020] [jira    ] Initialized Jira handler
[2024-11-05 11:15:16,020] [jira    ] Processing task_errata
[2024-11-05 11:15:20,014] [jira    ] New issue CRYPTO-15463 created

Config newa/jira/yaml contains:

project: CRYPTO
transitions:
  closed:
    - Closed.Done-Errata
  dropped:
    - Closed.Obsolete

issues:
 - summary: "Errata update - RHEL rhel-10.0 libfido2 - ER#{{ ERRATUM.id }} (r{{ ERRATUM.respin_count }})"
   description: "{{ ERRATUM.url }}\n{{ ERRATUM.components|join(' ') }}"
   assignee: '{{ ERRATUM.people_assigned_to }}'
   type: task
   id: task_errata
   on_respin: keep

User mistake is specifying jira_task on CLI vs. task_errata in config. In such a case, exit with an error might be more appropriate than creating and issue user needs to delete manually.

Copy link
Collaborator

@The-Mule The-Mule left a comment

Choose a reason for hiding this comment

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

Code-wise it looks good to me. Some user-error handling can be always added later if needed.

@kkaarreell
Copy link
Collaborator Author

Code-wise it looks good to me. Some user-error handling can be always added later if needed.

Good point, I will address this in another MR.

@kkaarreell kkaarreell merged commit 29c21ae into main Nov 5, 2024
16 checks passed
@kkaarreell kkaarreell deleted the ks_issue_map branch November 5, 2024 13:10
@kkaarreell
Copy link
Collaborator Author

Code-wise it looks good to me. Some user-error handling can be always added later if needed.

Good point, I will address this in another MR.

#118

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