Bamboo Remote agent running as a Windows Service does not pick up the PATH variable correctly

お困りですか?

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

コミュニティに質問

プラットフォームについて: 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 は除く

The behaviour described in this document applies to Bamboo versions below 6.10.

If you have upgraded your Bamboo instance to a version above or including 6.10 then verify that you have also upgraded the agent wrapper on all remote agents. This process is described in the page  "Bamboo remote agent installation guide" section in the Are you upgrading your version of Bamboo?

要約

Bamboo Remote agent running as a Windows Service does not pick up the PATH variable correctly.

環境

Bamboo 6.10 or earlier

診断

Having a user variable PATH set for the local user account, having a system variable PATH variable set and running the Bamboo (or remote agent) Service as a local user account will cause %PATH% to contain only the user variable PATH. It does not append the user PATH to the system PATH.

例:

User variable PATH: c:\foo
System variable PATH: c:\program files\perforce;c:\python27;c:\whatever
 
$> echo %PATH% 
c:\foo

Commands run on the remote or local agent that exists on the system PATH will fail with:

'<command>' is not recognized as an internal or external command

原因

This problem is related to a bug in Java Service Wrapper (http://sourceforge.net/p/wrapper/bugs/168/) which is used by Bamboo  BAM-16205 - Getting issue details... STATUS

ソリューション

  1. Upgrade Bamboo to any version above 6.10.2.
  2. After upgrading, perform a manual agent wrapper update as explained in this page -  Bamboo remote agent installation guide under Are you upgrading your version of Bamboo?... section.

(info) If the upgrade is not possible, please follow one of the following available workarounds

回避策 1

  1. Manually move entries in the user variable PATH by either:
    1. Moving all the entries out of the user variable PATH into the system variable PATH or
    2. Moving all entries out of the user variable PATH into a new user variable LOCAL_PATH. Append %LOCAL_PATH% to the system variable PATH
      1. 例: PATH=C:\Program Files\perforce;%LOCAL_PATH%
  2. Delete the user variable PATH so it no longer overwrites the system variable PATH.

Alternatively, you could do the reverse and the move contents of the system variable PATH into the user variable PATH.

Make sure the user is the same user which is running the Bamboo remote agent.

回避策 2 

Only applicable for remote agents

  1. Shutdown Bamboo Remote Agent
  2. Download the latest Java Service Wrapper: https://download.tanukisoftware.com/wrapper/3.5.35/wrapper-windows-x86-32-3.5.35.zip
    Java Service Wrapper Community Edition only has 32 bits for Windows.
  3. Extract it to an empty directory
  4. Replace the following files:
    1. <bamboo-agent-home>\bin\wrapper.exe
    2. <bamboo-agent-home>\lib\wrapper.dll
    3. <bamboo-agent-home>\lib\wrapper.jar
    with
    1. \path\to\wrapper-windows-x86-32-3.5.35\bin\wrapper.exe
    2. \path\to\wrapper-windows-x86-32-3.5.35\lib\wrapper.dll
    3. \path\to\wrapper-windows-x86-32-3.5.35\lib\wrapper.jar
  5. If the machine only has 64-bit JDK
    1. Install 32-bit JDK to an empty directory
    2. Edit the file <bamboo-agent-home>\conf\wrapper.conf to configure the full path to 32-bit JDK: 

      wrapper.java.command=\full\path\to\32bit\jdk\bin\java
  6. Start the Remote Agent Windows Service

回避策 3

Run Bamboo or the agent as a console application instead of a service via:

  • <bamboo-agent-home>\bin\start-bamboo.bat
  • <bamboo-agent-home>\bin\BambooAgent.bat

回避策 4

If PowerShell version is version 5.1 it is suggested to not set HTTP_PROXY/HTTPS_PROXY environment variables

Instead of this it is recommended to use System proxy settings.

Please refer https://docs.microsoft.com/en-us/powershell/azure/az-powershell-proxy?view=azps-7.2.0



最終更新日: 2024 年 2 月 28 日

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

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