Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner CopyProject script does not work properly

Christos Moysiadis
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 Champions.
September 17, 2019
Thread executorThread = new Thread(new Runnable() {
void run() {
def copyProject = new CopyProject()
def inputs = [
(CopyProject.FIELD_SOURCE_PROJECT) : "PR1",
(CopyProject.FIELD_TARGET_PROJECT) : "TEST",
(CopyProject.FIELD_TARGET_PROJECT_NAME) : "TST",
(CopyProject.FIELD_COPY_ISSUES) : true,
(CopyProject.FIELD_COPY_VERSIONS) : true,
(CopyProject.FIELD_COPY_COMPONENTS) : true,
(CopyProject.FIELD_COPY_DASH_AND_FILTERS) : false
]
def errorCollection = copyProject.doValidate(inputs, false)
if(errorCollection.hasAnyErrors()) {
log.error("Couldn't create project: $errorCollection")
}
else {
def util = ComponentAccessor.getUserUtil()
def adminsGroup = util.getGroupObject("jira-administrators")
assert adminsGroup // must have jira-administrators group defined
def admins = util.getAllUsersInGroups([adminsGroup])
assert admins // must have at least one admin
ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(util.getUserByName(admins.first().name))
copyProject.doScript(inputs)

}
}
})
executorThread.start()

So i have a requirement lately about giving the ability to a limited group of users to copy a template project with the use of this script. Of course there are some more extensions behind it but they are not necessary to mention them currently. 

The current script can copy the project with the name and key correctly. Also the versions and the Components are copied too. I am straggling to find out why it doesn't copy the issues (Yes! the source project has iss.ues in it :P ). 

The jira-administrators group has 2 users . A default defined admin which i have from the install process which has all the permissions.

Jira instance is a pure fresh installed 8.3.2 version (i don't know if this creates the current problem.)

Any ideas my fellow Atlassians & Scriptrunner friends ???? Any workarounds maybe?

Regards

CM

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.11
TAGS
AUG Leaders

Atlassian Community Events