This is the documentation for Bamboo 5.6. View this page for the

Unknown macro: {spacejump}

of Bamboo, or visit the latest Bamboo documentation.

このページでは、スクリプト実行可能ファイルを使用する Bamboo タスクの設定方法を説明します。Linux では Bash を、Windows ではバッチ ファイルをそれぞれ使用できます。

スクリプト タスクを設定するには、次の手順を実行します。

  1. ジョブのタスク設定タブに移動します(新しいプランを作成するとデフォルト ジョブとなります)。
  2. 目的のスクリプト タスクの名前をクリックするか、タスクを新規作成する場合は [タスクを追加] > [スクリプト] の順にクリックします。
  3. Complete the following settings:

    スクリプトの設定
    タスクの説明A description of the task, which is displayed in Bamboo.
    スクリプトの場所スクリプト ファイルの場所を選択します。
    • File — enter the location of the file in the Script file field. This can be either relative to the repository root of the plan, or absolute. You can include variables (see Bamboo variables).
    • インライン - [スクリプト本文] フィールドにスクリプトを入力します。
    引数

    Specify an argument to pass to the script. Arguments that contain spaces must be quoted. You can include variables (see Bamboo variables).

  4. 必要に応じて、環境変数と作業ディレクトリの設定を指定します。

    環境変数

    (Optional)  Additional system environment variables that you want to pass to your build. Note that existing environment variables are automatically available to the executable. You can also include Bamboo global or build-specific variables (see Bamboo variables).
    Multiple variables should be separated with spaces. Parameters with spaces must be quoted (e.g ANT_OPTS="-Xms200m -Xmx700m").

    Working Sub Directory(オプション)  Bamboo が実行ファイルを実行する、ジョブのルート ディレクトリに相対的な代替サブディレクトリ。ルート ディレクトリには、ジョブの構成済みソース リポジトリから確認されたものがすべて含まれます。このフィールドを空白のまま残した場合、Bamboo はルート ディレクトリでビルド ファイルを検索します。このオプションは、サブディレクトリ内にビルド スクリプトがあり、実行可能ファイルをそのサブディレクトリ内から実行する必要がある場合に便利です。
    Powershell スクリプトとして実行(オプション、Windows のみ).bat ファイルを解釈する cmd.exe ではなく Powershell でスクリプトを実行するには、「Powershell スクリプトとして実行」チェックボックスをチェックします。インライン エディタは Powershell 構文をサポートします。

  5. 保存をクリックします。

An example that calls a Python script (on a Linux machine):

4 Comments

  1. drcheeves

    inline scripts don't work with escaped xml characters 

    • &
    • <
    • >
    • "
    • '

    JIRA incident logged here:

    BAM-13207 - Getting issue details... STATUS

  2. Matt Jernigan

    Okay, I REALLY don't understand why this task is built this way.  If I have both Windows and Linux build agents, then the only way to get jobs with a Script task to choose the right agent is to add a custom capability to each agent indicating what kind of script it can run (bash or batch, Windows or Linux, whatever) and then to also add a requirement to each job indicating one or the other.  This looks like unnecessary complexity for something that could have been easily automated by adding OS and/or script type capabilities to the default agent capabilities (how hard could that be?) and then providing two or three different script tasks to choose from (bash, batch and/or Powershell) instead of just this singular identity-confused one.

    1. paulwatson

      Hi Matt - yep, agree with you on this. I've raised https://jira.atlassian.com/browse/BAM-15189, and quoted your comment above. Please comment further on that issue if you want.

  3. Gerard Iglesias

    Hello,

    How do we configure Bamboo to use bash instead of sh, there are some limitation that we don't understand, like source or . is not available to the scripting capability.

    Thanx in advance