Automation for JIRA Export from DC and import into cloud - Error
Asked by Mano Chitra:

Hi Team,

I work on migration from JIRA DC into cloud where I did not found an automation migration path available for the plugin "Automation for JIRA" and vendor suggested to do an export from DC and import into cloud.

Doing so ended up with an error mentioned below.

Error

Error parsing provided JSON. Please ensure it was created using 'Export rules' previously. If the problem persists please contact Atlassian support! Error: IllegalStateException: Component for type ComponentTypeKey{component=ACTION, type='com.onresolve.jira.groovy.groovyrunner:execute-script-issue-action'} no longer exits.

Again from vendor the suggestion is to check with Script runner vendor as the error is related to the plugin "Script runner for JIRA".

Received a response to check an article which shows the difference between JQL functions of Script runner where there are some changes between DC and cloud the way the the scripting implemented is different too.

Does anyone came across such situation and know a work around? Looking forward for a response.


Answers:
author: Anandhi Arumugam
body: Hi [@Mano Chitra](/t5/user/viewprofilepage/user-id/5580508) Welcome to the community!

The error means that one/few of you Automation Rules have an action that executes a script written within Script Runner for Jira. Execute a Script action is available on Server/DC but not on Jira Cloud. So you will need to do 2 things to get this working.

1. Identify rules that have the Execute script action.

2. Export everything else and import

3. Find way to work on recreating the identified Automation rules using alternate methods.

Hope this helps!

