Skip to content

detect TeamCity #37

@otakusid

Description

@otakusid

it would be good to disable coloring if process runes from TeamCity. Here is node -p 'process.env' output from TeamCity build step:

{
TEAMCITY_BUILD_PROPERTIES_FILE: '/opt/teamcity/buildagetnt/temp/buildTmp/teamcity.build2602458914988989541.properties',
TERM: 'linux',
JRE_17_x64: '/usr/lib/jvm/jre',
TMPDIR: '/opt/teamcity/buildagetnt/temp/buildTmp',
TEAMCITY_CAPTURE_ENV: '"/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64/jre/bin/java" -jar "/opt/teamcity/buildagetnt/plugins/environment-fetcher/bin/env-fetcher.jar"',
TEAMCITY_VERSION: '9.0.5 (build 32523)',
JRE_HOME: '/usr/bin/..',
TEMP: '/opt/teamcity/buildagetnt/temp/buildTmp',
TEAMCITY_BUILDCONF_NAME: 'api api',
BUILD_VCS_NUMBER: '95fb89fd9d28',
NLSPATH: '/usr/dt/lib/nls/msg/%L/%N.cat',
PATH: '/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/lib',
RUNLEVEL: '3',
runlevel: '3',
_: '/usr/bin/node',
PWD: '/opt/teamcity/buildagetnt/work/abeaf100e9e82338',
LANGSH_SOURCED: '1',
DOCKER_CONFIG: '/usr/local/etc/.docker',
TEAMCITY_GIT_PATH: '/usr/bin/git',
LANG: 'en_US.UTF-8',
PREVLEVEL: 'N',
previous: 'N',
XFILESEARCHPATH: '/usr/dt/app-defaults/%L/Dt',
CONSOLETYPE: 'serial',
BUILD_VCS_NUMBER_feedbackforum_feedbackforumapi: '95fb89fd9d28',
HOME: '/root/',
SHLVL: '4',
TEAMCITY_PROCESS_FLOW_ID: '818047604373',
UPSTART_INSTANCE: '',
TMP: '/opt/teamcity/buildagetnt/temp/buildTmp',
UPSTART_EVENTS: 'runlevel',
BUILD_NUMBER: '150',
JRE_17: '/usr/lib/jvm/jre',
UPSTART_JOB: 'rc',
TEAMCITY_PROJECT_NAME: '10 tests',
COMPOSER_HOME: '/usr/local/bin',
TEAMCITY_PROCESS_PARENT_FLOW_ID: ''
}

In similar situation xUnit runner uses TEAMCITY_PROJECT_NAME env variable to detect that it running from TeamCity

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions