Restoring TeamCity build history

Hi,

Thinking that I was being safer doing it this way, I copied a build config to a new project rather than moving it.
I then deleted the original build config. I didn't think this through enough and now realize that I have lost the
build history for the config. If cleanup has not happened yet, is there a way to restore the build history to the
new copy of the build config?

Thanks,
-Dave

12 comments
Comment actions Permalink

Hello Dave,

  To ensure that deleted build configuration data won't be deleted during cleanup, you should execute the following database query:

  DELETE FROM deleted_build_types WHERE BUILD_TYPE_ID = 'bt456'

  and replace bt456 with buildTypeId of the original build configuration.

  To restore the history of the original build configuration in the copy, you should change ID of the moved build configuration to the ID of the original build configuration.
  This can be done only with manual editing of the project-config.xml file of the target project.

  To restore artifacts, you should also move Build Configuration artifacts directory from old Project directory to new one under $TCDATA/artifacts folder.

  Hope this helps,
  KIR

0
Comment actions Permalink

Hi Kir,

Unfortunately, I received your response too late to stop cleanup from deleting the old configs' build history.
I have more build configs to "move". So, I will try your steps when I do.

I created the following issues about this:


-Dave
0
Comment actions Permalink

Hi Kir,

This worked but in a slightly different manner and order than you listed. This is what I did to move a
build config from one project to another keeping history & artifacts intact:

Preliminary steps:
For each build config to move:
1) Write down the original BT ID.
2) Write down the build # in the counter.
3) Turn off building automatically.
4) Turn off automatic cleanup.

Steps:
1) Copy the build config from the original project to the new project.
    Make note of the new build config BT ID.
2) Delete the original build config.
3) Edit: $teamcity.data.path/config/<new-project>/project-config.xml
    Change the BT ID to the original one.
4) Make a new subdir for the artifacts in $teamcity.data.path/system/artifacts/<new-project>
    with exactly the same name as the copied build config.
5) Change directories to: $teamcity.data.path/system/artifacts/<new-project>/<copied-build-config>
    Copy everything from the original build artifacts location to the new artifacts location.
6) Go to projects in the TeamCity UI.
    The new build config should now have all history/artifacts restored.
7) Set the build # in the new build config to the # in the Preliminary steps #2 above.

Post-change steps:
1) Query the TeamCity database (MySQL in my case): select * from teamcity.deleted_build_types;
    You should see the new BT ID listed (not the old one).
2) Run cleanup through TeamCity.
3) Run the above database query. The table should now be empty.
4) Run a build of the new build config to make sure it works and to make sure the build sequence is right.

This was tedious since I had to do it about a dozen times. But, it did work. If you don't run the cleanup, you
might get display errors - which I did for guest users.

Anyway, I look forward to the move build config capability. Thanks for the tip on how to do this.

-Dave

0
Comment actions Permalink

Actually, now I have a big problem. ever since doing the changes above, all non-admin users get the following exception when trying to access artifacts of the moved build configs.

This has been reported in:  http://jetbrains.net/tracker/issue/TW-7006

This is the exception that displays in the TeamCity UI for the moved build configs:

Unexpected Error

Error message: javax.servlet.jsp.JspException:  javax.el.ELException: Error reading 'associatedBuild' on type  jetbrains.buildServer.serverSide.impl.BuildPromotionImpl

