Bamboo Pipeline for Azure
Deploying from an internal Bitbucket Server to the Azure cloud
A CD/CI requirement has been given to you by the head of engineer on how to integrate to the Azure cloud for deploying an App Service. The App Service being deployed cannot connect directly to your internal, local to your organization, Bitbucket repo that does not allows you access to pipelines or other features from Atlasian. This is a simple process failing to deploy and because a headache no one want to take on, but it is assigned to you. Luckily, or so they say, your organization is fully invested in the Atlasian suite of products that contain: Jira, Bitbucket, Wiki, and Bamboo... lagging several versions behind the most recent stable ones.
How 2 Go About It?
Refinement of the solution can be done later, so focusing on the key actions to get this working is to do the following:
Local Bitbucket Steps
- Login to the web interface of your Bitbucket
- Go to Manage Account
- Select Personal access tokens
- Click on Create a token
- Set the Token name and click on Create
- Copy the token for later use on your bamboo script
Azure App Service Steps
- Login to your Azure account
- Select your App Service in the portal
- Navigate to the Deployments section of your App Service
- Select the source to be Local Git/FTPS
- Copy the generated Git Clone Uri
- Select the Local Git/FTPS Credentials tab
- Set your User scope by creating a username and password
Bamboo Steps
- Create a bamboo plan
- Add a Script task
- Add the text description
- Set the interpreter to be of type Shell
- Set the script location to be Inline
- Add the git commands as shown in the Sample Script section
- Go to the Requirements tab for the Default Job and add Git as a required capability
- Go to the Default plan configuration and select the Variables tab
- Create variables for your repo folder name, local repo, local access token, azure git username, azure git password (from the User Scope)
- Run your plan
These are a solid set steps that will get your code from your internal git repo to your Azure cloud App Service consistently. In my case I have using to deploy Python services for Flask and Tornado App Services. The script can be modified to run unit tests before pushing to the Azure App Service, however testing it is an article on its own.
Merry building and happy new deployment!