#65 WIP: Adding more sync features from upstream repos
Merged by ralph. Opened by sidpremkumar.
sidpremkumar/sync-to-jira sync-upgrades  into  develop

Download 65.patch

Added sync features such as:
— Comment edit
— tags (labels)
— fixVersion (milestone)
— assignee
— reporter (somewhat)
— Closed/Open/Dropped status and automatic movement of JIRA issues
— users can specify what “closed” means per project. And when a project is closed upstream, and a user has opted in, the program will automatically try to transition the downstream issue to closed.
Working on both github and pagure

Do these indents match the existing comments? If not the standard is to keep it the same indentation as the """

Small thing - is there a reason for the leading spaces?

You might get push back on removeAll vs remove_all

AFAIK this should be good enough provided users are required to enter their full name here since JIRA uses full names as display names. The only issue will be if an individual decides against user their own name. In that case - I'm not sure there's much you can do

It would be a bit easier to read if you used a string format here instead - roughly this:
description = '[{0}] Upstream Reporter: {1} \n{2}\n\n{3}'.format(today.strftime("%a %b %y - %H:%M"), issue.reporter['fullname'], issue.url, description)

Also make sure that whatever time is being produced by datetime.today() is in an appropriate timezone relative to everything else

If you want to avoid 2 loops here you could take the union of these two lists as sets:
list(set(jira_labels).union(set(issue_labels)))

You might want to catch the specific error that's thrown for this use case because there's both index and key access going on. This means if one of the values doesn't have an elements in it you'll get an IndexError or if the keys are missing you'd get a KeyError and they won't mean what you expect.

same as above

This should probably be a log.warning. Is there any action to take in this case?

This should probably be a warning and you might want to catch the specific error. Could the client have a connection issue? If it's possible - it's likely worth handling that

Generally if a function does not have any args and doesn't return the comment doesn't require them

log.warning or log.error maybe?

If this is a true failure you might want to exit(1) so that the user knows something wrong happened

You might want to use a more descriptive name

Small thing - is there a reason for the leading spaces?
Yes they help with the formatting of the logs (make it look way better and was formatted like this prior to me working on the project)

This should probably be a log.warning. Is there any action to take in this case?
Not sure if there is any action to be done as the user entered an invalid fix version, but will ask around and check.

3 new commits added

  • Fixing changes proposed by @ipanzica
  • Merge branch 'sync-upgrades' of https://pagure.io/forks/sidpremkumar/sync-to-jira into sync-upgrades
  • Finished up a lot of sync issues between JIRA and Github

I'd vote to remove the verify_JIRA work from this pull request, so that we can review and merge only the new sync stuff separate from the verification stuff. This is good practice in general - make smaller, isolated changes.

This looks new to me. Where does issue.downstream['updates'] get set?

Will this change in format result in old comments being disregarded and duplicates added to all currently managed jira issues?

1 new commit added

  • Added support for legacy comments to be recognized as valid comments

This looks new to me. Where does issue.downstream['updates'] get set?

It will be set up in fedmsg.d/sync2jira.py. It will go under map, an example would be like this:
'Testing_initialization': {'project': 'FACTORY', 'component': 'gitbz', 'updates':
['comments', {'tags': {'overwrite': 'True'}}, {'fixVersion': {'overwrite': 'True'}},
'assignee', 'status']},
This gives the user the option to indicate if they want upstream repos to 'overwrite' JIRA issues.

Will this change in format result in old comments being disregarded and duplicates added to all currently managed jira issues?

Yes, this will. I have added code to ensure that duplicate comments are picked up

I'd vote to remove the verify_JIRA work from this pull request, so that we can review and merge only the new sync stuff separate from the verification stuff. This is good practice in general - make smaller, isolated changes.

I'll remove all verify_JIRA references

1 new commit added

  • Finished downstream.py test cases and minor formatting changes

1 new commit added

  • Fixed github duplicate comment bug + empty tags bug. Started work on

1 new commit added

  • Fixed legacy comment edit bug and finished test cases for downstream.py

1 new commit added

  • Finished test cases for upstream/downstream/intermediary

1 new commit added

  • Finished tox configuration and cleaned up test cases

1 new commit added

  • Fixing last bugs and updating test cases accordingly

1 new commit added

  • Finishing ReadMe and changing 'true'/'false' in config to True/False

1 new commit added

  • Fixing bool bug

1 new commit added

  • adding owner field

Hm, can you replace all this with raise TypeError("Got %s, expected Issue" % type(issue).__name__).

It is a type error, after all. Good catch.

Add more of a comment here about why priority is broken, otherwise in the future we'll be sad and confused.

Oh, this is a fedmsg config value - https://fedmsg.readthedocs.io/en/stable/configuration/#validate-signatures

Should remove this statement from your patch.

@sidpremkumar, can you remove the .idea/ folder from your patch and add .idea to the .gitignore file?

Also, please undo your changes in fedmsg.d/. I don't think those are necessary, right?

1 new commit added

  • fixing small issues

1 new commit added

  • removing idea folder

@sidpremkumar, can you remove the .idea/ folder from your patch and add .idea to the .gitignore file?
Also, please undo your changes in fedmsg.d/. I don't think those are necessary, right?

I've gone ahead and removed the .idea folder.

I've updated the fedmsg.d/sync2jira.py file to reflect the updates I've made (i.e. added a updates array in the example). I believe these are necessary but could also be seen in the updated README.md

1 new commit added

  • Updating tests to work with new parameters

1 new commit added

  • removing pdb statement

I've updated the fedmsg.d/sync2jira.py file to reflect the updates I've made (i.e. added a updates array in the example). I believe these are necessary but could also be seen in the updated README.md

Ah, I see some other unrelated updates in there. Can you prune it down to only the necessary changes?

@sidpremkumar, I guess I'm really only concerned about this line. Can you revert this one?

1 new commit added

  • reverting config file and reduced number of API calls

@sidpremkumar, I guess I'm really only concerned about this line. Can you revert this one?

Done, ATM the sync2jira & tests are not working. I had some free time today so I've been working to reduce the number of API calls. Should be working by Friday.

1 new commit added

  • reduced number of API calls dramatically and updated tests accordingly

Ack. Ok. GIve me a ping when you've got the tests working with tox and I'll give another review pass.

1 new commit added

  • final tox fixing

:-1: to this change. Please keep fedmsg.d/zz_sync2jira.py in the .gitignore.

Not sure you want to ignore fedmsg.d/sync2jira.py either.

2 new commits added

  • Merge branch 'sync-upgrades' of ssh://pagure.io/forks/sidpremkumar/sync-to-jira into sync-upgrades
  • reverting .gitignore

1 new commit added

  • reverting .gitignore

1 new commit added

  • adding correct update date

rebased onto 167d7ffd291e680ab4585bf91f06f5c77caf8991

2 new commits added

  • Add more sync features
  • Merge branch 'release/1.7'

rebased onto ffe2d222f1a1f23cfbe852efae0f4a02c95fe1de

rebased onto 167d7ffd291e680ab4585bf91f06f5c77caf8991

1 new commit added

  • Add more sync features

1 new commit added

  • removing old files

4 new commits added

  • adding files
  • Finished up a lot of sync issues between JIRA and Pagure
  • Finished up 'create_jira_issue' function
  • Merge branch 'release/1.7'

1 new commit added

  • reverting ansible changes

1 new commit added

  • reverting ansible changes 2

1 new commit added

  • reverting .gitignore

2 new commits added

  • Add more sync features
  • Merge branch 'release/1.7'

1 new commit added

  • updating update_date

2 new commits added

  • Add more sync features
  • Merge branch 'release/1.7'

1 new commit added

  • removing ansible

2 new commits added

  • Add more sync features
  • Merge branch 'release/1.7'

rebased onto ffe2d222f1a1f23cfbe852efae0f4a02c95fe1de

2 new commits added

  • Add more sync features
  • Add lots of support for pagure only

3 new commits added

  • Add more sync features
  • Finished up a lot of sync issues between JIRA and Github
  • Add lots of support for pagure only

2 new commits added

  • Add more sync features
  • Add lots of support for pagure only

rebased onto 144e1379775a67bef62aa3a99ebf133de570b13d

rebased onto 65f9647146988d99657cd5a325dfd42c3e7bd0be

rebased onto bdc449cdfe7ca6d1e173590fbc4d4c10f47eadd2

1 new commit added

  • adding legacy comment format

rebased onto 2c7cea7b2e8d2f68603f9e2bf24a1dedf236ec66

1 new commit added

  • adding update date

rebased onto 86541c015038a1c80ffaff9c60084181bc3c1573

Ha, still a typo here. :)

Can you revert this one too?

git commit --amend will alter your now nicely rebased commit.

rebased onto 936021dde415a7581bbdda15291b2772051d83c8

rebased onto 6c3c894b11b631b75bf5d41256d328cc29787e1c

Awesome. :+1:, let's merge this.

I'll monitor a deployment of it this afternoon.

@sidpremkumar, do you have rights to watch the logs of the prod instance?

Pull-Request has been merged by ralph

Metadata