Giter Club home page Giter Club logo

psteamcity-buildlog's Introduction

PSTeamCity-BuildLog

A PowerShell module that facilitates build script interaction with TeamCity Build Agents

Installation

Note: Before proceeding, ensure you have the following pre-requisites:

Open a PowerShell prompt and run the command below to install the module from the PowerShell Gallery:

Install-Module `
    -Name PSTeamCity-BuildLog `
    -Scope CurrentUser `

Import-Module PSTeamCity-BuildLog

Installation (Local Development)

For local development, clone the repository and and import the module folder into a PowerShell session directly:

Import-Module 'C:\path\to\repository\src\PSTeamCity-BuildLog'

Cmdlets

These Cmdlets will only produce output when running as part of a TeamCity build, unless otherwise noted.

Use the Test-TeamCity Cmdlet to determine if the current script is running within a TeamCity environment.

Test-TeamCity

Returns $true or $false, based on whether the current scope is believed to be running on a TeamCity Build Agent.

Example Usage:

if (Test-TeamCity) {
    # Execute TeamCity-specific logic here
}

Get-TeamCityEscapedString

Escapes strings so that they can be safely used in other Cmdlets without breaking integration with the TeamCity build log.

Write-TeamCityMessage

Writes an informational message to the build log. TeamCity treats these messages differently than normal output.

Write-TeamCityBuildProblem

Writes a message to the build log that indicates a problem with the build. TeamCity treats these messages differently than normal output.

New-TeamCityBlock

Writes a message to the build log indicating the beginning of a new block. Capturing the return value will allow the block to be closed when piped to Remove-TeamCityBlock.

  • Any output that is emitted between New-TeamCityBlock and Remove-TeamCityBlock is considered to be as contents of the block.
  • The contents of a block can be collapsed in the TeamCity build log.
  • Blocks can be nested within other blocks by specifying unique values for the -Name parameter.
$blockOuter = New-TeamCityBlock -Name "Outer"
Write-Host "This message is part of the outer block!"
$blockInner = New-TeamCityBlock -Name "Inner"
Write-Host "This message is contained in a nested block!"
$blockInner | Remove-TeamCityBlock
Write-Host "Now we're back to the outer block again!"
$blockOuter | Remove-TeamCityBlock

Remove-TeamCityBlock

Writes a message to the build log indicating the ending of an existing block.

Closing a block will close any nested blocks as well.

psteamcity-buildlog's People

Contributors

rychard avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.