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

fix issue creation #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix issue creation #7

wants to merge 1 commit into from

Conversation

fk0
Copy link

@fk0 fk0 commented Aug 8, 2022

First of all, thanks for a great tool! I'm a newcomer into Clojure world and can't really write a code, yet.
However, when I tried to use the tool and it didn't work, I did some debug and was able to make it work on my local machine.

The setup I'm using is Jira Datacenter running in docker, locally. I'm using the latest version v9.1.0#901000-sha1:5ed254e.
I found out that upon "create" two keys in request were incorrect so I fixed them.

To reproduce, just use the command below:

jirazzz create --summary "Test Summary" --description "Use jirazzz to create a bunch of issues" --project "TEST" --backlog --issue-type "Task"

Please let me know if there's any information I can provide to describe the issue and solution better.

Thanks!

Copy link
Owner

@rwstauner rwstauner left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!

Unfortunately I don't have access to Jira anymore so I no longer use this repo and can't really validate any changes.

Before accepting the changes I'd want to be sure that the change works for someone else and doesn't break things for others.
Then we'd need to update the tests so that they pass again before merging.

@@ -276,8 +276,8 @@
{:json {:fields (merge
(select-keys opts [:summary
:description])
{:project {:id (:project-id opts)}
:issuetype {:id (:type-id opts)}
{:project {:key (:project-id opts)}
Copy link
Owner

Choose a reason for hiding this comment

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

https://docs.atlassian.com/software/jira/docs/api/REST/9.1.1/#api/2/issue-createIssue

This api doc still shows that id is the parameter for the request.
It is spelled key in the response.
(These are request parameters).

{:project {:id (:project-id opts)}
:issuetype {:id (:type-id opts)}
{:project {:key (:project-id opts)}
:issuetype {:name (:type-id opts)}
Copy link
Owner

Choose a reason for hiding this comment

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

type-id is generated from get-meta:
https://github.com/rwstauner/jirazzz/blob/main/jirazzz#L209-L217

The issue-type configuration string is used to identify the correct issuetype from the meta response: https://github.com/rwstauner/jirazzz/blob/main/test/jirazzz/test_util.clj#L137-L147

If type-id was just the string from the config, it wouldn't be a map (so passing it to :name would return nil).

It's possible that at this point type-id was nil because the issue-type in the config didn't find a match in the project response.

Copy link
Owner

Choose a reason for hiding this comment

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

If for some reason createmeta isn't returning an issuetype that you want to use anyway, we could probably tweak the get-meta code to not overwrite type-id if issue-type wasn't provided. That way a type-id in the config would pass through.

From what I know about Jira, however, trying to create an issue with a type that isn't included in the createmeta response will likely be rejected anyway.

@@ -12,7 +12,7 @@
; Jira username (might be something like "flastname").
:assignee #env USER
; Type of issue to create.
:issue-type "Task"
Copy link
Owner

Choose a reason for hiding this comment

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

there is code that uses this value as issue-type: https://github.com/rwstauner/jirazzz/blob/main/jirazzz#L209-L217
so changing the spelling here without changing that code means it will never find an issue type from the createmeta response.

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.

None yet

2 participants