From 4cbf8b171f7f2836c14e0fa201afa219acef39cf Mon Sep 17 00:00:00 2001 From: Mathias Klette Date: Sun, 16 Jun 2013 03:49:01 +0200 Subject: [PATCH] debian_build: when rebase failed use some more actions to recover -------- Original-Nachricht -------- Betreff: Jenkins Build dev_vdc-bundle - failed rebase not cleaned up correctly Datum: Fri, 14 Jun 2013 20:33:44 +0200 Von: Ramona Koch Antwort an: ramona.koch@profitbricks.com An: dcops , Core , Mehrdad Arifi Hi DC Ops, Hi Core, Hi Mehrdad I just noticed, that the 'workspace' is not correctly cleaned up, if the rebase had failed. All builds trying to merge afterwards will also fail during rebase with: It seems that I cannot create a rebase-apply directory, and I wonder if you are in the middle of patch application or another rebase. If that is not the case, please rm -fr /var/lib/jenkins/jobs/dev_vdc-bundles/workspace/.git/rebase-apply and run me again. I am stopping in case you still have something valuable there. @DCOps: I checked your debian_build.py at: 337 try: 338 src_branch = local_branch # save the original branch 339 dst_branch = 'integration' # define the new branch 340 local_branch = dst_branch # reset env for git-buildpackage 341 gitrepo.git.rebase('origin/' + dst_branch) 342 gitrepo.git.checkout(dst_branch) 343 gitrepo.git.pull() 344 gitrepo.git.merge(src_branch) 345 logger.info('Rebase and merge from branch "{src_branch}" completed. Now in "{dst_branch}".'.format( 346 dst_branch=dst_branch, 347 src_branch=src_branch, 348 )) 349 except Exception as error: 350 logger.error('Rebase has failed!', exc_info=error) 351 gitrepo.git.reset('--hard',src_branch) 352 exit_error() and I assume that 'git reset --hard' is not enough. Probably a 'git rebase --abort' needs to be done before. If this does not work - simply removing the mentioned file will work. Could you check, if my assumption is correct and fix it, please. --- debian_build.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/debian_build.py b/debian_build.py index 8b76cc0..9c085f7 100755 --- a/debian_build.py +++ b/debian_build.py @@ -343,17 +343,18 @@ if __name__ == '__main__': src_branch = local_branch # save the original branch dst_branch = 'integration' # define the new branch local_branch = dst_branch # reset env for git-buildpackage - gitrepo.git.rebase('origin/' + dst_branch) - gitrepo.git.checkout(dst_branch) - gitrepo.git.pull() - gitrepo.git.merge(src_branch) + logger.debug(gitrepo.git.rebase('origin/' + dst_branch)) + logger.debug(gitrepo.git.checkout(dst_branch)) + logger.debug(gitrepo.git.pull()) + logger.debug(gitrepo.git.merge(src_branch)) logger.info('Rebase and merge from branch "{src_branch}" completed. Now in "{dst_branch}".'.format( dst_branch=dst_branch, src_branch=src_branch, )) except Exception as error: - logger.error('Rebase has failed!', exc_info=error) - gitrepo.git.reset('--hard',src_branch) + logger.error('Rebase has failed!\n\n%s\n' % error.stderr, exc_info=error) + logger.debug(gitrepo.git.rebase('--abort')) + logger.debug(gitrepo.git.reset('--hard',src_branch)) exit_error() if 'no-test' in build_triggers: -- 2.39.5