NPM does not work if macagent starts from plist

Danny Kroeze February 16, 2021

Hello,

 

I created a Plist so that my mac remote agent can start automatically, but if the macagent starts through the plist it says that npm is not available. If I start the macagent manually the npm works fine.

 

The plist file:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

  <dict>

   <key>Label</key>

   <string>com.atlassian.bamboo-agent</string>

   <key>ProgramArguments</key>

   <array>

   <string>/Users/name/bamboo-agent-home/bin/bamboo-agent.sh</string>

   <string>console</string>

   </array>

   <key>RunAtLoad</key>

   <true/>

   <key>KeepAlive</key>

   <true/>

   <key>UserName</key>

   <string>name</string>

</dict>

</plist>

 


I would like to know what to change in my plist file so that npm works.

1 answer

0 votes
Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 16, 2021

services have user scopes. you can run npm but your service cannot. Try this:

 

make sure to use the needed username instead of 'USERNAME_RUNNING_BAMBOO' and specify the correct path to the start-bamboo.sh (BAMBOO_INSTALLATION_PATH).

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>Label</key>
                <string>com.atlassian.bamboo</string>

                <key>UserName</key>
                <string>USERNAME_RUNNING_BAMBOO</string>

                <key>ProgramArguments</key>
                <array>
                        <string>BAMBOO_INSTALLATION_PATH/start-bamboo.sh</string>
                        <string>-fg</string>
                </array>
                
                <key>SessionCreate</key>
                <true/>

                <key>RunAtLoad</key>
                <true/>
        </dict>
</plist>

source: https://confluence.atlassian.com/bamkb/configuring-bamboo-to-start-automatically-on-startup-on-mac-os-x-302812729.html

Danny Kroeze February 17, 2021

Hello,


Thanks for your reply. The only difference I can see is this:

<string>-fg</string>

                <key>SessionCreate</key>
                <true/>

 The macagent is able to start through the plist, but NPM is not working. I can also see that the remote agent is online/idle. 

I first tried to follow the documentation from Confluence, but we have to run it in launchagent, and it was not working(not even getting the remote agent online with that documentation). So I followed this documentation: https://mgrebenets.github.io/mobile%20ci/2015/02/01/bamboo-remote-agent

(I only followed the launchagent part, because we have a correctly configured remote agent)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events