Ordering of pipelines in GoCD

In GoCD, we use two distinct types of ordering of pipelines:

  • Schedule order: Chronological order in which pipelines are scheduled.
  • Natural order: Chronological order of pipelines based on material modifications

In most cases the schedule order and natural order match. The user checks in and builds incrementally so the order in which builds are scheduled is the same as the relative order in which changes are checked in. Now with the “Trigger with options” functionality, it is possible to trigger a pipeline with older materials. In this case, the changes to the material as reported by the repository and the order of pipelines containing these changes are not the same

Example

  1. Order of check-ins retrieved from Hg log:
  2. changeset: 10689:6dbb27e86dc9
  3. branch: trunk
  4. tag: tip
  5. user: ShilpaG
  6. date: Tue Apr 27 09:52:15 2010 +0530
  7. summary: fixing twist test EnvironmentScreenPermissions
  8. changeset: 10688:2b5b25a68117
  9. branch: trunk
  10. user: JJ
  11. date: Tue Apr 27 08:45:29 2010 +0530
  12. summary: fixing broken twist test
  13. changeset: 10687:6f91bbb648fa
  14. branch: trunk
  15. user: PS
  16. date: Mon Apr 26 15:28:16 2010 +0530
  17. summary: #3889 - Added the twist test for the stage details actions.
  18. Pipeline instance 1 has revision: 10687:6f91bbb648fa
  19. Pipeline instance 2 has revision: 10689:6f91bbb648fa
  20. Pipeline instance 3 has revision: 10688:2b5b25a68117

The pipeline order based on scheduling is: 1, 2, 3. This is the order in which they were triggered.

The pipeline order based on natural order: 1, 3, 2. This is because, if we look at the changes in each pipeline instance, 1 has the earliest set of revisions, 3 has the next set of revisions and 2 has the latest revisions in that particular repository (material).

The above example works when there is one material. If the pipeline has multiple materials, GoCD examines the timestamps of all the materials to determine which is logically the earlier pipeline instance. In this case, the earlier instance is the one that has the earliest time stamp across all the materials.

GoCD supports natural ordering of materials when we “Trigger with Options”. The user can change the revision of all materials or where one particular material(that is likely to have broken the build) is chosen and all other materials are pinned to a particular revision(last known good revision).