-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Low
-
None
-
Affects Version/s: 7.1.4
-
Component/s: Docker Runner, Source Checkout Task
-
None
-
3
-
Severity 3 - Minor
Issue Summary
If all the following conditions are met, the source code checkout task will not work as intended:
- Checking out code for more than one repository using the same Source code checkout task
- At least one repository is being cloned at the root of the working directory
- Git cache on the agent is enabled
- Docket runner is being used to run the Job
- "Clean working directory after each build" is enabled
Steps to Reproduce
- Create a plan with two repositories
- Make sure "repository caching on agents" is enabled (for the default repo)
- Add a source code checkout task with the following (or similar) config:
- Clone the main repo at <working directory>
- Clone the second repo at <working directory>/subfolder
- Add a script task to list the content of the working directory
- Enable Docker Runner
- Enable "Clean working directory after each build"
- Run the plan
Expected Results
If the checkout succeeds, the script task will list the content of the working dir.
Actual Results
The build will be green but the script task will return no results.
Cache on agent enabled:
simple 22-Dec-2020 13:13:57 Starting task 'list content' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script' command 22-Dec-2020 13:13:57 Beginning to execute external process for build 'Acpt - Clone_Repo_test - Default Job #60 (EB-CLON-JOB1-60)'\n ... running command line: \n/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/runInDocker6558735839153796389.sh /Users/gabriel.ribeiro/bamboo-agent-home/temp/EB-CLON-JOB1-60-ScriptBuildTask-4998711379937999561.sh\n ... in: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T\n build 22-Dec-2020 13:13:59 -----------CONTENT OF THE WORK DIR AFTER CHECKOUT START---------- build 22-Dec-2020 13:13:59 total 0 build 22-Dec-2020 13:13:59 -----------CONTENT OF THE WORK DIR AFTER CHECKOUT END---------- simple 22-Dec-2020 13:13:59 Finished task 'list content' with result: Success
The following exception is thrown in the agent logs:
2020/12/22 10:13:55 | 313823648 [0-BAM::192.168.10.92 (3)::Agent:pool-3-thread-1] WARN com.atlassian.bamboo.plugins.git.v2.AbstractGitExecutor - Deleting git workspace /Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/EB-CLON-JOB1 due to exception INFO | jvm 1 | 2020/12/22 10:13:55 | com.atlassian.bamboo.repository.RepositoryException: Checkout to revision 046e302b8af33e1cc9e0169466257db2d8a64b8d has failed.command [/usr/local/bin/git clone /Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/_git-repositories-cache/46d5b1c4fc5dae834e521f0b86222d54b1332ebd --shared --no-checkout '-c filter.lfs.smudge=' '-c filter.lfs.required=false' /Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/EB-CLON-JOB1] failed with code 128. Working directory was [/Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/EB-CLON-JOB1]., stderr: INFO | jvm 1 | 2020/12/22 10:13:55 | fatal: destination path '/Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/EB-CLON-JOB1' already exists and is not an empty directory. INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.checkout(NativeGitOperationHelper.java:500) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.lambda$checkout$1(GitWorkingCopyManager.java:267) INFO | jvm 1 | 2020/12/22 10:13:55 | at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:252) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.retrieveSourceCode(GitWorkingCopyManager.java:120) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.retrieveSourceCode(BitbucketServerWorkingCopyManager.java:91) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.fillWorkingDirFromVcs(VcsCheckoutTask.java:206) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.execute(VcsCheckoutTask.java:119) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:323) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:258) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:323) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.task.TaskExecutorImpl.executePreparationTasks(TaskExecutorImpl.java:97) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:81) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:190) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:162) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:110) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) INFO | jvm 1 | 2020/12/22 10:13:55 | at java.lang.Thread.run(Thread.java:748) INFO | jvm 1 | 2020/12/22 10:13:55 | Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/local/bin/git clone /Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/_git-repositories-cache/46d5b1c4fc5dae834e521f0b86222d54b1332ebd --shared --no-checkout '-c filter.lfs.smudge=' '-c filter.lfs.required=false' /Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/EB-CLON-JOB1] failed with code 128. Working directory was [/Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/EB-CLON-JOB1]., stderr: INFO | jvm 1 | 2020/12/22 10:13:55 | fatal: destination path '/Users/gabriel.ribeiro/bamboo-agent-home/xml-data/build-dir/EB-CLON-JOB1' already exists and is not an empty directory. INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:729) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:658) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:649) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runLocalCloneCommand(GitCommandProcessor.java:349) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.createLocalRepository(NativeGitOperationHelper.java:433) INFO | jvm 1 | 2020/12/22 10:13:55 | at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.checkout(NativeGitOperationHelper.java:473) INFO | jvm 1 | 2020/12/22 10:13:55 | ... 23 more
Cache on agent disabled:
simple 22-Dec-2020 13:14:46 Starting task 'list content' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script' command 22-Dec-2020 13:14:46 Beginning to execute external process for build 'Acpt - Clone_Repo_test - Default Job #61 (EB-CLON-JOB1-61)'\n ... running command line: \n/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/runInDocker7184225876901690045.sh /Users/gabriel.ribeiro/bamboo-agent-home/temp/EB-CLON-JOB1-61-ScriptBuildTask-1814243841586037060.sh\n ... in: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T\n build 22-Dec-2020 13:14:47 -----------CONTENT OF THE WORK DIR AFTER CHECKOUT START---------- build 22-Dec-2020 13:14:47 total 4 build 22-Dec-2020 13:14:47 drwxr-xr-x 5 root root 160 Dec 22 13:14 . build 22-Dec-2020 13:14:47 drwxr-xr-x 3 root root 4096 Dec 22 13:14 .. build 22-Dec-2020 13:14:47 drwxr-xr-x 13 root root 416 Dec 22 13:14 .git build 22-Dec-2020 13:14:47 drwxr-xr-x 6 root root 192 Dec 22 13:14 bamboo-specs build 22-Dec-2020 13:14:47 drwxr-xr-x 6 root root 192 Dec 22 13:14 subfolder build 22-Dec-2020 13:14:47 -----------CONTENT OF THE WORK DIR AFTER CHECKOUT END----------
Workaround
Disable cache on the agent
OR
Run the job on the agent environment (outside container).
OR
Use separate source code checkout tasks for each repository.
OR
Use a separate subdirectory for each repository