Show stacktrace
javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.el.ELException: Error reading 'associatedBuild' on type jetbrains.buildServer.serverSide.impl.BuildPromotionImpl
at org.apache.jsp.buildTypeStatusDiv_jsp$Helper.invoke(buildTypeStatusDiv_jsp.java:1088)
at org.apache.jsp.tag.web.refreshable_tag.doTag(refreshable_tag.java:108)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspx_meth_bs_005frefreshable_005f0(buildTypeStatusDiv_jsp.java:669)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspService(buildTypeStatusDiv_jsp.java:292)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jsp.viewType_jsp$Helper.invoke28(viewType_jsp.java:1846)
at org.apache.jsp.viewType_jsp$Helper.invoke(viewType_jsp.java:2034)
at org.apache.jsp.tag.web.refreshable_tag.doTag(refreshable_tag.java:108)
at org.apache.jsp.viewType_jsp$Helper.invoke21(viewType_jsp.java:1731)
at org.apache.jsp.viewType_jsp$Helper.invoke(viewType_jsp.java:2013)
at org.apache.jsp.tag.web.page_tag.doTag(page_tag.java:525)
at org.apache.jsp.viewType_jsp._jspService(viewType_jsp.java:219)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:252)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1173)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:453)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at jetbrains.spring.web.TeamCityDispatcherServlet.service(TeamCityDispatcherServlet.java:14)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter(ResponseFragmentFilter.java:3)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.servlet.jsp.JspException: javax.el.ELException: Error reading 'associatedBuild' on type jetbrains.buildServer.serverSide.impl.BuildPromotionImpl
at org.apache.jsp.tag.web.changesLinkFull_tag.doTag(changesLinkFull_tag.java:434)
at org.apache.jsp.tag.web.historyTable_tag._jspx_meth_bs_005fchangesLinkFull_005f0(historyTable_tag.java:790)
at org.apache.jsp.tag.web.historyTable_tag.doTag(historyTable_tag.java:304)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspx_meth_bs_005fhistoryTable_005f0(buildTypeStatusDiv_jsp.java:842)
at org.apache.jsp.buildTypeStatusDiv_jsp.access$4(buildTypeStatusDiv_jsp.java:827)
at org.apache.jsp.buildTypeStatusDiv_jsp$Helper.invoke1(buildTypeStatusDiv_jsp.java:1027)
at org.apache.jsp.buildTypeStatusDiv_jsp$Helper.invoke(buildTypeStatusDiv_jsp.java:1072)
... 59 more
Caused by: javax.el.ELException: Error reading 'associatedBuild' on type jetbrains.buildServer.serverSide.impl.BuildPromotionImpl
at javax.el.BeanELResolver.getValue(BeanELResolver.java:66)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:925)
at org.apache.jsp.tag.web.changesLinkFull_tag._jspx_meth_c_005fset_005f0(changesLinkFull_tag.java:451)
at org.apache.jsp.tag.web.changesLinkFull_tag.doTag(changesLinkFull_tag.java:168)
... 65 more
Caused by: jetbrains.buildServer.serverSide.auth.AccessDeniedException: You do not have enough permissions to access build in project with id: project33
at jetbrains.buildServer.serverSide.impl.auth.ServerAuthUtil.checkReadAccessTo(ServerAuthUtil.java:15)
at jetbrains.buildServer.serverSide.impl.auth.SecuredBuildHistory.findEntry(SecuredBuildHistory.java:10)
at jetbrains.buildServer.serverSide.impl.BuildServerImpl.findBuildInstanceById(BuildServerImpl.java:509)
at jetbrains.buildServer.serverSide.impl.BuildPromotionImpl.getAssociatedBuild(BuildPromotionImpl.java:351)
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
... 71 more
javax.servlet.jsp.JspException: javax.el.ELException: Error reading 'associatedBuild' on type jetbrains.buildServer.serverSide.impl.BuildPromotionImpl
at org.apache.jsp.tag.web.changesLinkFull_tag.doTag(changesLinkFull_tag.java:434)
at org.apache.jsp.tag.web.historyTable_tag._jspx_meth_bs_005fchangesLinkFull_005f0(historyTable_tag.java:790)
at org.apache.jsp.tag.web.historyTable_tag.doTag(historyTable_tag.java:304)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspx_meth_bs_005fhistoryTable_005f0(buildTypeStatusDiv_jsp.java:842)
at org.apache.jsp.buildTypeStatusDiv_jsp.access$4(buildTypeStatusDiv_jsp.java:827)
at org.apache.jsp.buildTypeStatusDiv_jsp$Helper.invoke1(buildTypeStatusDiv_jsp.java:1027)
at org.apache.jsp.buildTypeStatusDiv_jsp$Helper.invoke(buildTypeStatusDiv_jsp.java:1072)
at org.apache.jsp.tag.web.refreshable_tag.doTag(refreshable_tag.java:108)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspx_meth_bs_005frefreshable_005f0(buildTypeStatusDiv_jsp.java:669)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspService(buildTypeStatusDiv_jsp.java:292)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jsp.viewType_jsp$Helper.invoke28(viewType_jsp.java:1846)
at org.apache.jsp.viewType_jsp$Helper.invoke(viewType_jsp.java:2034)
at org.apache.jsp.tag.web.refreshable_tag.doTag(refreshable_tag.java:108)
at org.apache.jsp.viewType_jsp$Helper.invoke21(viewType_jsp.java:1731)
at org.apache.jsp.viewType_jsp$Helper.invoke(viewType_jsp.java:2013)
at org.apache.jsp.tag.web.page_tag.doTag(page_tag.java:525)
at org.apache.jsp.viewType_jsp._jspService(viewType_jsp.java:219)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:252)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1173)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:453)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at jetbrains.spring.web.TeamCityDispatcherServlet.service(TeamCityDispatcherServlet.java:14)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter(ResponseFragmentFilter.java:3)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.el.ELException: Error reading 'associatedBuild' on type jetbrains.buildServer.serverSide.impl.BuildPromotionImpl
at javax.el.BeanELResolver.getValue(BeanELResolver.java:66)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:925)
at org.apache.jsp.tag.web.changesLinkFull_tag._jspx_meth_c_005fset_005f0(changesLinkFull_tag.java:451)
at org.apache.jsp.tag.web.changesLinkFull_tag.doTag(changesLinkFull_tag.java:168)
... 65 more
Caused by: jetbrains.buildServer.serverSide.auth.AccessDeniedException: You do not have enough permissions to access build in project with id: project33
at jetbrains.buildServer.serverSide.impl.auth.ServerAuthUtil.checkReadAccessTo(ServerAuthUtil.java:15)
at jetbrains.buildServer.serverSide.impl.auth.SecuredBuildHistory.findEntry(SecuredBuildHistory.java:10)
at jetbrains.buildServer.serverSide.impl.BuildServerImpl.findBuildInstanceById(BuildServerImpl.java:509)
at jetbrains.buildServer.serverSide.impl.BuildPromotionImpl.getAssociatedBuild(BuildPromotionImpl.java:351)
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
... 71 more
javax.el.ELException: Error reading 'associatedBuild' on type jetbrains.buildServer.serverSide.impl.BuildPromotionImpl
at javax.el.BeanELResolver.getValue(BeanELResolver.java:66)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:925)
at org.apache.jsp.tag.web.changesLinkFull_tag._jspx_meth_c_005fset_005f0(changesLinkFull_tag.java:451)
at org.apache.jsp.tag.web.changesLinkFull_tag.doTag(changesLinkFull_tag.java:168)
at org.apache.jsp.tag.web.historyTable_tag._jspx_meth_bs_005fchangesLinkFull_005f0(historyTable_tag.java:790)
at org.apache.jsp.tag.web.historyTable_tag.doTag(historyTable_tag.java:304)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspx_meth_bs_005fhistoryTable_005f0(buildTypeStatusDiv_jsp.java:842)
at org.apache.jsp.buildTypeStatusDiv_jsp.access$4(buildTypeStatusDiv_jsp.java:827)
at org.apache.jsp.buildTypeStatusDiv_jsp$Helper.invoke1(buildTypeStatusDiv_jsp.java:1027)
at org.apache.jsp.buildTypeStatusDiv_jsp$Helper.invoke(buildTypeStatusDiv_jsp.java:1072)
at org.apache.jsp.tag.web.refreshable_tag.doTag(refreshable_tag.java:108)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspx_meth_bs_005frefreshable_005f0(buildTypeStatusDiv_jsp.java:669)
at org.apache.jsp.buildTypeStatusDiv_jsp._jspService(buildTypeStatusDiv_jsp.java:292)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jsp.viewType_jsp$Helper.invoke28(viewType_jsp.java:1846)
at org.apache.jsp.viewType_jsp$Helper.invoke(viewType_jsp.java:2034)
at org.apache.jsp.tag.web.refreshable_tag.doTag(refreshable_tag.java:108)
at org.apache.jsp.viewType_jsp$Helper.invoke21(viewType_jsp.java:1731)
at org.apache.jsp.viewType_jsp$Helper.invoke(viewType_jsp.java:2013)
at org.apache.jsp.tag.web.page_tag.doTag(page_tag.java:525)
at org.apache.jsp.viewType_jsp._jspService(viewType_jsp.java:219)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:252)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1173)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:453)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at jetbrains.spring.web.TeamCityDispatcherServlet.service(TeamCityDispatcherServlet.java:14)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter(ResponseFragmentFilter.java:3)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: jetbrains.buildServer.serverSide.auth.AccessDeniedException: You do not have enough permissions to access build in project with id: project33
at jetbrains.buildServer.serverSide.impl.auth.ServerAuthUtil.checkReadAccessTo(ServerAuthUtil.java:15)
at jetbrains.buildServer.serverSide.impl.auth.SecuredBuildHistory.findEntry(SecuredBuildHistory.java:10)
at jetbrains.buildServer.serverSide.impl.BuildServerImpl.findBuildInstanceById(BuildServerImpl.java:509)
at jetbrains.buildServer.serverSide.impl.BuildPromotionImpl.getAssociatedBuild(BuildPromotionImpl.java:351)
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
... 71 more

