How to trigger a project deployment on success of another one ? Does that make sense ?
Asked by Jean-Sebastien (GA):

Hi guys,

With Bamboo OnDemand, I want to chain project deployements, each one being triggered when previous one has succeeded, like QA =\> Stage =\> Production.

How do I perform that, knowing the only triggers available are on plan build success, not on project deployment success ??

Maybe my question does not make sense, or maybe it looks stupid, so let me describe you more about my project context :

It is a PHP project, so basically, at the beginning what I expected from Bamboo OnDemand is to :

1 - check out the code from one branch (in BitBucket)

2 - do some PHPUnit test on it on the Elastic Image

3 - deploying the code to one environment

and to redo this "3 - steps" for another environement, and maybe another git branch.

Let's say 3 environments is enough for me (testing/QA, Stage, Prod). And of course I want a chain, each one triggering the next, only if it went well (except for the prod I want to be triggeredmanually)

**Problem 1.**

I cannot run PHPUnit in Elastic Agent because it seems it does not have the mysql driver .... So far for the automated testing in Bamboo OnDemand.

**Solution** : I can do the testing on the target server, once the code has been "deployed".

So it means my 1-2-3 steps become :

1 - check out the code from one branch

2 - deploying the code to one environment

3 - do some PHPUnit test on it

**Problem 2.**

I don't have any resulting artifact, since I don't have to "build" (meaning compile/ link etc.) anything, I'm in php world... I just have source files to be "deployed" (=moved) from the repo to the server.

As an unexpected consequence, it means that if I want to use Project Deployments, I have to create a fake and shared artifact, otherwise I can't create any project deployment ! :(

Moreover, to perform the "deployment", I don't want to use any SCP task that actually move all checked out files over the net, it would be way too long.

**Solution** : my deployment will only consist in remotely asking for a git pull.

**Finally, what I have now is :**

(1) A build plan whose sole role is to create a dummy file to be shared as an "artifact", just to allow me have Project Deployments.

(2) One project deployement for QA env., which have only one task, the SSH command task, that connects to the QA server and performs remotely :

* git pull from the "develop" branch to the web root (I'm using Bitbucket and a Gitflow workflow here)
* run local phpunit testing against that code

Then, if testing is OK, I want to do the same for a Stage environment. But how to chain/trigger it ?

And eventually I want to do the same for a Production environment, expect this one will be manually triggered (and source code will be pull from Master branch).

Can you help me to organize this ? :)

best regards,

JS


Answers:
author: Marcin Gardias
body: The feature is under development and is most probably going to be included in 5.8 release.

comments: author: Jean-S?bastien GERARD
body: excellent news ! does it include Bamboo OnDemand ?


author: Marcin Gardias
body: yes, it does


author: Jean-S?bastien GERARD
body: thanks :) looking forward to seeing that !


author: Jean-S?bastien GERARD
body: Thanks for your answer Valentin !

I've added my vote to these issues :smile:


author: karailiev
body: P.S.I found following improvement cases in Atlassian's JIRA.I hope by more people voting for them, they may soon be implemented:<https://jira.atlassian.com/browse/BAM-13275><https://jira.atlassian.com/browse/BAM-15151>


author: karailiev
body: Hi,I think your question makes sense.Here is my similar scenario:I'm also working on a PHP project, I'm also deploying my code with git.I have following environments: ci (automated testing), test (manual testing), staging and production.My goal is to have:1. automated deployment on ci2. automated test cases to be executed against ci3. if automated cases pass, then automated deployment on test4. manual execution beyond this pointCurrently I'm achieving this by deploying on ci during the build phase.This enables me to have conditional triggering of the test deployment.However, this is not a perfect solution:1. It wouldn't work if I wanted to have more deployments chained, unless I put them all in the build phase.2. I don't have a release number generated at the build phase, so I have to use another common piece of information (e.g. revision), which I don't like.So again, yes, your question makes so much seance and I really see no reason to have this implemented in Bamboo.Regards,Valentin


Tags: cloud

php

phpunit

ssh