Hi,
You could run a script like this in the Script Console:
import com.atlassian.jira.component.ComponentAccessor
def projectManager = ComponentAccessor.getProjectManager()
def project = projectManager.getProjectObjByKey("CONFIG") // change project name here
def versionManager = ComponentAccessor.getVersionManager()
def versionList = ["CONFIG_18.01.01", "CONFIG_18.01.02", "CONFIG_18.01.03", "CONFIG_18.01.04",
"CONFIG_18.01.05", "CONFIG_18.02.01"]
for (version in versionList) {
log.debug("Now adding version " + version + " to " + project.name)
versionManager.createVersion(version, new Date(), new Date() + 7, "New version description", project.id, null)
}
For each project, you just need to change the project name on line 4. For versionList on line 7, you could just copy and paste the Fix Version/s from your Excel spreadsheet.
After running the script in my instance:
Please note the parameters used for createVersion on line 11. You will need to change the start/end date according to your specifications. See more about the createVersion method here.
This works great, however I need to have different dates for each fixed version. How would I alter it to include custom dates for each fixed version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joshua Yamdogo @ Adaptavist Thanks much.
My requirement was to create more than 400 + versions across projects so had to tweak the scripts like below. Likewise , for different patterns I did update the contents inside createVersion( ).
Now for next release (year 2019) , I only need to change 18 to 19 :)
// Script to create version pattern <Project>_18.01.00 ,
// <Project>_18.01.02 ... <Project>_18.12.05 and so on
import com.atlassian.jira.component.ComponentAccessor
def projectManager = ComponentAccessor.getProjectManager()
def versionManager = ComponentAccessor.getVersionManager()
["PROJECT1","PROJECT2","PROJECT3","PROJECT4" ].each { //Change project names here
def project = projectManager.getProjectObjByKey("${it}")
//loop to create version list
for(int i=0; i<=12; i++) {
for(int j=1; j<=5; j++) {
String secondStr ="";
String thirdStr ="";
if(i <10) {
secondStr = "0"+i;
} else {
secondStr = i;
}
if(j <10) {
thirdStr = "0"+j;
} else {
thirdStr = j;
}
versionManager.createVersion( "${it}"+"_18."+ secondStr + "." + thirdStr,null,null, "Release Description",project.id,null)
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a way to do this without a script? or can someone point me to where I can find script runner in JIRA?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lauren, this is so old but here is a link to the information on ScriptRunner - this is an add-on so "where i can find scriptrunner" would be predicated on whether you have it added on.
https://www.adaptavist.com/products/atlassian-apps/scriptrunner-for-jira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joshua Yamdogo @ Adaptavist .
I utilized your script and made some more tweaks as my requirement was to create more than 400 + versions across projects . So wrote a scripts like below and made couple of more scripts to suit different version patterns.
Now for next activity ( year 2019 release) I only needed to change 18 to 19 on line 28 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This thread is very old, but I am hoping that someone may see my question.
How to you have the Fix Version Start Date and Release Date increment with the Fix Version.
For example: We are doing Fix Versions by date. I want a 5/21/19 Fix Version to have a 5/21/19 Start Date and End Date.
I have gotten where I can have blank fields but I would like the three fields to match with the same date.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.