Help documentation

Managing dependencies

Sometimes you need more complex triggers than a simple pipeline of stages and jobs. In particular, you may want a pipeline to trigger based on the result of a stage in another pipeline. This is possible by adding pipelines as materials.

Creating a dependency

To create a dependency, click on the "Edit pipeline" button on the Administration tab.

<pipeline name="downstream">  
  <materials>  
    <pipeline pipelineName="upstream2" stageName="firstStage"/>  
  </materials>
  ...
</pipeline>
  

Here, when the stage "firstStage" of "upstream2" completes, the pipeline "downstream" will start building.

Fetching artifacts from upstream pipeline.

Cruise can automatically fetch artifacts from a previous stage of the current pipeline or from another specified pipeline. This is useful when a pipeline depends on binaries that are produced earlier in the pipeline.

For example, in the following configuration, when the stage 'firstStage' of pipeline 'upstream2' passes, the pipeline 'downstream' starts, and the artifacts are fetched from the upstream pipeline in the stage 'firstStage' of 'downstream'. You can see the exact pipeline and stage that triggered this in the sub-tab 'Materials'.

<pipeline name="upstream2">  
  <materials>  
    <svn url="...."/>  
  </materials>
  ...
  <stage name="firstStage">  
    <job name="firstJob">  
      <tasks>  
        <nant />  
      </tasks>
      <artifacts>  
        <artifact src="target/commonlib.dll" dest="pkg"/>  
      </artifacts>
    </job>
  </stage>
</pipeline>
<pipeline name="downstream">  
  <materials>  
    <pipeline pipelineName="upstream2" stageName="firstStage"/>  
  </materials>
  <stage name="firstStage">  
    <job name="firstJob">  
      <tasks>  
        <fetchartifact pipeline="upstream2" stage="firstStage" job="firstJob" srcfile="pkg/commonlib.dll" dest="libs"/>  
      </tasks>
    </job>
  </stage>
  ...
</pipeline>