Hello folks,

Consider the following scenario:

   - Template *T_A*: Builds some binaries and stores them as an artifact.
   - Template *T_B*: Fetches binaries from the upstream pipeline *T_A *and 
   runs tests. To achieve this,  *T_B* has a *Fetch Artifact *task with the 
   upstream pipeline as a parameter *#{UPSTREAM_BUILD_PIPELINE}.*
   - Template *T_C*: Fetches binaries from upstream pipeline *T_A* and 
   creates packages. To achieve this,  *T_C* has a *Fetch Artifact *task 
   with the upstream pipeline as a parameter *#{UPSTREAM_BUILD_PIPELINE}.*
   - Pipeline *A*: Uses template *T_A*.
   - Pipeline *B*: Uses template *T_B**. *Sets *UPSTREAM_BUILD_PIPELINE  *to 
   pipeline *A.*
   - Pipeline *C*: Uses template *T_C*. Sets *UPSTREAM_BUILD_PIPELINE  *
   to pipeline *A.*

This results in the following VSM:


The problem I have is that pipeline C will be triggered twice: Once after A 
finishes and once after B finishes. The expected behavior (or the behavior 
I wish to achieve) is that C will only run after B finishes successfully.

How can I make sure that C only runs after successful completion of B (and 
therefore implicitly A)?

Attached is the corresponding XML fragment of my templates & pipelines 
where:

   - *T_A -> Build-CMake-OS-Compiler*
   - *T_B -> Test-OS*
   - *T_C -> Package-OS*
   - *A -> GPDS-Build-FreeBSD-GCC*
   - *B -> GPDS-Test-FreeBSD-GCC*
   - *C -> GPDS-Package-FreeBSD*

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/0a8a6dc4-0b49-4036-a573-44d0feca32b9n%40googlegroups.com.
  <pipelines group="GPDS">
    <pipeline name="GPDS-Build-FreeBSD-GCC" template="Build-CMake-OS-Compiler">
      <params>
        <param name="COMPILER_SUITE">gcc</param>
        <param name="OS">FreeBSD</param>
        <param name="CMAKE_CXX_COMPILER">g++10</param>
        <param name="CMAKE_GENERATOR">Unix Makefiles</param>
        <param name="CMAKE_C_COMPILER">gcc10</param>
        <param name="NUM_JOBS">4</param>
      </params>
      <materials>
        <git url="https://github.com/simulton/gpds"; />
      </materials>
    </pipeline>

    <pipeline name="GPDS-Test-FreeBSD-GCC" template="Test-OS">
      <params>
        <param name="TEST_BIN">build/test/gpds-tests</param>
        <param name="OS">FreeBSD</param>
        <param name="UPSTREAM_BUILD_PIPELINE">GPDS-Build-FreeBSD-GCC</param>
      </params>
      <materials>
        <pipeline pipelineName="GPDS-Build-FreeBSD-GCC" stageName="Build" />
      </materials>
    </pipeline>

    <pipeline name="GPDS-Package-FreeBSD" template="Package-OS">
      <params>
        <param name="UPSTREAM_BUILD_PIPELINE">GPDS-Build-FreeBSD-GCC</param>
        <param name="OS">FreeBSD</param>
      </params>
      <materials>
        <pipeline pipelineName="GPDS-Build-FreeBSD-GCC" stageName="Build" />
        <pipeline pipelineName="GPDS-Test-FreeBSD-GCC" stageName="Run" />
      </materials>
    </pipeline>
  </pipelines>

  <templates>
    <pipeline name="Build-CMake-OS-Compiler">
      <stage name="Build">
        <jobs>
          <job name="Build">
            <tasks>
              <exec command="mkdir">
                <arg>build</arg>
                <runif status="passed" />
              </exec>
              <exec command="cmake" workingdir="build">
                <arg>-G</arg>
                <arg>#{CMAKE_GENERATOR}</arg>
                <arg>-DCMAKE_C_COMPILER=#{CMAKE_C_COMPILER}</arg>
                <arg>-DCMAKE_CXX_COMPILER=#{CMAKE_CXX_COMPILER}</arg>
                <arg>..</arg>
                <runif status="passed" />
              </exec>
              <exec command="make" workingdir="build">
                <arg>-j#{NUM_JOBS}</arg>
                <runif status="passed" />
              </exec>
            </tasks>
            <resources>
              <resource>#{OS}</resource>
              <resource>#{COMPILER_SUITE}</resource>
            </resources>
            <artifacts>
              <artifact type="build" src="build" />
            </artifacts>
          </job>
        </jobs>
      </stage>
    </pipeline>

    <pipeline name="Test-OS">
      <stage name="Run">
        <approval type="success" allowOnlyOnSuccess="true" />
        <jobs>
          <job name="Run">
            <tasks>
              <fetchartifact artifactOrigin="gocd" srcdir="build" pipeline="#{UPSTREAM_BUILD_PIPELINE}" stage="Build" job="Build">
                <runif status="passed" />
              </fetchartifact>
              <exec command="chmod">
                <arg>+x</arg>
                <arg>#{TEST_BIN}</arg>
                <runif status="passed" />
              </exec>
              <exec command="#{TEST_BIN}">
                <runif status="passed" />
              </exec>
            </tasks>
            <resources>
              <resource>#{OS}</resource>
            </resources>
          </job>
        </jobs>
      </stage>
    </pipeline>

    <pipeline name="Package-OS">
      <stage name="Generate">
        <jobs>
          <job name="Installer">
            <tasks>
              <fetchartifact artifactOrigin="gocd" srcdir="build" pipeline="#{UPSTREAM_BUILD_PIPELINE}" stage="Build" job="Build">
                <runif status="passed" />
              </fetchartifact>
              <exec command="ls" workingdir="build">
                <arg>-lhs</arg>
                <runif status="passed" />
              </exec>
            </tasks>
            <resources>
              <resource>#{OS}</resource>
            </resources>
          </job>
        </jobs>
      </stage>
    </pipeline>

  </templates>

Reply via email to