问题
I have a requirement where I need to write a shell script to stop teamcity agents on a server(3 agents per linux server). I need to get the system property; agent.name OR configuration parameter teamcity.agent.name in a shell script OR All the agents running on a linux agent, via script or API
回答1:
Build parameters can be accessed from any build script. This is from TeamCity documentation:
Any user-defined build parameter (system property or environment variable) can reference other parameters by using the following format:
%[env|system].property_name% For example: system.tomcat.libs=%env.CATALINA_HOME%/lib/*.jar
If you need to access build properties outside the build step, it may be done by reading the content of file which name is stored in TEAMCITY_BUILD_PROPERTIES_FILE environment variable.
For more details:
https://confluence.jetbrains.com/plugins/servlet/mobile#content/view/74847308
来源:https://stackoverflow.com/questions/46238738/accessing-teamcity-agent-system-properties-in-a-shell-script