Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using Bamboo with PHP

Christopher Harr May 17, 2016

I have a simple PHP project that requires no building or compiling. I keep all code in Bitbucket server. All I want bamboo to do is check out the code then send it up to the codedeploy module. Sounds incredibly simple but I can't seem to figure out how to get bamboo to do this.

In Bamboo I created a project (lets call it project1) with a plan (call it plan1). This plan looks at a GIT repo (Bitbucket server) with 3 branches (lets call the branches dev, stage, prod). For the build it really shouldn't have to do anything. I'm not compling code or running any unit tests (at least not yet). But bamboo complains if you don't do something so I just do a simple checkout code step. Which works fine and the build is successful.

Now I need to deploy the code to codedeploy. So in bamboo I create a new deployment project (lets call deploy1) looking at the project1->plan1. So far so good. I set up some environments dev, stage, prod. In the dev environment all I want it to do is check out the code and then package up the code to s3. So I thought simply making the task to be checkout code then the codedeploy module would be what I need. However, the checkout code only checks out the "default" branch which is set to prod not dev. This just seems wrong that I cant tell bamboo to use the branch that triggered the build. Is there something I'm missing here? I've set the trigger in the environment to be after successful build looking at the dev branch, but bamboo in the checkout I can see it changing the branch back to prod then deploying the code to S3. So its not an issue with it connecting to S3 as it does dump the zip into my s3 bucket and codedeploy kicks off its bamboo packaged up the wrong branch.

I've also tried making shared artifacts with a pattern of ** to basically say everything and in the build process but bamboo errors saying it failed tests yet I don't have any?

So what is the simple way to checkout code and slam it into the S3 codedeploy module? I can trick it by making 3 repos such as repo1-dev, repo1-stage, repo1-prod but there has to be a cleaner way to do this? Any help would be appreciated.

We are running bamboo on site (5.10.3 build 51020) Bitbucket server (v4.3.2)

 

Thanks!

1 answer

1 vote
jvelapol May 17, 2016

Sounds to me like you have 3 "environments" that you want to deploy, and each of them are managed by changes to 3 respective environments.  I can think of two of ways to do this:

  1. Have 3 "build plans" that are based on each branch, and have 3 deployments that are triggered off those branches.
  2. Have 1 build plan, and enable branching, enabling branches for "dev" "stage" and "prod", then have 3 deployment plans, specifying each branch as the base for those deployments.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events