スクリプト

このページの内容

お困りですか?

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

コミュニティに質問

This page describes how to configure a Bamboo task to run a script. The Script task is flexible enough to allow the possibility to use: the default shells on Linux (/bin/sh) or Windows (cmd.exe), a more modern shell on Windows (PowerShell), and an arbitrary shell in Linux by using the shebang on the first line of the script file. This can be controlled by the Interpreter field explained below.

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

  1. Go to the Tasks configuration tab for the job (this will be the default job if creating a new plan).
  2. Select the name of an existing script task, or select Add taskScript if creating a new task.
  3. In the Task description field, enter a description for the task that will appear in Bamboo.

  4. Check or clear Disable this task to selectively run the task.

  5. Optionally, select Add condition to task to make the task run only when a certain condition is met.

    You can find conditions on Atlassian Marketplace or implement your own.  

  6. From the Interpreter menu, select one of the available interpreters:

    • Shell (chooses the interpreter based on the first line of the script, typically using the shebang)
    • Windows PowerShell
    • /bin/sh or cmd.exe (uses the default shell of the operating system: sh for Linux, cmd.exe for Windows)
  7. From the Script location menu, select the location of the script file:

    • ファイル - [スクリプト ファイル] フィールドにファイルの場所を入力します。これは、計画のリポジトリ ルートからの相対パスまたは絶対パスのいずれかです。変数を含めることもできます (「Bamboo 変数」を参照)。
    • インライン - [スクリプト本文] フィールドにスクリプトを入力します。
  8. In the Script body field, enter or paste the code of your script using the syntax appropriate for the selected interpreted.

  9. In the Argument field, specify an argument to pass to the script.

    Arguments containing spaces must be quoted. You can include variables (see Bamboo variables).

  10. Optionally, in the Environment variables field, specify additional system environment variables that you want to pass to your build.

    • Separate multiple variables with spaces. Parameters values containing spaces must be quoted, for example:
      ANT_OPTS="-Xms200m -Xmx700m"
    • Existing environment variables are automatically available to the executable. You can also include Bamboo global or build-specific variables.
    • If the specified Bamboo variable is present during the task execution, the created environment variable will be set to its value. Declared variable values are passed to the task verbatim, which means that they will not get parsed by any other method and will be sent to the script as a literal string. Hence, no further variable expansion is performed. If you want to assign a script variable using the contents from another variable, do that internally within the script task. Learn how to load variables from within a script task


  11. Optionally, in the Working subdirectory field, specify an alternative subdirectory relative to the root directory of the job where Bamboo will run the executable.

    The root directory contains everything checked out from the job's configured source repository. If you leave this field blank, Bamboo will look for build files in the root directory. This option is useful if your task has a build script in a subdirectory and the executable needs to be run from within that subdirectory.


  12. 保存 を選択します。
最終更新日 2023 年 7 月 10 日

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

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