PHP Build Task from Cory Fowler’s DevOps PHPWorld Presentation

Importer

As you may have seen from the DevOps presentation I have been hanging out with Cory lately…

For his PHPWorld Presentation we teamed up to see how hard it would be to get our DevOps demo working with PHP.  Specifically creating a CI build for PHP and as part of that pipeline run a load test…turns out it was a piece of cake and it took longer to write this post than get it set up!!

Below are the steps to create a release pipeline with PHP using Composer and Visual Studio Online

Step 1. Check in your PHP Project

image

In this case we used Cory’s super simple Composer Sample  https://github.com/SyntaxC4-MSFT/WAWS-Composer

Step 2. Add a Custom Build Task in VSO to Package your PHP Application

Creating a custom build task is pretty straightforward and requires these steps

  1. Download the Build Task sample: Composer.Zip from here
  2. Install Npm https://nodejs.org/dist/v4.2.2/node-v4.2.2-x86.msi
  3. Install the TFX-CLI by running: npm install -g tfx-cli
  4. Run tfx login. (requires PAT which can be created using these directions http://roadtoalm.com/2015/07/22/using-personal-access-tokens-to-access-visual-studio-online/)
  5. tfx build tasks upload ./ComposerTask

(Jeff Bramwell did a great post on creating a Build task…If you go through his walk through just be aware the **tfx build tasks create **is currently broken so I have uploaded my sample here)

Step 3. Create a Build that Uses the Composer Task created above

1. One the Build Task hit the green action button and select the “Empty” Template

image

2. As this build will require PHP and Composer to installed on the Build agent please Press Next and select the on premises agent as described in Cory’s blog and then press Create

image

3. Adding a task to your Build you will see in the Package category the Composer Task created in Step 2.  While there are options you send to composer the default will package your PHP application.

image

4. Verify the deployment was successful

Adding a quick web performance test will easily tell you whether your deployment was successful (Oft times that packaging and deploying will “succeed” but the application has run time issues)

image

Set up the parameters for your quick performance test:

image

To create a registered Connection you must go to control panel add a generic service…

**REMEMBER THIS REQUIRES A PAT OR ALTERNATE CREDENTIALS. **

I always seem to forget this!  Directions for setting that are here:

http://roadtoalm.com/2015/07/22/using-personal-access-tokens-to-access-visual-studio-online/

image

At this time you are ready to save and QUEUE NEW BUILD BABY!

Attachment: ComposerTask.zip

<p><a></a></p>

0 comments

Discussion is closed.

Feedback usabilla icon