Bitbucket Pipelines
Bitbucket Pipelines provides a powerful CI/CD solution integrated with your Bitbucket repositories. This guide explains how to use Bitbucket Pipelines to automate the build and deployment of Martini packages, including how to configure and use the martini-build-pipeline-utility
.
Overview
Bitbucket Pipelines simplifies the process of building and deploying Martini packages by automating these tasks within your Bitbucket environment. The martini-build-pipeline-utility
helps you upload a Martini package directly to your Martini instance as part of your CI/CD process.
Steps to Configure Bitbucket Pipelines
-
Access the Bitbucket Pipelines Code: The configuration code for Bitbucket Pipelines is available on Lonti's Bitbucket account. You can access it here.
-
Reference the Code in Your Pipeline: Follow the instructions provided in the Martini-Sample Package Repository to integrate the code with your Bitbucket Pipelines configuration. This typically involves adding the following snippet to the
script
section of yourbitbucket-pipelines.yml
file:1 2 3 4 5 6 7 8 9 10 11
- pipe: docker://lontiplatform/martini-build-pipeline-utility:2.0.0 variables: BASE_URL: "<string>" MARTINI_ACCESS_TOKEN: "<string>" PACKAGE_DIR: "<string>" PACKAGE_NAME_PATTERN: "<string>" ASYNC_UPLOAD: "<string>" PACKAGE_DIR: "<string>" SUCCESS_CHECK_TIMEOUT: "<integer>" SUCCESS_CHECK_DELAY: "<integer>" SUCCESS_CHECK_PACKAGE_NAME: "<string>"
-
Configure Your Pipeline: Customize the pipeline configuration to match your repository and deployment needs. This may include setting environment variables, secrets, or custom build commands. Ensure to configure the following required variables for the
martini-build-pipeline-utility
:Variable Required Usage BASE_URL Yes Base URL of the Martini instance MARTINI_ACCESS_TOKEN Yes The user's access token, obtainable via Martini or through the Lonti Console PACKAGE_DIR No Root directory containing packages (defaults to packages
if not specified)PACKAGE_NAME_PATTERN No Regex pattern to filter which package directories to include. Defaults to .*
(all directories).ASYNC_UPLOAD No If set to true
, tolerates HTTP 504 as a success (used when uploads are handled asynchronously). Defaults tofalse
.SUCCESS_CHECK_TIMEOUT No Number of polling attempts before timing out when checking package deployment status. Defaults to 6
.SUCCESS_CHECK_DELAY No Number of seconds between polling attempts. Defaults to 30
.SUCCESS_CHECK_PACKAGE_NAME No If set, only this specific package is polled after upload. If unset, all matched packages are polled. -
Deploy Packages: With the pipeline configured, Bitbucket Pipelines will handle the building and deployment of your Martini packages according to the pipeline configuration.
-
Build a Docker Image:
You can configure your Bitbucket Pipeline to build a Docker image that includes your Martini package. You can use the Martini-Sample Package as reference for building a Docker Image.
Additional Resources
- Bitbucket Repository: Access the source code and examples for Bitbucket Pipelines.
- Sample Martini Repository in Bitbucket: Access the examples for Bitbucket Pipelines.
- Bitbucket Pipelines Documentation: Official Bitbucket documentation for more information on using Pipelines.