0
Comment actions Permalink

Hello Dave,

  If you moved build configuration to another project, users of this build configuration must be granted access to this project.
  Have you done that?

  How do users reach pages which throw the exception? TeamCity UI should not show links to pages inaccessible to the users.

  Regards,
  KIR

0
Comment actions Permalink

Kir,

I have granted Project Developer roles to every TeamCity user including guests for each of the new projects that now have the moved build configs.
As soon as they go to the build config the exception is thrown. e.g.: http://build.machine.com:8111/viewType.html?buildTypeId=bt72&tab=buildTypeStatusDiv

The build history that displays is only for the builds run after the config was moved. See attached file.

-Dave



Attachment(s):
permissions_exception.bmp
0
Comment actions Permalink

After looking at TeamCity's database and looking at the errors in the log files, I think I understand what happened:
Each row in build history table (light_history) contains both a project _id & build_history id. The build configs that
were moved are associated with 4 old projects. These old projects were deleted. Because the history for the old
builds contain project ids that no longer exist, when someone tries to display an old build of the type, it causes
the java exception to be thrown.

So, it seems that the solution is to write a MySQL script that will change all of the old project_ids in the light_history
table to the new project_ids. Does that seem right or is there more to it than that?

-Dave

0
Comment actions Permalink

Looking at the database further there is obviously more to this than I thought. It looks like at minimum the 'history' and
'light_history' tables will need to be updated.

