Bitbucket Pipelines
Bitbucket pipelines is Atlassian’s CI/CD tool that is integrated with the cloud version of Bitbucket. It can aid users in creating powerful, automated workflows and deployments.
Pipelines:
If you are deploying to an external server, make sure you contact (Zach Robert) to allow access to the university’s firewall for port 22 to your server from Bitbucket Cloud.
Description | Screenshot | |
---|---|---|
1 | Setting up a repository to use with Pipelines. We’ll use State Licensure as an example. Click on Repository settings. | |
2 | Click on Settings, then slide the toggle to Enable Pipelines | |
3 | Click SSH Keys to enable communication with the server(s) you’ll be deploying your files to. Enter server name or i/p address then click Fetch. Once you see the returned Fingerprint, click Add Host. | |
4 | Click Deployments to setup the environments you’ll be using. For this example, we’ll use Test and Production. We’ll see how it’s used in the file, bitbucket-pipelines.yml. You can add additional environments, if needed. | |
5 | Click the down mark to expand the Test section. We’ll add two variables, SFTP_USER and SFTP_SERVER which will be referenced in the bitbucket-pipelines.yml file. You have the ability to secure the value, if needed. | |
6 | Click the down mark to expand Production section. You can add the same variable names as in Test, if you want, to be consistent with the bitbucket-pipelines.yml file. | |
7 | Example bitbucket-pipelines.yml file. This file should be put in the root directory of your files. options: size: the minimum required is 4x. 4x and 8x pipelines size options are only available for builds running under a paid Bitbucket Cloud plan (Standard or Premium). runtime: the runtime configuration to be applied to the step. Use cloud option. Set atlassian-ip-ranges to true. image: image: to use a different Docker image. definitions: definitions: starts the YAML file by declaring that we will define steps below steps: any number of steps or deployment options that will be defined below step: a deployment option, like deploy-test or deploy-prod.
pipe: list the name and version of the pipe being used, under which contains the variables that will be passed to the pipe. Please see Bitbucket's list of pipeline integrations for all pipe options
| |
8 | pipelines: the start of the process default: this step will run on any commit to any branch. If you only have one branch, master, it will run immediately after the commit. Using the example from above, it will run &deploy-test step. custom: will run manually. This will run &deploy-production step from above. | |
9 | Manually run the custom step. Click Run pipeline, select the Branch, then select default and click Run. | |
10 | There are two variables set at the workspace for the SSH Key, if required to deploy to an external server as we did with Bamboo.
|
|
11 | Linting/error checking. Linting/error checking is enabled for the YAML file if you are editing it on Bitbucket, but you might also want to copy and paste the complete contents of the YAML file into their pipelines validator. This will catch any errors and ensure that the YAML file contains valid structure. |
|