How to bulk update changed confluence links in all the relevant issues?

Shriya Chhajed July 6, 2020

Hi 

We just migrated around 50-60 spaces from our Confluence server to another Confluence server as part of segregation. The original Confluence server also exists. But migrated spaces have been removed.

All these spaces are mentioned in several Jira issues. We added new application link also in New Confluence and Jira. So now from Confluence spaces accessing Jira issues is not a problem. But vice - versa is issue. From Jira, if we click on confluence page it still tries to go to older Confluence. 

Is there anyway to update Confluence url in all those Jira issues which should access new Confluence server, instead of doing all manually?

 

Thanks and Regards

Shriya Chhajed

 

 

 

2 answers

1 accepted

0 votes
Answer accepted
Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2020

Hi @Shriya Chhajed - You can use the Bob Swift Jira Command Line Interface (CLI) to do this with link actions.

There are a few steps involved which I will summarize:

  1. Get a list of all of the remote links and save it to a CSV using runFromIssueList and getRemoteLinkList.
    Example: acli --action runFromIssueList --project "My Project" --common "--action getRemoteLinkList --issue @issue@ --file myLinkList.csv --append --outputFormat 999" --server myJira.myserver.com --user "myUserName" --password "mypassword"
  2. Open the CSV and modify the URLs to point to the correct Confluence instance.
  3. Use the runFromCsv and addRemoteLink CLI action to create new links:
    Example: acli --action runFromCsv --file myLinkList.csv --common "--action addRemoteLink --server myJira.myserver.com --user 'myUserName' --password 'mypassword'"
  4. Use the runFromCsv and removeRemoteLink CLI actions to remove the incorrect links:
    Example: acli --action runFromCsv --file myLinkList.csv --common "--action removeRemoteLink --server myJira.myserver.com --user 'myUserName' --password 'mypassword'"

FYI - I'm the product manager for the Bob Swift CLI line of apps.

sanan sanan July 8, 2020

 

 I work with Shriya. 

We installed Swift Jira CLI on our test server and ran the first command for a test project and it gave us promising result in .csv file with link names which ofcourse we can find and replace with the correct links.

But we have around 60-70 projects. Do we need to run this command for each project? 

All these projects belong the same named category. Is there any parameter where instead of giving project name we can get the list based on category?

 

Regards

Sanan

sanan sanan July 8, 2020

Hi Michael

 

To test the process we successfully executed the first command you provided for a test project..

But when i give second command to import back the updated .csv file . i get error.

i give following command:

 

acli --action runFromCsv --file myLinkList.csv --common "--action addRemoteLink" --server http://vm-stapp-20:8080/ --user "sanan_admin" --password "********"

 

and get following error:

**********************

Run: --action addRemoteLink
Parameter error: This function requires a non-blank value for either url or toIssue parameters.
Client error: 1 actions failed from file: C:\Users\sanan\ACLI\myLinkList.csv

**********************

 

am i doing something wrong?

 

Regards

Sanan

Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 8, 2020

Hi @sanan sanan - I can answer both questions:

  • To perform this task for all projects at once replace the --project parameter with --jql and specify "category = 'myCategory'" for the jql.  
  • To fix the error rename the CSV columns to exactly match (including case) the parameter names you will use in the addRemoteLink action (which are "issue", "link", and "url").  The CLI should then automatically substitute the values from the CSV.
Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 8, 2020

@sanan sanan - I updated my answer above to simplify the JQL once I reread your question and saw you could use project category.

sanan sanan July 9, 2020

Hi Michael

thanks for  your quick reply. 

we will try this and update you with the result.

 

Regards

Sanan

sanan sanan July 9, 2020

Hi Michael,

You have suggested to rename the columns in .csv file to match exact names as I give in addRemoteLink action.

But I did not understand, if I rename the columns in .csv file then where would we specify the updated confluence link.

I am attaching the picture of .csv file for your reference.. at first we want to try with one project and then proceed with bulk change.

 

linkupdate.png

Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2020

To be more clear:  Rename the column headers "Issue" to "issue", "Link" to "link", and "URL" to "url".  That way the name of the column is the same as the name of the parameter.

sanan sanan July 10, 2020

Hi Michael,

sorry for the late response. i wanted to reply you with final results.

So thank you for your great help. This really helped...we finally managed to successfully test it with your plugin and commands. 

Infact, the issue was not with the column names. it was my mistake. I was opening the .csv file in excel and replacing the links and saving there which was adding some extra double quotes in every cell. After updating in normal notepad, it just worked fine and without any error.

We have got our solution.

Thanks once again. This CLI plugin is really powerful for our admin jobs. 

Regards

sanan

Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2020

Glad to help.  I'm happy it worked for you!  Our support team actively monitors Atlassian Community for CLI questions if you should need more help.

0 votes
Sachin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2020

Hello Shriya, glad you were able to migrate all your spaces to a new server. You need to run some DB queries to fix the issue you are seeing.

- Shutdown confluence
- Get your DB backup
- Follow this KB and run the below queries
- Restart confluence
- Verify if the app links are fixed

Note: below queries apply for postgres DB

select count(*) from BODYCONTENT WHERE body LIKE '%<ac:parameter ac:name="server">JIRA Source</ac:parameter>%';

UPDATE BODYCONTENT SET body = REPLACE(body, '<ac:parameter ac:name="server">JIRA Source</ac:parameter>', '<ac:parameter ac:name="server">JIRA Target </ac:parameter>') WHERE body LIKE '%<ac:parameter ac:name="server">JIRA Source </ac:parameter>%';


Best,
Sachin.

Shriya Chhajed July 6, 2020

Hi Sachin, 

 

Thank you for your response. 

The issue is vice versa. We have single Jira instance connected to two different confluence application. So new confluence points correctly to Jira, but from Jira side, the issues are pointing to old confluence links and that needs to be updated.

 

Can you please share your views on this? 

 

Thanks and Regards

Shriya Chhajed

Sachin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2020

Ah ok, did you try recreating the new app links and deleting the older one from Jira side? I do see this article here which might help you https://confluence.atlassian.com/jirakb/applinks-fail-when-copying-jira-and-confluence-to-other-environments-856843626.html but since you are not migrating to your Jira to a new environment it might be hard to make any xml changes to the entities.xml file.

Shriya Chhajed July 6, 2020

Hi Sachin, 

Yes, new application links are created and we are not deleting old ones, but we added another application link since many projects still should point to older confluence. As mentioned, only 50-60 spaces are migrated to new confluence and thus only few projects from existing Jira will be linking to this new confluence. 

 

Yes, i saw this link, but its very hard since we are not migrating Jira and using the existing one. 

Thanks and Regards

Shriya Chhajed

Suggest an answer

Log in or Sign up to answer