There is a possibility that the 'user_roles' table may need to be fixed too. I think that 'user_projects_order', 'user_projects_visibility'
and 'projects' are okay.

Any tips on how to do this would help.

-Dave

0
Comment actions Permalink

You are right, the "Access denied exception" indeed is caused by the project_id stored in the history table. To fix this problem you'll need to invoke the following SQL command:
UPDATE table history SET project_id = '<new project id>' where build_type_id = '<moved build type id>'

replace <new project id> with id of the project where you moved build configuration and <moved build type id> with id of moved build configuration.

You should restart server after that. Other tables should not be modified. Anyway we already dropped column project_id from the history and light_history when we implemented "move build configuration" functionality in TeamCity trunk (future 4.1).

Sorry for inconvenience.

0
Comment actions Permalink

Thanks for the reply, Pavel. So, if I understand correctly, the 'light_history'  table does not need updating. Only the 'history' table does.

BTW, the select statements will have to be slightly more complex, but I understand what you mean.

In my case, I will need to run the following to fix this:

UPDATE table teamcity.history set project_id='project71' where project_id='project33' and build_type_id='bt129';
UPDATE table teamcity.history set project_id='project72' where project_id='project33' and build_type_id='bt72';
UPDATE table teamcity.history set project_id='project71' where project_id='project52' and build_type_id='bt135';
UPDATE table teamcity.history set project_id='project72' where project_id='project52' and build_type_id='bt148';
UPDATE table teamcity.history set project_id='project71' where project_id='project49' and build_type_id='bt130';
UPDATE table teamcity.history set project_id='project72' where project_id='project49' and build_type_id='bt125';
UPDATE table teamcity.history set project_id='project71' where project_id='project50' and build_type_id='bt131';
UPDATE table teamcity.history set project_id='project72' where project_id='project50' and build_type_id='bt126';

-Dave

0
Comment actions Permalink

Yes, you may not change light_history table, it is used for statistics graphs only.

0
Comment actions Permalink

Okay. After updating the history table and bouncing the TeamCity server, it appears that all is well displaying the build history for the "moved" build_configs for non-admins.
Thanks for the help Kir & Pavel.

-Dave

0

Please sign in to leave a comment.