Issue Summary
When using specs to import a deployment project which contains an "After succesful stage" trigger pointing to a custom plan branch, this will be ignored and will not trigger after that custom branch stage builds successfully.
Steps to Reproduce
- Create a specs linked repository that contains two branches containing the YAML specs below. For the example below the spec branches will be master and develop.
---
version: 2
plan:
project-key: NEW
key: KEY
name: Test Project
triggers:
- polling:
period: 86400
branches:
create: manually
stages:
- Stage 1:
jobs:
- Stage 1
- Stage 2:
jobs:
- Stage 2
Stage 1:
tasks:
- script: echo "Stage 1 done"
Stage 2:
tasks:
- script: echo "Stage 2 done"
---
version: 2
deployment:
name: NEW
source-plan: NEW-KEY
release-naming:
next-version-name: ${bamboo.buildResultKey}
applies-to-branches: true
auto-increment: false
environments:
- production
production:
tasks:
- clean
- script: echo "Deployment on ${bamboo.deploy.environment} done!"
triggers:
- stage-success:
stage: Stage 1
branch: develop
- Manually create the develop plan branch through VCS detection
- Re-scan the specs repository and confirm that both specs branches imported successfully
- Trigger the develop plan branch
Expected Results
The "After successful stage" trigger works for the custom branch works, and the deployment completes successfully
Actual Results
The trigger is ignored and the deployment does not occur.
By looking on the database, we can see that the triggers_xml_data column within the deployment_environment table is referencing the stage for master branch instead of the correct one which should be the develop stage.
The data below was generated while importing the above specs.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration xml:space="preserve">
<triggers>
<defined>true</defined>
<triggerDefinition>
<id>1</id>
<name>After successful stage</name>
<userDescription/>
<isEnabled>true</isEnabled>
<pluginKey>com.atlassian.bamboo.triggers.atlassian-bamboo-triggers:afterSuccessfulStage</pluginKey>
<triggeringRepositories/>
<config>
<item>
<key>deployment.trigger.afterSuccessfulStage.triggeringBranch</key>
<value>NEW-KEY0</value>
</item>
<item>
<key>deployment.trigger.afterSuccessfulStage.triggeringPlan</key>
<value>NEW-KEY</value>
</item>
<item>
<key>deployment.trigger.afterSuccessfulStage.triggeringStage</key>
<value>4063237</value>
</item>
<item>
<key>deployment.trigger.afterSuccessfulStage.branchSelectionMode</key>
<value>CUSTOM</value>
</item>
</config>
</triggerDefinition>
</triggers>
<bambooDelimiterParsingDisabled>true</bambooDelimiterParsingDisabled>
</configuration>
When checking the build table we can see that stage number 4063237 refers to NEW-KEY-JOB1 or the master branch and not the develop stage one.
Workaround
No workaround.