Deployment Job Doesn't Automatically Use Same Branch as Build

Description:

We have two TeamCity build configurations:

  • Build Job: Builds the application.
  • Deploy Job: Deploys the application.

Setup:

  • Both jobs can run from any Git branch, with main being the default.
  • The Deploy Job has a dependency on the Build Job.

Expected Behavior:

When a user triggers a build from a specific branch (e.g., test123), the Deploy Job should automatically use the same branch (test123) without requiring manual selection.

Actual Behavior:

If the user does not manually select a branch for the deploy job, TeamCity defaults to the main branch, which can result in deploying the wrong code.

What We Want:

We are looking for a way to make the Deploy Job automatically use the same branch as the Build Job it depends on, without requiring users to manually select the branch each time.
 

0
1 comment
Hi,

How do you trigger the build in your scenario?
If you have a snapshot dependency in the Deploy build configuration with the Build build configuration as a dependent one, you should trigger the Deploy build configuration, which will trigger the Build build configuration, all on the same branch.

Best regards,
Anton
0

Please sign in to leave a comment.