-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Low
-
None
-
Affects Version/s: 6.7.3, 7.1.3
-
Component/s: VCS task
-
1
-
Severity 2 - Major
Issue Summary
VCS tasks do not work in deployments:
- TAG
- COMMIT
- PUSH
- BRANCH
Steps to Reproduce
- Create a deployment project & environment
- Add a Repository Tag task and select a repository from the dropdown
- Create release
Expected Results
Tag is pushed to target repository
Actual Results
The below exception is thrown in the deployment log:
13-Jan-2021 06:14:47 Starting task 'Repository Tag' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.tagging' 13-Jan-2021 06:14:47 Error occurred while running Task '(4)' of type com.atlassian.bamboo.plugins.vcs:task.vcs.tagging. 13-Jan-2021 06:14:47 com.atlassian.bamboo.task.TaskException: Repository id 5570562 is invalid. Please reselect from the configuration screen. 13-Jan-2021 06:14:47 at com.atlassian.bamboo.utils.BambooPreconditions.checkThat(BambooPreconditions.java:29) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.plugins.vcs.task.VcsTagTask.execute(VcsTagTask.java:48) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:323) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:258) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:323) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:190) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:162) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:137) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:130) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:110) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) 13-Jan-2021 06:14:47 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) 13-Jan-2021 06:14:47 at java.lang.Thread.run(Thread.java:748)
Workaround
Workaround 1
Add a Source code checkout task to the environment for the same repository that you want to perform the VCS task for.
Workaround 2
Use a Script task to perform the Git commands to perform the action instead. E.g. Tagging:
Example below:
In the Build Plan
- Add a script task with the following Inline Script
echo "commit_to_tag=${bamboo.planRepository.revision}" > variables.txt
In the Deployment Plan
- Add the Inject Bamboo Variables Task with the following settings:
- Path to properties file: ../PROJ-PLAN-JOB/variables.txt
PROJ-PLAN-JOB is the Key of the Build Job where the script was created - Namespace: inject
This can stay as-is, we'll reference the variable later as ${bamboo.inject.commit_to_tag} - Scope of the variables: Result
- Path to properties file: ../PROJ-PLAN-JOB/variables.txt
- Add a Script task with the following Inline Script:
git remote set-url origin <ssh or http URL to your repository> git tag ${bamboo.deploy.version} ${bamboo.inject.commit_to_tag} git push origin ${bamboo.deploy.version}