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

I'd like to run Python and PHP in a Pipelines image. Is that possible?

Daniel Adams May 30, 2019

We're trying to setup a CI/CD pipeline from BitBucket to an AWS EC2 instance running CentOS7.  Our program is a PHP Laravel API, but the only integration examples we've been able to find are written in Python.  We'd like to run Python alongside or as a service to the Pipelines image, so we can leverage the integrations code distributed by BitBucket for AWS deployment.

1 answer

0 votes
Tom Bradshaw
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2019

Hey Daniel,

It sounds like your ultimate goal is just to deploy to EC2. The fact that you have to use python is a side effect of the fact that all the examples you've found are in python.

There are two main ways you can make this deployment easier. The first doesn't use any python and the second does.

You could use our new 'pipes' feature. Pipes are pluggable tasks you can inject into your pipelines to avoid complex scripts or repetition. To use a pipe all you need to do is call it within the script section of your bitbucket-pipelines.yml. The documentation for doing this can be found here https://confluence.atlassian.com/bitbucket/pipes-958765631.html.

By using an EC2 deployment pipe you could avoid having to interact with the python code. An EC2 pipe already exists and can be found here https://bitbucket.org/atlassian/aws-code-deploy/src/master/README.md. This way you can build your application using php and just pass in the path to the code you want to deploy.

The other option is to use different steps with different images, one php step to build the code and another python step to deploy the code. By using different images for the different steps you can isolate which tools are needed for each operation.

To do this define separate steps for building and deploying the code (https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-ci_stepstep). Have the first step export the code you want to deploy as an artifact (https://confluence.atlassian.com/bitbucket/using-artifacts-in-steps-935389074.html) and the add the deployment code to the second step.

If you have any questions let me know.

Cheers,
Tom.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events