Elastic Agent Instance startup script samples

お困りですか?

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

コミュニティに質問

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

要約

Bamboo elastic agents allow you to configure an instance start-up script at Bamboo Administration > Overview > Image Configurations > Edit. This script is executed when the EC2 instance starts. Below are some sample instance-startup scripts to achieve different things which you may find useful as a reference point.

tip/resting Created with Sketch.

Bamboo Global variables are not accessible from the instance startup script text field. Variables are only available to the Elastic agent after it is online.

If you have a specific need for a Global variable in an elastic agent, you can use plan variables along with a script task in a Job.


ソリューション


Adding JAVA options

ここをクリックして展開...

Adding to the instance startup script through the UI Bamboo Administration > Overview > Image Configurations > Edit

For Linux Image

sed -i 's@.*MARKER.*@sed -i "s/-Xmx256m/-Xmx256m -Datlassian.org.osgi.framework.bootdelegation=javax.servlet,javax.servlet.*,sun.*,com.sun.*,org.w3c.dom.*,org.apache.xerces.*/" $startupScript@' /opt/bamboo-elastic-agent/bin/bamboo-elastic-agent

For Window Image

sed -i 's@.*MARKER.*@sed -i "s/-Xmx512m/-Xmx1024m -Datlassian.org.osgi.framework.bootdelegation=javax.servlet,javax.servlet.*,sun.*,com.sun.*,org.w3c.dom.*,org.apache.xerces.*/" $startupScript@' C:\opt\bamboo-elastic-agent\bin\bamboo-elastic-agent.bat

Add it directly to the instance startup script using:

echo export MY_VARIABLE=value >> /etc/environment

Linux

echo export _JAVA_OPTIONS=\"-Datlassian.org.osgi.framework.bootdelegation=javax.servlet,javax.servlet.\*,sun.\*,com.sun.\*,org.w3c.dom.\*,org.apache.xerces.\*\" >> /etc/environment

Windows

setx _JAVA_OPTIONS "-Datlassian.org.osgi.framework.bootdelegation=javax.servlet,javax.servlet.*,sun.*,com.sun.*,org.w3c.dom.*,org.apache.xerces.*"



Appending the path variable

ここをクリックして展開...

The variable can also be changed before the agent is started by adding the following line to the machine star tup script:

Linux

echo export PATH=$PATH:/new/path >> /etc/environment

Windows


set PATH=%PATH%;C:\new\path



Changing MAVEN_HOME definition

ここをクリックして展開...

The MAVEN_HOME can be changed with the following sed command:

Linux

sed -i 's@(export MAVEN_HOME=).*@\1/opt/maven-3.5@g' /opt/profile.d/bamboo.sh

Windows

sed -i 's@(export MAVEN_HOME=).*@\1/opt/maven-3.5@g' C:\opt\bamboo-elastic-agent\etc\profile.sh

最終更新日 2022 年 5 月 18 日

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

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