Reuse last successful dependent job regardless of sources

Hello, I'd like to ask for an advice regarding Build Chains; not sure if this is a bug or just a wrong configuration on our side.

We have the following build chain setup:

  • A Test build configuration
    • runs multiple times day (using a Schedule trigger)
    • has 50+ VCS roots (from GitHub) defined
  • A Promote build configuration
    • runs 1-2 times per day (also using a Schedule trigger)
    • has no VCS roots of its own defined
    • has both snapshot and artifact dependency on Test
    • has Show changes from snapshot dependencies enabled

We would like the Promote build configuration to never trigger a new Test build, but simply to take the latest successful build of Test and use that as its dependency. However, if there are any changes since the latest Test run, the Test build is re-triggered when we run Promote.

We have tried various alternative setups, such as:

  • adding the same VCS roots as Test has to Promote job
  • using Promote on latest successful Test build (this works, but Promote keeps reporting Pending changes, which are never flushed/processed)
  • using just an Artifact dependency on latest successful Test (this works, but we lose the Dependencies graph, which we would like to keep)

Is there another way to achieve what we need (run Test on its own schedule, and have Promote depend on latest successful run)? Or is there a bug in the described behaviour that should be reported?

Thank you very much for any help!

0
2 comments

I have made an extra discovery that when Enforce revisions synchronization is turned off on the snapshot dependency, the changes seem to be properly displayed for the Promote job. So using the promote on latest successful Test build via TeamCity API seems to fulfil our needs.

My question remains whether there is a way to achieve the desired behaviour natively, without requiring an auxiliary build configuration/step that calls TeamCity API to select the last successful build.

0
Hi Kristian,

The snapshot dependency is designed to ensure that the dependent build B will start only after the dependency build A is run and finished (like a build chain). So, when a snapshot dependency is set up, it is expected to trigger build A if there are no suitable builds found. However, it can reuse suitable builds if it is set up to do so. You can find the description of all settings available for snapshot dependencies and the description of suitable builds in the documentation: https://www.jetbrains.com/help/teamcity/2024.03/snapshot-dependencies.html.
Please also note that there are some VCS root settings that effectively disable the build reuse: https://www.jetbrains.com/help/teamcity/2024.03/snapshot-dependencies.html#VCS+Settings+Disabling+Builds+Reuse.

If I understand your use case correctly, then using only the artifact dependency would be a recommended way to proceed.

Best regards,
Anton
0

Please sign in to leave a comment.