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

PR Harmony does not work with Script Runner plugin #40

Open
stoleas opened this issue Apr 5, 2016 · 5 comments
Open

PR Harmony does not work with Script Runner plugin #40

stoleas opened this issue Apr 5, 2016 · 5 comments

Comments

@stoleas
Copy link

stoleas commented Apr 5, 2016

Hi there's an issue in Bitbucket 4.3.2 where there is added Default Users and Required Users, however when you go to open a pull request the user list shows up briefly before disappearing the reviewers do not get populated at all by default.

2016-04-05 09_44_08-pr harmony configuration - stash engineering - dev1
2016-04-05 09_44_56-create pull request sandbox _ edquail-test - stash engineering - dev1

@monitorjbl
Copy link
Owner

I'm not able to replicate this using version 4.3.0 or 4.3.2. Can you paste the console output from your browser when you try to open a PR? I suspect there's something weird going on either with another plugin or your environment.

@stoleas
Copy link
Author

stoleas commented Apr 9, 2016

Hi monotorjbl, your speculation is correct. I disabled another plugin we recently installed called Script Runner from Adaptavist. https://marketplace.atlassian.com/plugins/com.onresolve.stash.groovy.groovyrunner/server/overview

Will upload the console output with the Script Runner plugin enabled. If it's not a simple fix or could impact your user base I can open a defect with the vendor.

POST https://bitbucket-dev1/bitbucket/rest/build-status/latest/commits/stats

200 OK
    69ms  
batch.j...e=en-US (line 29)
HeadersPostResponseJSONCookies

{}

[PR Harmony]: Fetching PR Harmony configuration for SAND/test-test
batch.j...e=en-US (line 242)
GET https://bitbucket-dev1/bitbucket/rest/pr-harmony/1.0/users/SAND/test-test

200 OK
    85ms  
batch.j...e=en-US (line 29)
HeadersResponseJSONCookies

{"requiredReviews":1,"requiredReviewers":[{"slug":"user1","name":"user1 (user1)"},{"slug"
:"user2","name":"user2 (user2)"}],"defaultReviewers":[{"slug":"user1","name":"user1
 (user1)"},{"slug":"user2","name":"user2 (user2)"}]}

GET https://bitbucket-dev1/bitbucket/rest/s...orkzonetest&toRepoId=91&to=refs%2Fheads%2Fmaster

200 OK
    312ms 
batch.j...e=en-US (line 29)
ParamsHeadersResponseJSONCookies

{"mandatory":[],"suggested":[]}

[PR Harmony]: Loaded config Object { requiredReviews=1,  requiredReviewers=[2],  defaultReviewers=[2]}
batch.j...e=en-US (line 242)
[PR Harmony]: Adding user "user1" to reviewer list
batch.j...e=en-US (line 242)
[PR Harmony]: Adding user "user2" to reviewer list
batch.j...e=en-US (line 242)
[PR Harmony]: Enabling submit buttonConnection to localhost closed.

@monitorjbl
Copy link
Owner

This is a paid plugin, so I'm going to have a hard time debugging this in the future. However, I installed the free trial (I only get 30 days, and I can't re-up as it's bound to my Atlassian account) and it looks like it's entirely on the ScriptRunner side.

I set a breakpoint in the Select2 plugin that Atlassian uses to render the users select box and watched for all updates to it. Most of them come from PR Harmony but right after my plugin completes and loads the users, the stash-auto-reviewers.js file overwrites the contents of that box with its own set of blank reviewers. I'd wager that any plugin which attempts to set users in this way is going to be incompatible with PR Harmony. There's not a lot to be done if two different plugins both decide to update that box independently. One has to win, and it would appear that in this case ScriptRunner wins.

There's not a link to source code that I've seen, so I made a quick Gist of the client-side Javascript code that's causing the issue: https://gist.github.com/monitorjbl/1e5660860c2fc9e4d1ea4393ef83756f#file-stash-auto-reviewers-js-L38. Anyone can download the trial and see this in their browser for free, so hopefully pasting that bit of Javascript doesn't get me into trouble 😓

@stoleas
Copy link
Author

stoleas commented Apr 19, 2016

I've provided Adaptavist your suggestion and code blurb, they've opened a bug on their side for this. https://productsupport.adaptavist.com/browse/SRBITB-113

@monitorjbl monitorjbl changed the title Default/Required users setup but not making it to pull request creation PR Harmony does not work with Script Runner Apr 24, 2016
@monitorjbl monitorjbl changed the title PR Harmony does not work with Script Runner PR Harmony does not work with Script Runner plugin Apr 24, 2016
@carlmot
Copy link

carlmot commented Apr 10, 2017

Any update on whether this was fixed? Cannot access the issue at Adaptavist support.

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

No branches or pull requests

3 participants