Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
8.2.4
-
None
-
1
-
Severity 3 - Minor
-
Description
Issue Summary
All initial branch builds for newly detected branches fail when the default branch (branch configured on the default plan / repository) has been deleted from the remote repository. Subsequent builds will work fine, it's just the first auto build that is affected.
This is reproducible on Data Center: yes
Steps to Reproduce
- Create a plan linked to Bitbucket Server
- Turn on automatic branch detection
- Configure the default repository to point to a particular branch which we will delete
- Perform a build of the default plan
- Delete the branch it points to
- Push a new branch to the repository
Expected Results
Initial build succeeds despite not being able to get an approximate list of commits/changes for the initial build or if failing the build due to not being able to compile the change list is desired, the error messaging should be clear around the reasoning.
Actual Results
Initial build fails (build #1)
Subsequent builds work fine
The below exception is thrown in the $BAMBOO_HOME/logs/atlassian-bamboo.log file and shown in the user interface when checking the builds of the branch plan:
2022-07-15 04:43:00,941 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-57] [PlanCreationTemplate] New Plan created with key TP-INIT9 2022-07-15 04:43:00,941 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-57] [LightweightBranchCreationServiceImpl] Created branch with key TP-INIT9 for VCS branch VCS Branch [init5] 2022-07-15 04:43:00,952 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-35] [InitialBuildListener] Initial build for TP-INIT92022-07-15 04:43:02,051 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-23] [GitBranchDetector] Found 74989696f8fdf7cdde9689717afcff1262cb6f68 as the last commit for BITB [-1] 2022-07-15 04:43:02,057 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-23] [ImmutablePlanCacheServiceImpl] Invalidating TP-INIT9 2022-07-15 04:43:03,150 INFO [7-DelayedChangeDetectionThread:pool-9-thread-22] [NativeGitOperationHelper] Could not find [init4] in remote refs. ... 2022-07-15 04:43:04,245 ERROR [7-DelayedChangeDetectionThread:pool-9-thread-22] [ChainExecutionManagerImpl] Plan 'TP-INIT9' could not be started. Exception: com.atlassian.bamboo.repository.RepositoryException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.RepositoryException: command [/usr/bin/git log -p --name-only --encoding=UTF-8 --format=[d31bfa5_BAM_hash]%H%n[d31bfa5_BAM_author_name]%aN%n[d31bfa5_BAM_author_email]%ae%n[d31bfa5_BAM_timestamp]%ct%n[d31bfa5_BAM_commit_message]%s%n%b[d31bfa5_BAM_commit_message_end]%n[d31bfa5_BAM_file_list] -1 init5 ^init4] failed with code 128. Working directory was [/var/atlassian/application-data/bamboo/xml-data/build-dir/_git-repositories-cache/805ef0fa8ea85f5f36222c308c79c6ac7593855f]., stderr: at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectInitialStateForBranchBuild(DefaultChangeDetectionManager.java:364) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:160) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:190) at com.atlassian.bamboo.build.BuildDetectionActionFactoryImpl$InitialBuildDetectionAction.performDelayedChangeDetection(BuildDetectionActionFactoryImpl.java:230) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$1.getChainState(ChainExecutionManagerImpl.java:266) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:338) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:258) at sun.reflect.GeneratedMethodAccessor1893.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy262.delayedStart(Unknown Source) at sun.reflect.GeneratedMethodAccessor1893.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy262.delayedStart(Unknown Source) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.lambda$call$0(PlanExecutionManagerImpl.java:376) at com.atlassian.bamboo.util.CacheAwareness.lambda$withValuesOlderThanTimestampReloaded$1(CacheAwareness.java:101) at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:126) at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:100) at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:151) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:375) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:368) at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293) at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:75) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:656) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$400(PlanExecutionManagerImpl.java:132) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:364) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) at java.lang.Thread.run(Thread.java:748) Caused by: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.RepositoryException: command [/usr/bin/git log -p --name-only --encoding=UTF-8 --format=[d31bfa5_BAM_hash]%H%n[d31bfa5_BAM_author_name]%aN%n[d31bfa5_BAM_author_email]%ae%n[d31bfa5_BAM_timestamp]%ct%n[d31bfa5_BAM_commit_message]%s%n%b[d31bfa5_BAM_commit_message_end]%n[d31bfa5_BAM_file_list] -1 init5 ^init4] failed with code 128. Working directory was [/var/atlassian/application-data/bamboo/xml-data/build-dir/_git-repositories-cache/805ef0fa8ea85f5f36222c308c79c6ac7593844f]., stderr: at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerChangeDetector.collectChangesForInitialBuild(BitbucketServerChangeDetector.java:59) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.lambda$collectInitialStateForBranchBuild$1(DefaultChangeDetectionManager.java:351) at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectInitialStateForBranchBuild(DefaultChangeDetectionManager.java:350) ... 39 more Caused by: com.atlassian.bamboo.repository.RepositoryException: command [/usr/bin/git log -p --name-only --encoding=UTF-8 --format=[d31bfa5_BAM_hash]%H%n[d31bfa5_BAM_author_name]%aN%n[d31bfa5_BAM_author_email]%ae%n[d31bfa5_BAM_timestamp]%ct%n[d31bfa5_BAM_commit_message]%s%n%b[d31bfa5_BAM_commit_message_end]%n[d31bfa5_BAM_file_list] -1 init5 ^init4] failed with code 128. Working directory was [/var/atlassian/application-data/bamboo/xml-data/build-dir/_git-repositories-cache/805ef0fa8ea85f5f36222c308c79c6ac7593855f]., stderr: at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChangesForInitialBuild(GitChangeDetector.java:141) at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerChangeDetector.collectChangesForInitialBuild(BitbucketServerChangeDetector.java:55) ... 42 more Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/bin/git log -p --name-only --encoding=UTF-8 --format=[d31bfa5_BAM_hash]%H%n[d31bfa5_BAM_author_name]%aN%n[d31bfa5_BAM_author_email]%ae%n[d31bfa5_BAM_timestamp]%ct%n[d31bfa5_BAM_commit_message]%s%n%b[d31bfa5_BAM_commit_message_end]%n[d31bfa5_BAM_file_list] -1 init5 ^init4] failed with code 128. Working directory was [/var/atlassian/application-data/bamboo/xml-data/build-dir/_git-repositories-cache/805ef0fa8ea85f5f36222c308c79c6ac7593855f]., stderr: at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:773) at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:702) at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runLogCommandXBranch(GitCommandProcessor.java:887) at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.extractCommitsBetweenBranches(NativeGitOperationHelper.java:746) at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.lambda$collectChangesForInitialBuild$2(GitChangeDetector.java:121) at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293) at com.atlassian.bamboo.plugins.git.GitCacheDirectory$LoggingManagedLock.withLock(GitCacheDirectory.java:44) at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChangesForInitialBuild(GitChangeDetector.java:121) ... 43 more
stderr is for some reason empty in the log and UI, however when running the same commands manually on the Git cache we see it fails due to bad revision:
$/usr/bin/git log -p --name-only --encoding=UTF-8 --format=[d31bfa5_BAM_hash]%H%n[d31bfa5_BAM_author_name]%aN%n[d31bfa5_BAM_author_email]%ae%n[d31bfa5_BAM_timestamp]%ct%n[d31bfa5_BAM_commit_message]%s%n%b[d31bfa5_BAM_commit_message_end]%n[d31bfa5_BAM_file_list] -1 init5 ^init4
fatal: bad revision '^init4'
Workaround
Option 1
Configure the default repository to point to a branch that exists:
- Plan Configuration >> Repositories
- Edit the default repository
- Point it to a branch that exists.
Option 2
If the branch should never have been deleted, you'll need to push it back to the repository.
Attachments
Issue Links
- mentioned in
-
Page Loading...