Skip to main content

The missing tool to extract reports about projects you build on Bitrise

Project description

Bitrise Reports

Flake8 Black Quality Coverage PyPI Main License

What

A simple cruncher for numbers derived from builds you run on Bitrise CI. Useful if you are in charge of managing infrastructure capacity related to Bitrise, like detecting/reporting anomalies, evaluating queues impact and so on.

Main features:

  • Backed by Bitrise REST API under the hood
  • Can compute timing (queued, running and total execution time) for all builds in the given time window
  • Can compute build statuses (success, failure or aborted) for all builds in the given time window
  • Results can be filtered by Git branch (eg master or main)
  • Result are detailed per machine type and also per Workflow
  • Supports emulation of consumed Bitrise Velocity credits (for Enterprise customers)
  • Report types : CLI (stdout), JSON and Excel spreadsheet

This tool is implemented with Python, being tested with versions 3.8.x, 3.9.x and 3.10.x

Installing

With pip

Install bitrise-reports with pip

$> pip install bitrise-reports

With Docker

$> docker pull ghcr.io/dotanuki-labs/bitrise-reports

Using

Let's say you want analyse numbers for the project android-flagship, learning from builds that ran during April of 2021. You'll firstly need a Bitrise Personal Access Token for that. Note you must be a member in the project you want to analyse.

By running

$> bitrise-reports \
    --token=$BITRISE_PAT_TOKEN \
    --app=android-flagship \
    --starting=2021-04-01 \
    --ending=2021-04-30

you should get something like that on your CLI

which is a simple overview of what happened.

Let's say now that you want to learn about how much time you are spending with queued builds.

You can run then

$> bitrise-reports \
    --token=$BITRISE_PAT_TOKEN \
    --app=android-flagship \
    --starting=2021-04-01 \
    --ending=2021-04-30 \
    --detailed-timing

and get a report like this one

Last but not least, suppose you want to learn about execution status for all your Workflows that you run for events in your master branch (eg, push or a scheduled build).

You can run

$> bitrise-reports \
    --token=$BITRISE_PAT_TOKEN \
    --app=android-flagship \
    --starting=2021-04-01 \
    --ending=2021-04-30 \
    --target-branch=master \
    --detailed-builds

and get a report like about that too

Command line interface

The complete list of CLI options:

Option Details Required
token Personal access token for Bitrise API Yes
app The title of your app in Bitrise Yes
starting Starting date in the target time frame Yes
ending Ending date in the target time frame Yes
detailed-builds Details all statuses (success, failure and abortion) for builds No
detailed-timing Details timing (queued, running, total execution) for builds No
emulate-velocity Estimate Bitrise Velocity credits consumed No
target-branch Filters build by Git branch No
report-style The style of report you want No

where

  • starting and ending follow YYYY-MM-DD convention
  • report-style accepts stdout (default), json or excel
  • detailed-timing is a CLI flag
  • detailed-builds is a CLI flag
  • emulate-velocity is a CLI flag

If you opt-in for a specific report style, the corresponding file - bitrise-metrics.json or bitrise-metrics.xlsx - will be written in the same folder you are runnint bitrise-reports.

Running with Docker

Given the current definition for the Container Image, all the previous examples are straitghtforward to run on top of Docker:

$> docker run --rm ghcr.io/dotanuki-labs/bitrise-reports \
    --token=$BITRISE_PAT_TOKEN \
    --app=android-flagship \
    --starting=2021-04-01 \
    --ending=2021-04-30 \
    --detailed-builds

When exporting reports (JSON or Excel) you should mount your current path upon Container's workdir

$> docker run --rm -v "${PWD}:/reports" ghcr.io/dotanuki-labs/bitrise-reports \
    --token=$BITRISE_PAT_TOKEN \
    --app=android-flagship \
    --starting=2021-04-01 \
    --ending=2021-04-30 \
    --report-style=excel

Contributing

If you want to contribute with this project

$> make setup
  • Code you changes
  • Make sure you have a green build
$>  make inspect test
  • Submit your PR 🔥

Author

  • Coded by Ubiratan Soares (follow me on Twitter)

License

The MIT License (MIT)

Copyright (c) 2021 Dotanuki Labs

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitrise-reports-0.2.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

bitrise_reports-0.2.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file bitrise-reports-0.2.0.tar.gz.

File metadata

  • Download URL: bitrise-reports-0.2.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.4.0-1059-azure

File hashes

Hashes for bitrise-reports-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a33392412a6216e1ef61c478bb2549786dfc619fff0861a18b74124db2dce200
MD5 6c8f772988aad8f5b5c03553e7ded4ef
BLAKE2b-256 acaf2801bcf94e017e270af788eed12526f0781b53da7f4839af4adf656f73b3

See more details on using hashes here.

File details

Details for the file bitrise_reports-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bitrise_reports-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.4.0-1059-azure

File hashes

Hashes for bitrise_reports-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 388508e6cfe63907c86198fbc3850a3faf801089da7a548481898f07a26e3fea
MD5 75ef8c732d041bb4d61d946799fe6f48
BLAKE2b-256 9eea91bea36b3f5442a16316940c6a0a918f8ae6eaff0a119ce211d78b378363

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page