swingbit / jira2gitlab

Migrate Jira projects into a Gitlab instance
MIT License
20 stars 11 forks source link

Attachments not displaying #26

Open ptbuchanan21 opened 5 months ago

ptbuchanan21 commented 5 months ago

I understand your comment in this function states "The attachments need to be explicitly mentioned to be visible in Gitlab issues". Do you know where this needs to be stated? I do not see the images in my tasks I wasn't if I'd put the image in replacements or attachments. Do you how where I'd put *.pngs' to get them all?

Thank you!

https://github.com/swingbit/jira2gitlab/blob/d417b1e3fc4bba6be0c55c2fa470976cd71bebd0/jira2gitlab.py#L194

swingbit commented 5 months ago

The comment explains why the function prepares "replacements". Moving the attachments is not enough. The attachment needs to be mentioned somewhere in the Gitlab issue, otherwise it won't be visible.

You don't have to do anything manually. If there are attachments in the Jira issue, then they will be moved, and a reference to them will be added to the description of the Gitlab issue, so that they will be visible. Also, it will convert any existing reference in Jira's comments to equivalent references in the Gitlab's comment (that's why it's called replacements).

The fact that you don't see them seems actually consistent with #24. Your Jira issues don't seem to have an attachment field (hence the fix for #24), so they are not processed.

Which Jira version are you using?

I probably could help you better if I saw the structure of a Jira issue. Is there any chance you could show a Jira issue? Maybe a fake one, as long as it has an attachment?

If you can do that, you can get the issue this way (replace the variables as needed):

ISSUE_KEY=PROJ-123
JIRA_URL="https://example.spinque.com"
JIRA_API="${JIRA_URL}/rest/api/2"
JIRA_USERNAME="jira_admin"
JIRA_PASSWORD="password123"

curl -s -u ${JIRA_USERNAME}:"${JIRA_PASSWORD}" -H "Content-Type:application/json" -X GET -k "${JIRA_API}/issue/${ISSUE_KEY}?fields=*navigable,attachment,comment,worklog" > issue.json

Also, it would be useful to know the values of the variables in your jira2gitlab_config.py:

Please be careful not to include any sensitive information.

ptbuchanan21 commented 5 months ago

My Jira version is v9.0.0, I also created the dummy issue but when I try to run the curl command along with the Jira variables it is saying it can't find those commands. I can also try Postman if you think that would be beneficial to test. I've used the curl command before for testing so I'm working out why I'm unable to set these variables. Would you like for me to send you a screenshot of the dummy issue on Jira?

I also checked those two constants and I have them both set to true.

swingbit commented 5 months ago

Postman is fine, as long as you can get the json corresponding to a ticket. The screenshot is not very useful, we need all the metadata for the issue.

ptbuchanan21 commented 5 months ago

I'll get you the JSON and metadata for that dummy issue.