I've in the past used a single chain of pipelines with fair bit of success.

[Build -> Test] ==> [Deploy To Inactive Stack -> Run tests] ==> [Switch
your LB].

The "deploy to inactive stack" stage would usually involve looking at your
load balancer configuration (or whatever else you use to switch your load
to the new stack) to determine what app servers to deploy your application
to. If the deployment and tests are successful, you can trigger the
"switch" pipeline which works as a mere toggle on your load balancer. In
case you decide to switch back post deployment, you should just be able to
rerun the "switch" pipeline to go back to the old stack.

For your specific needs where you deploy to next environment — you'd
normally chain the above pipeline to another set of similar pipelines.

[Build -> Test] ==> [Deploy To Inactive Stack -> Run tests] ==> [Switch
your LB] => [Promote to next env] => [Deploy To Inactive Stack -> Run
tests] => ...

On Sat, Oct 22, 2016 at 1:28 AM Jason Whittington <
[email protected]> wrote:

> I would like to implement blue/green in GoCD something like this. I would
> like to hear how anyone else is solving the problem today. The behavior I
> want is something like this:
>
>
>
>    1. New material is checked in which triggers some kind of "Approval"
>    pipeline.
>    2. Two pipelines (Blue and Green) each *Wait *somehow for their
>    "color" to become available
>    3. The pipelines deploy to their color when the their color goes
>    inactive
>
>
> <https://lh3.googleusercontent.com/-U6yXds2_ntQ/WApnHTwnC8I/AAAAAAAAAHM/3rYtC8SuuX8xFA8HnHp9ZL22snvcnnkeACKgB/s1600/bluegreen1.PNG>
>
>
> The "hard part" for me is the *Wait* stages.  I need the pipeline
> scheduling to be automatic to make sure we deploy the right versions of
> materials.  Automatic scheduling will trigger an agent to run somewhere.
> The question is, how best to "wait" for something that might take hours or
> days? If I were using Windows Workflow Foundation I could exit on a
> resumable bookmark that I could trigger later.  Alas, bookmarks aren't
> available in GoCD and I don't see any way in GoCD for an agent to say "put
> me to sleep until some future event happens".
>
> Options I see on the table:
>
>
>
>    -
> *Poll some endpoint and hang until the change happens ("Busy wait") *I
>    could have an agent start up and repeatedly poll some outside service
>    asking "can I  run now? now? how about now?" This feels like a crummy
>    solution to me.  The agent will look like a "hung agent" and likely be
>    terminated for running too long.  Busy wait is chatty and consumes cycles.
>    It Completely fails if there is a reboot somewhere in there.
>
>    - *Set a timer to "try again later"*
>    Only slightly less grody - I could have the agent set a timer that
>    will call a script at some point in the future that will check for
>    availability and then trigger the pipeline to run again. This would be a
>    manual invocation though, so I would need the future invocation to pass in
>    the all the right versions of things when it triggers.  This feels likely
>    to be fragile if the materials change over time.  Something like this:
>
>       at now +15 minutes -f curl '
>    http://myserver/go/api/pipelines/DeployToGreen/schedule'
>    <http://ci.example.com/go/api/pipelines/pipeline1/schedule'> -u
>    'username:password'  --header 'Confirm: true' -X POST
>
>
>
> <https://lh3.googleusercontent.com/--n1EnLPvMLo/WApyHj9y0II/AAAAAAAAAHg/tlvaw3YjTjAUurSaKzoyzekmWpWsvX0OwCLcB/s1600/gocd_retry_timer.PNG>
>
> I thought maybe I could do a "dummy first stage and manually invoked
> second stage" trick and have the timer callback repeatedly invoke the
> failing stage but I don't see a way to do that with the REST API*.*  Is
> it there and I just don't see it?
>
>    - *Play material games*
>    Material can be used to trigger pipelines, right? I thought maybe I
>    could have some kind of dummy material that I would check in when the
>    environment changes (Like a text file that says "blue" or "green").  The
>    DeployToBlue and DeployToGreen pipelines would have a material dependency
>    on that item so that they would notice and trigger any time that material
>    changes. This also feels super-dodgy and I'm not inclined to pursue it.
>
>    - *Rely on human intervention*
>    I really want to avoid having to make a human go into the UI and
>    manually trigger DeployToBlue or DeployToGreen.
>
>
> And...I'm about out of ideas.  I'm a little surprised how hard this is.
> I'm hoping there's a way for me to re-trigger a failed stage via REST, then
> I think I have a decent solution.  Failing that I don't see a great way to
> implement blue-green with GoCD.
>
> Appreciate your ideas!
> Jason
>
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to