This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##----------------------------------------------------------------------- | |
## <copyright file="Add-CapabilityToAgent.ps1">(c) Tichard Fennell </copyright> | |
##----------------------------------------------------------------------- | |
# Adds capacility tags a Azure DevOps Pipeline agent | |
# Run in the agent folder | |
Param | |
( | |
[parameter(Mandatory=$true,HelpMessage="Personal Access Token with rights to manage agents")] | |
$patToken, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
# this block is in its own try/catch as it uses undocumented API calls, so will fail safe | |
# we need to stage ID which is only available via a REST call | |
$uri = "$(System.CollectionUri)/$(System.TeamProject)/_apis/build/builds/$(Build.BuildID)/timeline?api-version=6.0" | |
$response = Get-WebClient.DownloadString($uri) | ConvertFrom-Json | |
$stage = $response.records | where-object -property name -eq "$(System.StageName)" | |
# now we can get the approval, we have to use a new webclient instance else you get a 400 Bad Request error | |
$uri = "$(System.CollectionUri)_apis/Contribution/HierarchyQuery/project/$(System.TeamProject)?api-version=6.1-preview.1" | |
$payload = "{`"contributionIds`":[`"ms.vss-build-web.checks-panel-data-provider`"],`"dataProviderContext`":{`"properties`":{`"buildId`":`"$(Build.BuildID)`",`"stageIds`":`"$($stage.id)`",`"checkListItemType`":1,`"sourcePage`":{`"url`":`"$(System.CollectionUri)/$(System.TeamProject)/_build/results?buildId=$(Build.BuildID)&view=results`",`"routeId`":`"ms.vss-bui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param | |
( | |
$tagname, | |
$trunk = 'main' | |
) | |
& git push origin :refs/tags/$tagname | |
& git tag -fa $tagname -m "Current $tagname release" | |
& git push origin $trunk --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Update-AppConfig | |
{ | |
[cmdletbinding()] | |
param | |
( | |
[parameter(Mandatory = $true, HelpMessage = "Name of app.exe.config file")] | |
[string]$AppConfigFile, | |
[parameter(Mandatory = $false, HelpMessage = "Name of parameters.xml file")] | |
[string]$ParametersFile = "parameters.xml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add Issue to project | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
track_issue: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get project data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool: | |
vmImage: windows-latest | |
variables: | |
- name: system.debug | |
value: true | |
stages: | |
- stage: Stage1 | |
jobs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param | |
( | |
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps PAT token")] | |
$pat, | |
[parameter(Mandatory = $true, HelpMessage = "URL of Azure DevOps instance e.g. https://dev.aure.com/myinstance")] | |
$url, | |
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps Agent Pool name")] | |
$pool , | |
[parameter(Mandatory = $true, HelpMessage = "Based name for agent to search for e.g MyAgent as part of B1MyAgent-123")] | |
$agentBaseName , |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/*** | |
Usage: blog2md b|w <BLOGGER/WordPress BACKUP XML> <OUTPUT DIR> | |
*/ | |
const fs = require('fs'); | |
const os = require('os'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$basepath = "C:\tmp\bmBlog\content" | |
$files = Get-ChildItem -path $basepath -Filter "*.md" -Recurse | % { $_.FullName} | |
foreach ($file in $files) { | |
$f = get-item $file | |
$content = (Get-Content -path $f.FullName) | |
foreach ($l in $content) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-AgentPoolForNamedAgent { | |
param | |
( | |
$pat, | |
$url, | |
$agentName | |
) | |
$patToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($pat)")) |