Need help setting the pipeline - php & gae
Asked by oupamoloi_dev:

Hi guys,

I'm new to using pipelines, I need guidance on how to setup one and test it.

the type of pipeline i need is the one that deploys code to the production server


Answers:
author: ktomk
body: Welcome! Sounds like you're looking for a deployment step, please check out the following resources that should lead you to some useful information:

* [Build, test, and deploy with Pipelines](https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/)

Specifically for setting up deployments:

* [Set up and monitor Bitbucket Deployments](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-monitor-bitbucket-deployments/)
* [Set up Bitbucket Deployments](https://support.atlassian.com/bitbucket-cloud/docs/set-up-bitbucket-deployments/)

For deploying with/to Google App Engine (GAE), you either need the GAE SDK image or more specialized in Bitbucket Pipelines you can make use of the GAE deployment pipe:

* [Offical GAE Docker Image](https://hub.docker.com/r/google/cloud-sdk/)
* [Atlassian Bitbucket GAE Deployment Pipe](https://bitbucket.org/atlassian/google-app-engine-deploy/src/master/)

The pipe image is based on the official GAE Docker image which is providing the "gcloud" utility, my recommendation is to have the Pipeline similar to what you can do locally and therefore I would suggest to start with the offical GAE Docker image.

Put the command to deploy into the pipeline step script, use the GAE image in that step, setup the deployment and bind it to that step (see *Step 2: Configure your deployment steps* in *[Set up Bitbucket Deployments](https://support.atlassian.com/bitbucket-cloud/docs/set-up-bitbucket-deployments/)*)

**Testing your Pipeline**

Testing a Pipeline is outlined in *[Debug pipelines locally with Docker](https://support.atlassian.com/bitbucket-cloud/docs/debug-pipelines-locally-with-docker/)* (Atlassian Support Bitbucket Resources).

For running, testing and debugging Bitbucket Pipelines, I can also recommend [a local pipelines runner named *pipelines*](https://ktomk.github.io/pipelines/), e.g. as you might have PHP and you may already have Docker installed locally:

* [Pipelines Homepage](https://ktomk.github.io/pipelines/)
* [Pipelines on Github](https://github.com/ktomk/pipelines)
* [Pipelines Composer/Packagist package](https://packagist.org/packages/ktomk/pipelines)

(full disclosure: I'm the author of that utility) Caveat: Throwing more tools onto your problem might not lead you to better answers per-se. E.g. if you don't have Docker installed locally yet, install it and start with the directions of *[Debug pipelines locally with Docker](https://support.atlassian.com/bitbucket-cloud/docs/debug-pipelines-locally-with-docker/)* first to better understand how Bitbucket Pipelines work and how to do things in detail locally.

The *pipelines* utility adds some more options like validation and verification (e.g. dry-run) as well as running Bitbucket Pipelines locally *similar* to remote with a limited feature set, behind the scenes it just runs the step scripts in Docker containers defined in the *bitbucket-pipelines.yml* file. The benefit of it are faster iterations on bitbucket-pipelines.yml changes and getting the base setup to work. It does not have support for Pipes (yet), so there are some limitations, just saying.


Tags: bitbucket-pipelines