Skip to content

Instantly share code, notes, and snippets.

View software-programmer's full-sized avatar

Matt Parker software-programmer

View GitHub Profile
@software-programmer
software-programmer / xdt-config-transform.ps1
Created August 11, 2016 18:53
This script can perform a config file transform using an xdt transform inside TeamCity. http://evsoftware.co.uk
# -----------------------------------------------
# Xdt Config Transform
# -----------------------------------------------
#
# Ver Who When What
# 1.0 Evolve Software 11-08-16 Initial Version
# Script Input Parameters
param (
[ValidateNotNullOrEmpty()]
@software-programmer
software-programmer / sign-assembly-using-nivot.ps1
Created August 11, 2016 18:48
This script can be used to sign an assembly using Nivot before compilation inside TeamCity. http://evsoftware.co.uk
# -----------------------------------------------
# Sign Assembly using Nivot
# -----------------------------------------------
#
# Ver Who When What
# 1.0 Evolve Software Ltd 19-05-16 Initial Version
# Script Input Parameters
param (
[ValidateNotNullOrEmpty()]
@software-programmer
software-programmer / rest-api-wrapper.ps1
Last active August 11, 2016 18:33
This script can be used as a wrapper around making REST API calls in TeamCity. http://evsoftware.co.uk
# -----------------------------------------------
# REST API Wrapper
# -----------------------------------------------
#
# Ver Who When What
# 1.0 Evolve Software Ltd 11-08-16 Initial Version
# Script Input Parameters
param (
[ValidateNotNullOrEmpty()]
@software-programmer
software-programmer / add-scheduled-trigger.ps1
Last active January 25, 2021 20:13
This script can be used inside TeamCity to add a scheduled trigger to another build configuration, to be run in X days time. Note that this does have admin / admin embedded as the credentials. http://evsoftware.co.uk
# Set Build Configuration Id of the one we want to set the trigger on
$BuildTypeId = "StackOverflowSamples_TriggerSecondBuildAfterXDays_AfterXDaysBuild"
$NumberOfDays = 3
# Create Credentials using built in user / password
$ApiCredentials = New-Object System.Management.Automation.PSCredential("admin", (ConvertTo-SecureString "admin" -AsPlainText -Force))
# Delete any existing triggers
Invoke-RestMethod -Credential $ApiCredentials -Uri "%teamcity.serverUrl%/httpAuth/app/rest/buildTypes/id:$BuildTypeId/triggers" -Method PUT -ContentType "application/xml" -Body "<triggers/>";
@software-programmer
software-programmer / get-build-status.ps1
Last active January 13, 2021 13:52
This script can be used inside TeamCity to get the build status of a build configuration and write the value back out to a parameter. http://evsoftware.co.uk
# Set Build Configuration Id
$BuildTypeId = "BuildConfiguration_Name"
# Create Credentials using built in user / password
$ApiCredentials = New-Object System.Management.Automation.PSCredential("%system.teamcity.auth.userId%", (ConvertTo-SecureString "%system.teamcity.auth.password%" -AsPlainText -Force))
# Invoke and get status
$status = Invoke-RestMethod -Credential $ApiCredentials -Uri "%teamcity.serverUrl%/httpAuth/app/rest/builds/buildType:$BuildTypeId/status" -Method GET;