このページでは、コマンド (例: Bash) 実行可能ファイルを使用する Bamboo タスクの設定方法をご説明します。

See  Configuring a builder task for an overview of Bamboo builder tasks.

コマンド タスクを設定するには、次の手順に従います。

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

    タスクの説明A description of the task, which is displayed in Bamboo.
    このタスクを無効化オンまたはオフにすることで、選択的にこのタスクを実行します。
    実行可能ファイル

    タスクを実行するために利用できるコマンド実行可能ファイル (例: Bash)。選択した実行可能ファイルは、タスク (またはジョブ) の要件の 1 つとなります。

    引数
    (Optional) The relevant argument to pass to the command. Note that arguments which contain spaces must be quoted. You can include variables (see Bamboo variables).
    環境変数(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 Using global, plan or build-specific 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 はルート ディレクトリでビルド ファイルを検索します。このオプションは、サブディレクトリ内にビルド スクリプトがあり、実行可能ファイルをそのサブディレクトリ内から実行する必要がある場合に便利です。
  4. 保存をクリックします。

12 Comments

  1. Anonymous

    Is there any way of passing commands with quotes, without Bamboo sticking newlines in there?  e.g. I want to run "cmake -G "Unix Makefiles" ../folder" (note that the quotes around "Unix Makefiles" need to stay there)

  2. Anonymous

    I have the same problem.  It causes my task to fail because the command I am trying to execute requires the arguments, but they are on another line.  It somehow interpolates from the custom Executable and Argument fields into this

     \n/usr/local/bin/build_perl_for_bamboo\n -b 8\n

    Full log line entry:

    22-Jan-2013 11:26:24	Beginning to execute external process for build 'My Proj - subproj - subsub - main - Default Job'\n ... running command line: \n/usr/local/bin/build_perl_for_bamboo\n -b 8\n ... in: /opt/atlassian-bamboo-agent/xml-data/build-dir/MYPROJ-MAIN-JOB1\n
  3. Josh

    Can a custom command executable produce test results?  It seems like this capability was available in past releases (Custom Command Executable), but I've been unable to figure out where to specify this.

    I am trying to use the Gradle wrapper to build and test our project.  My plan configuration consists of a single stage, with a default job.  The tasks of the job are "source code checkout" and "command", where the command is "./gradlew check".  If tests fail, the build fails but test results are not reported.  There's no place that I can find to specify that "this build produces test results."

    Thanks!

    1. Would using a JUnit Parser task to the Job after your command executable task not work for you?

      1. Anonymous

        I had originally tried to do this but was confused with the quarantine / unleash process.  I would quarantine a failing test, run the custom executable, the test would fail, and then the JUnit Parser task would run.  The output from the parser task indicated first that it failed, then that it was changing its failure status to success since all failing tests were quarantined.  But the overall build would still fail.

        It took me a while to figure out, but the custom command was exiting with a non-zero status, then the parser task was running and exiting successfully.  I had to set the gradle test task to "not break the build" when the verifications failed.  (http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:ignoreFailures)

  4. Chris Marshall

    I need to write a very simple command: /usr/bin/unzip

    Some of the files in my repository are checked in as zipped (several reasons nonnegotiable -they must remain zipped).

    I need to unzip them, but the command tells me that it can't find the files.

    Obviously, I am relating from the wrong working directory.

    It was my assumption (ASS out of U and ME) that the working directory was the job root directory, which I thought was one level down from the root directory specified on the (remote) agent's config.

    That one down would be the job dir.

    So, if the root was set to /autobuild , and the job dir was /autobuild/JOB-Daily-1 , I would assume the latter (/autobuild/JOB-Daily-1) would be the base for a relative path for the working directory and input for the executable.

    Can someone clue me in on my mistake?

    Thanks!

  5. Anonymous

    Trying to execute command

    /bin/bash etc/stage-deploy.sh

    but it failes, no explanation. From command line where the project is checked out it works perfectly!

  6. Anonymous

    I have the following issue:

    I need to run a command that launches an external application. But I need the build to keep going instead of waiting for the application to "finish". Is this possible? I've tried with Script and Executable and both wait for the external app to close. I even tried placing the command inside a bat file and calling this bat from Script but still it waits on the launched app to finish.

     

    Is there any way to accomplish what I described above?

    Thanks.

  7. NathanA

    Have you tried to adapt your script so that it starts the external application as a background task?

  8. Anonymous

    Hi Nathan,

     

    Thank you for your reply. Yes I've started the app using start "" /B <exe> <args>.

    Also tried without the /B, tried inline script, file script (from bat), even tried adding the Executable as a capability.

    But the result is always the same, the build stops at the step where it opens the application and doesn't continue until I go to the agent and close the application (which I can't do since I need it running during the build).

     

    Any ideas?

    Thanks.

    1. ArmenA

      Which version of Bamboo are you using? In the latest Bamboo versions there is a checkbox in the Advanced Options section of Script task configuration page (for PowerShell scripts); try to check that and see if that helps.

      Also, I found these issues - BAM-11488 - Getting issue details... STATUS , BAM-11887 - Getting issue details... STATUS . If you are still facing problems, please create a support ticket on https://support.atlassian.com/ja.

      Armen

  9. Sundog IT

    Is there any way to get the arguments to expand wildcards? For example, if I make a custom command to rm and give it the arguments so that the whole command would look like:

    rm -v ./directory/*.tgz

    It always fails. The only way I've found around this is to make my own shell script and map that as a custom command.

    Any insight?