Once the project has been created - is there any way I can copy the configuration of an existing pro

Priyanka January 28, 2020

Hello,

 

Once the project has been created - is there any way I can copy the configuration of an existing project to the one that has been created(the new one)? I am working on v8.5.1

Is there any plugin available or can it be done by any default feature available except for using Shared project Configuration?

Regards

Priyanka

1 answer

0 votes
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2020

Hi @Priyanka,

ScriptRunner plugin provides "Copy Project" option during new project creation. it works just like as Shared project configuration along with that you can copy Board, releases, component/s, etc...

If you want to copy schemes after creation, you can write custom groovy script to update them

 

BR,

Leo 

Priyanka January 29, 2020

Hello @Leo 

Thank you for your reply but the issue is that we already have a template and the project is created using this template from backend, so we can not touch it. Once the project is created we need to configure it manually or rather copy the configuration from one project to another. how can this be avoided?

 

Regards

Priyanka

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 29, 2020

Hi @Priyanka,

I recently did a small script to change Permission scheme, if you modify that script to modify other schemes too, you can achieve your requirement

Hope this gives you some idea 

import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.AssigneeTypes
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.util.SimpleErrorCollection
import com.atlassian.jira.mail.Email
import com.atlassian.mail.server.SMTPMailServer

//Input needs here
def projects = ["LTP","LT","LEET"] // Projects Keys list to change schemes
String permission = "Permission Scheme" //Update permission scheme available in the current server

def errorCollection = new SimpleErrorCollection();
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def leadkey = currentUser.getKey()

def permissionScheme = null
try{
permissionScheme = ComponentAccessor.getPermissionSchemeManager().getSchemeObject(permission)
}catch(Exception e){
log.debug(e)
preData = "Invalid Permission Scheme to Move further on Archival"
}

if(permissionScheme){
projects.each{ pro ->
def project = null
try{
project = ComponentAccessor.getProjectManager().getProjectObjByKey(pro)
}catch(Exception e){
log.debug(e)
}
if(project){
//Removing current scheme to avoid some technical issuses
ComponentAccessor.getPermissionSchemeManager().removeSchemesFromProject(project)

//Mapping permission scheme
ComponentAccessor.getPermissionSchemeManager().addSchemeToProject(project, permissionScheme)
log.info("Updated details successfully $project.key")
}
}
}

 

 You can run this script in Script Console or if you want to automate this process for project creation event listener would be best choice 

 

BR,

Leo

Priyanka January 29, 2020

hello @Leo 

Thankyou for your detailed answer. I really appreciate it, but I am afraid I can not use it as we do not have a script runner plugin. Can you advice?

 

Regards

Priyanka Khare

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 29, 2020

Maybe you can search in marketplace to find similar apps, as per my knowledge you can't do that with native system

Suggest an answer

Log in or Sign up to answer