Trouble synching labels between Azure DevOps and JIRA server

Originally asked by Maggie Stearns on 16 October 2021 (original question)


Hi:

I am synching the labels field between Azure Devops and JIRA on premise server.
I am using the tip here: https://docs.idalko.com/exalate/display/ED/How+to+synchronize+issue+labels
on the JIRA incoming side I have this line:
issue.labels = replica.labels.collect { it.label = it.label.replace(" ", “_”); it }

This works correctly to replace spaces with underscores in a label, but it also inserts an underscore as the first character in the second and subsequent labels synching over from Azure Devops to JIRA.
For example, I have this in Azure DevOps:
Label 1 is: Mag S Tag
Label 2 is: THIRDTAG
Label 3 is: TWOTAG

JIRA gets this:
Labels 1: Mag_S_Tag
Label 2 is: _THIRDTAG
Label 3: _TWOTAG

Does anyone have a suggestion for how I can correct that line?

Thank you,

Maggie


[Failed to download attachment: attachment_37553996_ado.PNG. Error: 404 Client Error: for url: https://community.exalate.com/download/attachments/37553993/ado.PNG?version=1&modificationDate=1634405134664&api=v2]

[Failed to download attachment: attachment_37553996_jira.PNG. Error: 404 Client Error: for url: https://community.exalate.com/download/attachments/37553993/jira.PNG?version=1&modificationDate=1634405147621&api=v2]

Answer by Francis Martens (Exalate) on 17 October 2021

Try by adding trim as in

issue.labels = replica.labels.collect { it.label = it.label.trim().replace(" ", "_"); it }

Comments:

Maggie Stearns commented on 17 October 2021

Thank you! That seems to work!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.