Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-17655

Unable to move a plan that provides an artifact to another project with a plan that consumes it

    XMLWordPrintable

Details

    Description

      Summary

      Moving certain plan will have the error "cannot save merged build definitions"

      Steps to Reproduce

      1. Create two Projects: ProjectA and ProjectB
      2. Create PlanA in ProjectA and PlanB in ProjectB
      3. Set PlanA to have produce a ArtifactA
      4. Set PlanB to have "Artifact download" task to download ArtifactA
      5. Create a branch plan in PlanB
      6. Move PlanA from ProjectA to ProjectB

      Expected Results

      Move successfully

      Actual Results

      Move fail with the error message "Transaction rolled back because it has been marked as rollback-only" in the UI.
      The below exception is thrown in the atlassian-bamboo.log file:

      2016-06-08 16:35:18,441 INFO [http-nio-8085-exec-9] [TransactionalPlanMover] Finished updating artifacts
      2016-06-08 16:35:51,616 ERROR [http-nio-8085-exec-9] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.bamboo.chains.events.ChainMovingEvent[source=com.atlassian.bamboo.plan.move.TransactionalPlanMover@1830b4d9] plan=SHD-TOOL] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.bamboo.plugins.artifact.ArtifactDownloaderTaskEventListener.onChainMoving(com.atlassian.bamboo.chains.events.ChainMovingEvent), listener=com.atlassian.bamboo.plugins.artifact.ArtifactDownloaderTaskEventListener@129d624c}]
      java.lang.RuntimeException: cannot save merged build definitions
      	at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
      	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:46)
      	at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
      	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:105)
      	at com.atlassian.bamboo.event.spi.BambooEventDispatcher.dispatch(BambooEventDispatcher.java:38)
      	at com.atlassian.event.internal.LockFreeEventPublisher$Publisher.dispatch(LockFreeEventPublisher.java:260)
      	at com.atlassian.event.internal.LockFreeEventPublisher.publish(LockFreeEventPublisher.java:102)
      	at com.atlassian.bamboo.plan.move.TransactionalPlanMover$1.run(TransactionalPlanMover.java:281)
      	at com.atlassian.bamboo.plugin.BambooPluginUtils$Runnable.call(BambooPluginUtils.java:192)
      	at com.atlassian.bamboo.plugin.BambooPluginUtils$Runnable.call(BambooPluginUtils.java:182)
      	at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(BambooPluginUtils.java:132)
      	at com.atlassian.bamboo.plan.move.TransactionalPlanMover.publishChainMovingEvent(TransactionalPlanMover.java:276)
      	at com.atlassian.bamboo.plan.move.TransactionalPlanMover.moveSinglePlan(TransactionalPlanMover.java:202)
      	at com.atlassian.bamboo.plan.move.TransactionalPlanMover.moveMaster(TransactionalPlanMover.java:139)
      ...
      Caused by: java.lang.IllegalArgumentException: cannot save merged build definitions
      	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
      	at com.atlassian.bamboo.plan.PlanHibernateDao.save(PlanHibernateDao.java:456)
      	at com.atlassian.bamboo.plan.PlanHibernateDao.save(PlanHibernateDao.java:51)
      	at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
      	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      ...
      2016-06-08 16:35:51,916 ERROR [http-nio-8085-exec-9] [MoveBuilds] Unable to move plans
      com.atlassian.bamboo.plan.MovePlansException: org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
      	at com.atlassian.bamboo.plan.move.MovePlanBatchCoordinator.movePlans(MovePlanBatchCoordinator.java:58)
      	at com.atlassian.bamboo.plan.move.MovePlanServiceImpl.movePlansToProject(MovePlanServiceImpl.java:37)
      	at com.atlassian.bamboo.ww2.actions.build.admin.MoveBuilds.execute(MoveBuilds.java:158)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      

      Workaround

      1. Click on the Move button again
        OR
      2. Remove the "Artifact download" task first before moving the plan again

      Notes

      1. The first workaround depends on the number of tasks and branch plans
        • If there are two "Artifact download" tasks to download ArtifactA and two branch plans in PlanB, the number of time to click on the Move button is (2 x 2 + 1) = 5
        • If there are other plans with "Artifact download" tasks that will download ArtifactA and have branch plans as well, the number will increase too, eg:
          PlanB have 2 "Artifact download" tasks and 2 branch plans = 2 x 2 = 4
          PlanC have 3 "Artifact download" tasks and 4 branch plans = 3 x 4 = 12
          Total number to click Move button = 4 + 12 + 1
      2. Incorrect setting in "Artifact download" task
        • If PlanB have two stages and both stages have "Artifact download" task to download ArtifactA, only the second stage in PlanB is updated to refer to the correct project. The first stage is still referring to the ProjectA
        • Running the build will have an error even though the "Artifact download" task is disabled

      Attachments

        Issue Links

          Activity

            People

              kbrazulewicz Krystian Brazulewicz
              klfoong Foong (Inactive)
              Votes:
              21 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: