Very easy with ScriptRunner, just execute this script in the Script Console.

Don’t forgive to configure the date limit to archive (it depends of the release date)!


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.VersionManager

VersionManager versionManager = ComponentAccessor.getVersionManager()

List<VersionManager> versions=versionManager.getAllVersions() as List

//versionManager.archiveVersion(versionManager.getVersion(651326), true);
//return "To test just archiving one release";

def resultado = "";
for ( int i = 0; i < versions.size() ; i++)
{
def release_date = versions[i].getReleaseDate();
def archived = versions[i].isArchived();
if (!archived && release_date.toString() <= '2016-01-01') {
resultado+= i + " " +versions[i].getProject() + " " + versions[i].getId() + " " +versions[i].getName() + " " + release_date.toString() + "\n";
versionManager.archiveVersion(versions[i], true);
//return resultado; //To stop at first archived release (testing)
}
}
return resultado;

If you see useful, you can configure it in a scheduled Service!

Very useful in large Organizations!

Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s