Skip to content

Instantly share code, notes, and snippets.

View GerryWilko's full-sized avatar
🐢

Gerard Wilkinson GerryWilko

🐢
View GitHub Profile
@GerryWilko
GerryWilko / workitem-poster.yml
Last active May 19, 2022 13:31
Azure Pipelines Task to Post Comment to Linked Work Items (Bash)
- bash: | # Access Token should need Build Read, Work Item Read & Write, Member Entitlement Management Read
curl -u test@test.com:access-token-xxxxxxxxxxx https://dev.azure.com/{organisation}/{project}/_apis/build/builds/$(build.buildId)/workitems?api-version=6.0 | jq '.value[] | .id' |
while IFS=$"\n" read -r c; do
wid=$(echo $c | tr -dc '0-9')
echo
echo Posting status to work item: $wid
echo
curl -u test@test.com:access-token-xxxxxxxxxxx https://dev.azure.com/{organisation}/{project}/_apis/wit/workItems/$wid/comments?api-version=6.0-preview.3 -X POST --data '{"text": "Build $(Build.BuildNumber) completed with status: $(Agent.JobStatus)"}' -H 'Content-Type: application/json'
echo
done
@GerryWilko
GerryWilko / Dockerfile
Last active July 14, 2020 14:29
Dockerfile for .NET Framework Web with cache helper for nuget restore (Windows Containers)
# escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-2004 as cached
WORKDIR /cache
COPY . .
RUN Get-ChildItem . -exclude *.csproj, packages.config -Recurse | Where-Object { !$_.PSIsContainer } | `
Foreach-Object { `
Remove-Item $_.FullName ; `