Can you help me evaluate Remote control and Remote events, i have followed the doc :https://scriptrunner.adaptavist.com/5.2.2/jira/remote-events.html
but i find it very complex to understand its example and use cases , can i get a better way of information to replicate its use cases on my local server ??
specially the remote events versioning code given has errors, i have no knowledge where to put the code either om local or remote server.
so can you give me more clarity to replicate what Remote Control and Remote Events can do ?
Hello,
I did not find it explicitly in the documentation but ScriptRunner must be installed on the local and remote instances. It will not work if one of the instances does not have the right version of Scriptrunner
Remote Events let you recieve events from another Atlassian application (Jira, Confluence, Bitbucket). Suppose you want to create an issue and assign it to the right person if a repostitory in bitbucket was created. You can create a remote event in Jira and link it to the repostiory created event in your Bitbucket instance. You would paste the code into your created remote event in Jira. The code would be triggered by Scriptrunner for Bitbucket when the create repository event fired in Bitbucket.
Remote Control lets you execute code in remote instances. It is just a library from Scriptrunner which you can use in your code.
Hello,
Can you please give me a reference between two JIRA servers, what Remote Control and events can do for two jira servers ??
thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
These are the links
https://scriptrunner.adaptavist.com/latest/jira/remote-events.html
https://scriptrunner.adaptavist.com/latest/jira/remote-control.html
I could not find any documentatin which would describe remote events for two Jira Servers. But you can catch any event in the remote Jira and fire your own routine. Maybe you will tell me what you need to do and I will tell you if it can be done.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
why do i get errors when i execute the "Example: Synchronize JIRA Versions" in Remote events documents page, code on my script console ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also how to achieve :
Provisioning - when a project is created in JIRA, create it also in Bitbucket and Confluence.
Synchronise JIRA versions between instances - when you create a version in one JIRA instance it appears in another
When a JIRA version is created, automatically create a page in Confluence
with Remote events ? what is the code or proedure to execute them ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is that I can not provide you with the code but I can give you a couple of hints
1. Provisioning - when a project is created in JIRA, create it also in Bitbucket and Confluence.
You do not need Remote Events here. You can create a usual listener in Jira which would fire on ProjectCreatedEvent. Then you would use REST API in your listener to create a project in Bitbucket and a page in Confluence
https://docs.atlassian.com/bitbucket-server/rest/5.7.0/bitbucket-rest.html#idm45568366071360
https://developer.atlassian.com/cloud/confluence/rest/#api-content-post
Or you could use Remote Control to create a confluence page with Confluence JAVA API and a project in Bitbucket using Bitbucket Java API.
2. Synchronise JIRA versions between instances - when you create a version in one JIRA instance it appears in another
You could make remote listeners in both Jira instances which would listen to VersionCreateEvent. Then in those listeners you would create a new version if such version does not exist in the current instance using Jira Java API.
3. When a JIRA version is created, automatically create a page in Confluence
You do not need a remote event. You could write a usual listener which would fire on VersionCreateEvent and then you could create a page in Confluence either using Confluence REST API or using remote control to create a page with Confluence Java API.
Those are an interesting tasks to accomplish but unfortunately writing the code would take too much time. Hopefully it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Alexey Matveev,
I usually get this error, "The variable [event] is undeclared" in this code. Can you please help ?
log.debug JsonOutput.prettyPrint(JsonOutput.toJson(event))
line of code taken from "Example: Synchronize JIRA Versions"
https://scriptrunner.adaptavist.com/5.2.7/jira/remote-events.html#_example_synchronize_jira_versions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you provide a screenshot with the error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This script must be in a remote listener. Are you sure that the script is there? Could you provide the whole window with the configuration?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As far as I can see from your code the line log.debug JsonOutput.prettyPrint(JsonOutput.toJson(event)) does not have errors. The error is in the if statement, could you provide the error? I think the problem is with the version property.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes exactly, error at version property :
no such property version for class com.atlassian.jira.event.issue.IssueEvent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see. It could be just a static compilation error. You can create the remote listener and then create a version and have a look if there are any errors in your log file.
Or we can wait until someone from Adaptivist will see the ticket.
Or you can make a new question with your script and the error.
Unfortunately right now I can not confirm if it is a bug or a feature.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
By the way I noticed that there is no VersionCreateEvent in your remote listener configuration. You must catch VersionCreateEvent. Kindly try to leave only VersionCreateEvent. Remote event must be VersionCreateEvent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you add to the import section
import com.atlassian.jira.event.project.VersionCreateEvent
and then the first line after the import section
def event = event as VersionCreateEvent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Allot Matveev,
I am unblocked on the previous error.
Have got another one,
no such property userStartDate (also userReleaseDate) in class:
com.atlassian.jira.project.version.Version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
change userStartDate to StartDate and userReleaseDate to ReleaseDate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks For all the help Matveev,
i have proceeded further, i have created custom listeners on both the servers, when i create a version on server2 projectA , i get error in listener in server1
2018-01-24 12:41:26,481 ERROR [runner.AbstractScriptListener]: ************************************************************************************* 2018-01-24 12:41:26,481 ERROR [runner.AbstractScriptListener]: Script function failed on event: sr.com.atlassian.jira.event.project.VersionCreateEvent, script: com.onresolve.scriptrunner.canned.jira.workflow.listeners.JiraRemoteCustomListener java.lang.NoClassDefFoundError: groovy/lang/GroovyObject at Script162.run(Script162.groovy:9) at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runScriptAndGetContext(ScriptRunnerImpl.groovy:155) at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source) at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source) at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runStringAsScript(ScriptRunnerImpl.groovy:143) at com.onresolve.scriptrunner.runner.ScriptRunner$runStringAsScript$6.call(Unknown Source) at com.onresolve.scriptrunner.runner.ScriptRunner$runStringAsScript$6.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.workflow.listeners.CustomListener.doScript(CustomListener.groovy:120) at com.onresolve.scriptrunner.canned.jira.workflow.listeners.JiraRemoteCustomListener.super$2$doScript(JiraRemoteCustomListener.groovy) at com.onresolve.scriptrunner.canned.jira.workflow.listeners.JiraRemoteCustomListener.doScript(JiraRemoteCustomListener.groovy:28) Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject ... 10 more
Have named "Project A" as the name of the Project in both servers, also have kept notice of ProjectID and provided same KEY's in the code , how to move further to create a version in local instance ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks For all the help Matveev,
i have proceeded further, i have created custom listeners on both the servers, when i create a version on server2 projectA , i get error in listener in server1
Have named "Project A" as the name of the Project in both servers, also have kept notice of ProjectID and provided same KEY's in the code , how to move further to create a version in local instance ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To tell you the truth I have no idea about the error:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@shaik zubeer did you fix this problem, I'm getting the same one with ProjectCreatedEvent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.