8

Is there a way in teamcity to restore a deleted build configuration. I found Restore just deleted project which is about restoring a deleted project but can't find any information about restoring a deleted build configuration. I am using Teamcity 8.0.6

Mohammad Nadeem
  • 8,364
  • 11
  • 51
  • 79

3 Answers3

4

TeamCity 9, locate your data directory and you'll find a trash folder, like so:

D:\TeamCity\Data\config\_trash

Take a copy of the whole thing to some other folder, just in case.

Move the effected project folders from config\_trash to config\projects.

Remove the suffixed .projectNN from each project folder.

You may see critical errors in the main web portal while this is happening.

Restart TeamCity just for good measure.

Suffixes

Luke Puplett
  • 36,042
  • 37
  • 161
  • 231
  • Note: since this mess-up, I enabled storing config in Git which took all of 3 minutes to setup and is well-recommended. – Luke Puplett Sep 23 '16 at 09:01
  • I accidentally deleted a whole project and its build configurations, and this is exactly what I did to recover it; I found that the project didn't reappear until I had restarted the service, so I suspect it's a mandatory step rather than a "just for good measure". – David Keaveny Apr 24 '17 at 06:47
2

The previous versions of build configuration setting are stored in /config/projects/buildTypes folder in different *.xml.N files. To restore setting replace *.xml file with *.xml.N file. Also since TeamCity 9 it is possible to store all project setting in VCS.

Alina Mishina
  • 3,140
  • 2
  • 19
  • 31
  • 1
    This will probably help in restoring the changed settings. I don't think it keeps files for deleted build configurations. All xml files related to a build are deleted as soon as we delete the build configuration. – Mohammad Nadeem Jul 02 '15 at 07:35
  • 1
    You are right. It is not possible to restore deleted build configuration. We have the related request https://youtrack.jetbrains.com/issue/TW-34774, please vote. However [Version Settings](https://confluence.jetbrains.com/display/TCD9/Storing+Project+Settings+in+Version+Control) feature is present to solve this problem. – Alina Mishina Jul 02 '15 at 14:29
  • Already voted there. Apart from version settings, we can restore it from a backup as well. The back up one will work in Teamcity 8 as well. – Mohammad Nadeem Jul 02 '15 at 17:23
  • We were just able to do this with TC9. Deleted build configurations are stored for 24 hours according to their documentation (https://confluence.jetbrains.com/display/TCD9/How+To...#HowTo...-RestoreJustDeletedProject), although we have some really old ones--maybe the TTL for trashes can be changed. You can restore by going to /config/_trash and moving the .projectN directory back to /config/projects and removing the `.projectN` part. – sixstringtheory Jul 08 '15 at 14:11
  • @ sixstringtheory Not talking about restoring Projects. I am talking about Build Configurations. – Mohammad Nadeem Jul 28 '15 at 15:43
0

Another option, available since 9.0 is to place project settings in version control (Git, Mercurial, or Subversion and Perforce since 9.1), and then restore removed files using VCS commands.

Pavel Sher
  • 2,141
  • 13
  • 14