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.
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.
...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events