comments: author: Mano Chitra
body: Hi [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

Thanks for the quick response on my query!

I would like to confirm my understanding here. I should check the automation rules which has the setup that is framed with executing a script.

If that is right. My confusion is how to exclude the particular automation rule from exporting?


author: Anandhi Arumugam
body: Hi [@Mano Chitra](/t5/user/viewprofilepage/user-id/5580508) You will not be able to select the rules you want to export. But you will be able to choose what you want to import.

If not, you can tweak the JSON file exported to remove specific rules that have the Automation rules in it.


author: Mano Chitra
body: Hi [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

Apologies for multiple questions on the same thing. I'm not that familiar with both the plugins Automation for JIRA and Script runner.

From the exported Automation rules file(JSON), I could see multiple entries like below with the key word com.onresolve... Can i go a head and remove those entries and then try to import the file in the cloud?

:\[{"id":"67736","component":"ACTION","schemaVersion":1,"type":"com.onresolve.jira.groovy.groovyrunner:execute-script-issue-action","value":{"parameters":{"note":\["update cdm management"\],"FIELD_INLINE_SCRIPT":\[""\],"FIELD_SCRIPT_FILE":\["update_cdmmanagement.groovy"\]}},"children":\[\],"conditions":\[\],"optimisedIds":\[\],"newComponent":false},

{"id":"67737","component":"ACTION","schemaVersion":1,"type":"com.onresolve.jira.groovy.groovyrunner:execute-script-issue-action","value":{"parameters":{"note":\["update bmcdma"\],"FIELD_INLINE_SCRIPT":\[""\],"FIELD_SCRIPT_FILE":\["update_bmcdma.groovy"\]}},"children":\[\],"conditions":\[\],"optimisedIds":\[\],"newComponent":false},

{"id":"67738","component":"ACTION","schemaVersion":1,"type":"com.onresolve.jira.groovy.groovyrunner:execute-script-issue-action","value":{"parameters":{"note":\["update lab cdma"\],"FIELD_INLINE_SCRIPT":\[""\],"FIELD_SCRIPT_FILE":\["update_labcdma.groovy"\]}},"children":\[\],"conditions":\[\],"optimisedIds":\[\],"newComponent":false},


author: Anandhi Arumugam
body: [@Mano Chitra](/t5/user/viewprofilepage/user-id/5580508) Yes. Please remove those. Then ensure that the JSON formatting is right before importing.


author: Mano Chitra
body: [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

Sure. I'm on that. Will provide an update immediately about the results.


author: Mano Chitra
body: [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

I removed 67 entries as mentioned in previous inputs those type of entries from the exported automation rules file(JSON).

Tried importing it and found below error.

* Error parsing provided JSON. Please ensure it was created using 'Export rules' previously. If the problem persists please contact Atlassian support! Error: MismatchedInputException: Cannot deserialize value of type \`java.util.ArrayList\<com.codebarrel.automation.api.config.ComponentConfigBean\>\` from Object value (token \`JsonToken.START_OBJECT\`) at \[Source: REDACTED (\`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION\` disabled); line: 1, column: 250486\] (through reference chain: com.codebarrel.automation.api.config.ImmutableRuleConfigExport$Json\["rules"\]-\>java.util.ArrayList\[68\]-\>com.codebarrel.automation.api.config.RuleConfigBean\["components"\])


author: Anandhi Arumugam
body: Have you tried to choose when you import? You should get a screen like in the screenshot. You should be able to choose the rules you need to import here.![Automation Rules Import.png](https://community.atlassian.com/t5/image/serverpage/image-id/344775i2A5A613A918D4F4D/image-size/large?v=v2&px=999 "Automation Rules Import.png")


author: Mano Chitra
body: [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

It restricted me at the first level when fetching the JSON file. Once that is success then only I could see that page which you mentioned in the screenshot.

I noticed few difference between DC and cloud export files of automation rules.

Below are the changes.

1) First line of the file in DC

{"rules":\[{"id":658,"clientKey":"com.codebarrel.tenant.global",

and in cloud it looks like this

{"cloud":true,"rules":\[{"id":20367468,"clientKey":"47aff0b6-d1d9-3027-8400-2fd1808d8779",

2) In all place where client key occurs the difference is updated total 144 entries made changes but I'm not sure whether the client key should be the one which i entered. Just got the client key from the export file of the same cloud instance where i'm trying to import the rules.


author: Anandhi Arumugam
body: [@Mano Chitra](/t5/user/viewprofilepage/user-id/5580508) The client key and ids will be different to what you have on DC vs Cloud. This is because the Automation rules are created new here. What is the issue when you try the import?


author: Mano Chitra
body: [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

Yeah I agree client keys will be different between sites but I have no idea to identify the right one for my case.

When I modified the JSON file some how with client key and tried importing. This is the error. Also the error is same when I tried importing the JSON file after removing the rules related to script runner and before modifying the client key.

* Error parsing provided JSON. Please ensure it was created using 'Export rules' previously. If the problem persists please contact Atlassian support! Error: MismatchedInputException: Cannot deserialize value of type \`java.util.ArrayList\<com.codebarrel.automation.api.config.ComponentConfigBean\>\` from Object value (token \`JsonToken.START_OBJECT\`) at \[Source: REDACTED (\`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION\` disabled); line: 1, column: 251051\] (through reference chain: com.codebarrel.automation.api.config.ImmutableRuleConfigExport$Json\["rules"\]-\>java.util.ArrayList\[68\]-\>com.codebarrel.automation.api.config.RuleConfigBean\["components"\])


author: Anandhi Arumugam
body: Try to import the unmodified file and choose the rules that you want to import. May be try a couple of rules and see if you can import without any issues?


author: Mano Chitra
body: Even unmodified file too throwed the same error.

Looks like most of the things like project id JIRA user id etc are difference between two sites of different platforms. I think it is better to manually create a ll automation rules in the cloud from the scratch though it is time taking task.


author: Anandhi Arumugam
body: Did you try to import only one rule? Just checking if import in general is an issue or just specific rules.


author: Mano Chitra
body: Hi [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

I tired to import only one rule but the error is

* Error parsing provided JSON. Please ensure it was created using 'Export rules' previously. If the problem persists please contact Atlassian support! Error: JsonParseException: Unexpected character ('}' (code 125)): expected a value at \[Source: REDACTED (\`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION\` disabled); line: 1, column: 314\]


Tags: automation-for-jira

data-center

jira-data-center

migration-customer-care

scriptrunner