KBEC-00193 - Workflow for multiple remote site builds with manual failed and passed restart

Article ID:360033192851
2 minute readKnowledge base

Description

You have single source distributed to remote sites where local builds are done onsite. You want to generate a workflow to show this. Here are the assumptions:

  1. There is a single CloudBees CD (CloudBees Flow) server with agents and/or web servers at multiple remote sites.

  2. Each remote site is now going to run the "base" build on their local agents, and then run a follow-on "local" build. (The combination of "base" and "local" builds are referred to as the "build process.")

  3. All of the remote sites' build processes will be kicked off simultaneously.

  4. There shall be a manual option to re-launch all of the build processes, regardless of outcome.

  5. There shall be a manual option to re-launch only the build processes that have failed.

Solution

  1. Each remote site has a workflow definition for its build process.

    1. The first state, Base, launches the base build.

    2. The second state, Local, launches the local build.

    3. There is either an onCompletion transition or a manual transition from Base to Local, depending on what the is wanted.

  2. There is a separate workflow definition that is used to drive all of the remote sites' build processes.

    1. It has a single state for each remote site whose action is the sub-workflow for that site (for example, California, NYC, England)

    2. It has a Start state with one drop-down formal parameter for each remote site state with the options Default, Launch, and Skip.

      1. When the workflow is launched (or when someone takes the Restart transition as defined below), the user can select whether to launch or skip each remote site, or let it use the default behavior. The default behavior is to launch the sub-workflow for a remote site if it has not run before, or if it has run before and any of its jobs have failed.

      2. Additionally, there is an onEnter transition from Start to California.

        1. The Start state’s only purpose is to collect parameters.

    3. It has a Launched state, which it will transition to after kicking everything off in parallel.

      1. There is a manual transition called Restart from Launched to Start.

    4. There is an onStart transition from each remote site state to the next (i.e. California to NYC, NYC to England, England to Launched).

    5. There is an onEnter transition called Skip from each remote site state to the next state which fires if:

      1. The actual parameter to the Start state for this state was set to Skip, or

      2. The actual parameter was set to Default, there is already a sub-workflow for that state, and the jobs in that sub-workflow are successful

When the workflow is initially launched, it will kick off all of the build processes in parallel. There will then be an option to restart the workflow, and for each remote site you may either force it to run, skip it explicitly, or let it run only if it has failed.