Run a bitbucket pipeline locally
Project description
Bitbucket Pipeline Runner
Tool to run Bitbucket Pipelines locally.
Installation
The prefered way of installing pipeline-runner is with pipx
pipx install bitbucket-pipeline-runner
Basic usage
To run a pipeline
cd <project-directory>
pipeline-runner run <pipeline-name>
To list available pipelines
cd <project-directory>
pipeline-runner list
Environment variables
bitbucket pipeline runner already sets all BITBUCKET_* environment variables in the step's run environment. It will
also source any .env file in the current directory, for all project specific environment variables.
Artifacts and logs
Persistent data like artifacts generated from your pipelines and execution logs can be found in your user's data directory.
On Linux:
${XDG_DATA_HOME:-~/.local/share}/pipeline-runner
On macOS:
~/Library/Application Support/pipeline-runner
Caches
Caches defined in your pipelines are stored in your user's cache directory. Unlike Bitbucket Pipelines, caches are always saved even if they already exists. This is subject to change in the future, to follow the behaviour of Bitbucket Pipelines.
On Linux:
${XDG_CACHE_HOME:-~/.cache}/pipeline-runner
On macOS:
~/Library/Caches/pipeline-runner
Note: Docker cache is stored in a docker volume instead.
SSH Agent Forwarding
[!WARNING] SSH Agent forwarding is not available for Docker Desktop on Windows
See: https://docs.docker.com/desktop/features/networking/#ssh-agent-forwarding
You can expose your ssh-agent to the container running the pipelines. This is useful if the pipeline needs to clone
from a private repository, for example.
To do so, run the pipeline with the --ssh flag:
pipeline-runner run --ssh <pipeline-name>
[!NOTE] Any personal git and/or ssh configuration won't be available inside the container running the pipeline. If you have more than one ssh key linked to an account on the target git hosting, ensure that the one you need to use is the first one in the agent.
Alternate Platform
To force a different plaform for the pipeline container, you can set the following environment variable:
# Replace linux/amd64 by the target platform
export PIPELINE_RUNNER_DOCKER_PLATFORM=linux/amd64
Note that this affects only the pipeline container, ie. the one that runs your script. It will not affect the services requested by the pipeline.
If you are running on Apple Silicon, you can force docker to run all containers on a different platform:
export DOCKER_DEFAULT_PLATFORM=linux/amd64
[!WARNING] This feature is still experimental
Debugging
A few features are available to help with debugging.
Breakpoints
Breakpoints, or pauses, can be added during the execution of a pipeline. To do so, add a
# pipeline-runner[breakpoint] entry in script:
example_with_breakpoint:
- step:
name: Step with breakpoint
script:
- echo "do something"
- '# pipeline-runner[breakpoint]'
- echo "do something else"
The execution will stop at the breakpoint to allow the user to check the state of the pipeline. Note that the entry must be put in quotes to avoid it being interpreted as a yaml comment.
CPU Limits Enforcing
By default, no cpu limits are enforced, meaning that the pipeline will run as fast as it can. You can mimick the cpu
limits enforced by Bitbucket Pipelines with the --cpu-limits. This is useful to replicate more closely the speed at
which a pipeline runs in the real thing.
Supported features
Most features of Bitbucket Pipelines should work out of the box. If you find something that is not working properly, please open an issue.
| Feature | Supported | Note |
|---|---|---|
| Variables | ✅ | |
| Artifacts | ✅ | |
| Docker Service | ✅ | |
| Caches | ✅ | |
| Custom Caches | ✅ | |
| Private Runner Images | ✅ | |
| Pipes | ✅ | |
| Parallel Steps | ✅ | The steps will run, but in sequence. |
| OIDC | ✅ | OIDC Setup |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bitbucket_pipeline_runner-0.6.0.tar.gz.
File metadata
- Download URL: bitbucket_pipeline_runner-0.6.0.tar.gz
- Upload date:
- Size: 36.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25b11b587a0659a0ba935e50bd476ec1bb415f49636aeaa9b88cb277a1ef5692
|
|
| MD5 |
82662b9baebaa811a1cf80e622b551ff
|
|
| BLAKE2b-256 |
fa8448d85a62d20c2acfb6b1b696d742ea920ff0d25d0332e194a7f025d4a077
|
Provenance
The following attestation bundles were made for bitbucket_pipeline_runner-0.6.0.tar.gz:
Publisher:
release.yml on mathieu-lemay/pipeline-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bitbucket_pipeline_runner-0.6.0.tar.gz -
Subject digest:
25b11b587a0659a0ba935e50bd476ec1bb415f49636aeaa9b88cb277a1ef5692 - Sigstore transparency entry: 779114549
- Sigstore integration time:
-
Permalink:
mathieu-lemay/pipeline-runner@e9eb7a88b48d89c2e2c9f99656def8f33a30025d -
Branch / Tag:
refs/tags/0.6.0 - Owner: https://github.com/mathieu-lemay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e9eb7a88b48d89c2e2c9f99656def8f33a30025d -
Trigger Event:
push
-
Statement type:
File details
Details for the file bitbucket_pipeline_runner-0.6.0-py3-none-any.whl.
File metadata
- Download URL: bitbucket_pipeline_runner-0.6.0-py3-none-any.whl
- Upload date:
- Size: 42.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e12894c77d77e6b379fd939fff34c5e304903a86c9698854d321bd152de4f2bd
|
|
| MD5 |
cfc6aa91a84e498b0a17dd93a5c289d4
|
|
| BLAKE2b-256 |
c48f404e413e88dc9452974543e300995c34200cb134b11468ebcfb974c47e8d
|
Provenance
The following attestation bundles were made for bitbucket_pipeline_runner-0.6.0-py3-none-any.whl:
Publisher:
release.yml on mathieu-lemay/pipeline-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bitbucket_pipeline_runner-0.6.0-py3-none-any.whl -
Subject digest:
e12894c77d77e6b379fd939fff34c5e304903a86c9698854d321bd152de4f2bd - Sigstore transparency entry: 779114550
- Sigstore integration time:
-
Permalink:
mathieu-lemay/pipeline-runner@e9eb7a88b48d89c2e2c9f99656def8f33a30025d -
Branch / Tag:
refs/tags/0.6.0 - Owner: https://github.com/mathieu-lemay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e9eb7a88b48d89c2e2c9f99656def8f33a30025d -
Trigger Event:
push
-
Statement type: