How to get a list of plan and job results from the Bamboo database

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

本記事で説明している手順は、現時点でのものとなります。そのため、一部のお客様で特定の状況下で動作したという報告がありますが、正式にサポートされているわけではなく、お客様の特定のシナリオで動作することを保証するものではありません。

本番環境での実施の前に一通り非本番環境で検証し、成功しなかった場合にはサポートされている代替案にフォール バックしてください。

また、アトラシアン サポートのサポート対象外のご質問の場合には、Community もご活用ください。

要約

This document will show you how to get a list of plan and job results from the Bamboo database with details such as the job's duration, build status, and many others.

環境

All supported versions of Bamboo.

ソリューション

The table that stores information about plan results (including job results) inside Bamboo is called BUILDRESULTSUMMARY. You will find most of the information displayed in the build and job result summary pages in Bamboo inside this database table. The following select query will produce a list with the results of all jobs inside your Bamboo instance:

The select queries below have been tested on PostgreSQL. You may need to make changes to the queries to ensure they work in a different DBMS e.g. Oracle, MySQL, and etc.

Job results
select * from buildresultsummary where build_type = 'BUILD';

You will find many details about every job including the job duration, job status, the ID of the agent that built it, number of failed tests, and many others. If you wish to include the plan results alongside the results of its jobs you can use the following select instead:

Job results (incl. plan results)
select * from buildresultsummary brs1 join buildresultsummary brs2 on brs1.chain_result = brs2.buildresultsummary_id;
More information about the select query...

The BUILDRESULTSUMMARY table holds results for both plans and jobs. In order to get a list of jobs and their corresponding plans we did a self join in the table BUILDRESULTSUMMARY table on columns chain_result and buildresultsummary_id. This is because jobs are linked to plans through the chain_result column. Jobs have the buildresultsummary_id of the plans they belong to under the chain_result column.

Below we will highlight the differences between two of the columns that you will see in the results named duration and processing_duration:

DURATION
  • For plan results duration is the total time jobs within all stages of the plan took to complete.
  • For job results duration is the total time that a particular job took to complete.
Processing duration
  • For plans processing_duration is the total time jobs within a certain stage took to complete + the time they spent in the queue. 
  • For job results processing_duration does not include the time it spent in the queue.

You can separate plan results and job results using the build_type column inside the BUILDRESULTSUMMARY table. Job results have a build_type BUILD while plan results have a build_type CHAIN.

  • The reason why we need this distinction is because builds don't always start building the moment they are triggered. They first need to enter the queue and wait to get assigned to an available agent that's capable of building them and this can take time.
  • Values are displayed in milliseconds in the database but seconds in the build and job result summary pages.
  • The Duration field in the build result summary corresponds to the duration column inside the BUILDRESULTSUMMARY table and not processing_duration. This means duration in the build result summary page does not take into account the time jobs spent in the queue waiting for an agent.
最終更新日 2022 年 9 月 7 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.