├── .gitignore ├── .travis.yml ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── appveyor.yml ├── bitbucket-pipelines.yml ├── build.cake ├── build.ps1 ├── build.sh └── src ├── BitbucketPipelinesShield.sln ├── BitbucketPipelinesShield ├── BadgeCacheItem.cs ├── BadgeModule.cs ├── BitbucketPipelinesShield.xproj ├── Program.cs ├── Properties │ └── launchSettings.json ├── Service References │ └── Application Insights │ │ └── ConnectedService.json ├── Shields.cs ├── Shields.tt ├── Startup.cs ├── project.json └── web.config └── global.json /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | 254 | #Cake (generated) 255 | [Tt]ools/ 256 | .dotnet/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | os: 3 | - osx 4 | - linux 5 | 6 | # .NET CLI require Ubuntu 14.04 7 | sudo: required 8 | dist: trusty 9 | addons: 10 | apt: 11 | packages: 12 | - gettext 13 | - libcurl4-openssl-dev 14 | - libicu-dev 15 | - libssl-dev 16 | - libunwind8 17 | 18 | # .NET CLI require OSX 10.10 19 | osx_image: xcode7.1 20 | before_install: 21 | - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi 22 | 23 | script: 24 | - ./build.sh build.cake --target="Travis" --verbosity=Verbose 25 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": ".NET Core Launch (console)", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "program": "${workspaceRoot}/tools/Cake.CoreCLR.0.16.0-alpha0044/Cake.dll", 9 | "args": ["build.cake", "--debug", "--verbosity=Diagnostic"], 10 | "cwd": "${workspaceRoot}", 11 | "stopAtEntry": false, 12 | "externalConsole": false, 13 | "justMyCode": false 14 | }, 15 | { 16 | "name": ".NET Core Attach", 17 | "type": "coreclr", 18 | "request": "attach", 19 | "processId": "${command.pickProcess}" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Mattias Karlsson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bitbucket Pipelines Shield 2 | NancyFX based project that provides a shield for your Bitbucket Pipelines build status 3 | 4 | 5 | | Build server | Platform | Status | 6 | |-----------------------------|--------------|---------------------------------------------------------------------------------------------------------------------------| 7 | | Bitbucket Pipelines | Linux | [![Build Status](https://cakebitbucketpipelinesshield.azurewebsites.net/status/devlead/bitbucketpipelinesshield/master)](https://bitbucketshield.azurewebsites.net/url/devlead/bitbucketpipelinesshield/master) | 8 | | AppVeyor | Windows | [![Build Status](https://img.shields.io/appveyor/ci/devlead/BitbucketPipelinesShield/master.svg)](https://ci.appveyor.com/project/devlead/bitbucketpipelinesshield/branch/master) | 9 | | TravisCI | Linux & OSX | [![Build Status](https://travis-ci.org/devlead/BitbucketPipelinesShield.svg?branch=master)](https://travis-ci.org/devlead/BitbucketPipelinesShield) | 10 | 11 | [![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://azuredeploy.net/) 12 | 13 | ## Usage 14 | The web site can provide an SVG for last build status and also redirect to latest build log. 15 | 16 | ### Status 17 | The status route provides an shields.io badge for given repo and branch. 18 | ``` 19 | {url where shield project is deployed}/[site]/status/{owner}/{repo}/{node} 20 | ``` 21 | ### Url 22 | The url route provides and redirect to latest build log for given repo and branch. 23 | ``` 24 | {url where shield project is deployed}/url/{owner}/{repo}/{node} 25 | ``` 26 | ### Markdown 27 | ``` 28 | [![Build Status]](status url)](redirect url) 29 | ``` 30 | 31 | ## Limitations 32 | Currently only supports public repositories, the project is at an rough initial proof of concept stage and might not work at all for your repo. 33 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # Operating system (build VM template) 2 | os: Visual Studio 2015 3 | 4 | # Build script 5 | build_script: 6 | - ps: .\build.ps1 --target="AppVeyor" --verbosity=Verbose 7 | 8 | # Tests 9 | test: off 10 | -------------------------------------------------------------------------------- /bitbucket-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Cake Bitbucket Pipeline 2 | image: devlead/bitbucket-pipelines-cakecoreclr 3 | 4 | pipelines: 5 | default: 6 | - step: 7 | script: 8 | - cake --target="Bitbucket-Pipelines" --verbosity=Verbose -------------------------------------------------------------------------------- /build.cake: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // ARGUMENTS 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | var target = Argument("target", "Default"); 6 | var configuration = Argument("configuration", "Release"); 7 | 8 | /////////////////////////////////////////////////////////////////////////////// 9 | // GLOBAL VARIABLES 10 | /////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | /////////////////////////////////////////////////////////////////////////////// 14 | // SETUP / TEARDOWN 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | Setup(ctx => 18 | { 19 | // Executed BEFORE the first task. 20 | Information("Running tasks..."); 21 | }); 22 | 23 | Teardown(ctx => 24 | { 25 | // Executed AFTER the last task. 26 | Information("Finished running tasks."); 27 | }); 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // TASK DEFINITIONS 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | Task("Clean") 34 | .Does(ctx => { 35 | CleanDirectories("./src/**/bin/" + configuration); 36 | CleanDirectories("./src/**/obj/" + configuration); 37 | }); 38 | 39 | Task("Restore") 40 | .IsDependentOn("Clean") 41 | .Does(ctx => { 42 | DotNetCoreRestore("./", new DotNetCoreRestoreSettings { 43 | Sources = new [] { "https://api.nuget.org/v3/index.json" }, 44 | Verbosity = DotNetCoreRestoreVerbosity.Warning 45 | }); 46 | }); 47 | 48 | Task("Build") 49 | .IsDependentOn("Restore") 50 | .Does(ctx => { 51 | var projects = GetFiles("./**/project.json"); 52 | foreach(var project in projects) 53 | { 54 | DotNetCoreBuild(project.GetDirectory().FullPath, new DotNetCoreBuildSettings { 55 | Configuration = configuration 56 | }); 57 | } 58 | }); 59 | 60 | Task("Default") 61 | .IsDependentOn("Build"); 62 | 63 | Task("AppVeyor") 64 | .IsDependentOn("Build"); 65 | 66 | Task("Bitbucket-Pipelines") 67 | .IsDependentOn("Build"); 68 | 69 | Task("Travis") 70 | .IsDependentOn("Build"); 71 | 72 | RunTarget(target); -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | $CakeVersion = "0.19.3" 2 | $DotNetChannel = "preview"; 3 | $DotNetVersion = "1.0.0-preview2-003121"; 4 | $DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1"; 5 | 6 | # Make sure tools folder exists 7 | $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent 8 | $ToolPath = Join-Path $PSScriptRoot "tools" 9 | if (!(Test-Path $ToolPath)) { 10 | Write-Verbose "Creating tools directory..." 11 | New-Item -Path $ToolPath -Type directory | out-null 12 | } 13 | 14 | ########################################################################### 15 | # INSTALL .NET CORE CLI 16 | ########################################################################### 17 | 18 | Function Remove-PathVariable([string]$VariableToRemove) 19 | { 20 | $path = [Environment]::GetEnvironmentVariable("PATH", "User") 21 | if ($path -ne $null) 22 | { 23 | $newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } 24 | [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User") 25 | } 26 | 27 | $path = [Environment]::GetEnvironmentVariable("PATH", "Process") 28 | if ($path -ne $null) 29 | { 30 | $newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } 31 | [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process") 32 | } 33 | } 34 | 35 | # Get .NET Core CLI path if installed. 36 | $FoundDotNetCliVersion = $null; 37 | if (Get-Command dotnet -ErrorAction SilentlyContinue) { 38 | $FoundDotNetCliVersion = dotnet --version; 39 | } 40 | 41 | if($FoundDotNetCliVersion -ne $DotNetVersion) { 42 | $InstallPath = Join-Path $PSScriptRoot ".dotnet" 43 | if (!(Test-Path $InstallPath)) { 44 | mkdir -Force $InstallPath | Out-Null; 45 | } 46 | (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1"); 47 | & $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; 48 | 49 | Remove-PathVariable "$InstallPath" 50 | $env:PATH = "$InstallPath;$env:PATH" 51 | $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 52 | $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 53 | } 54 | 55 | ########################################################################### 56 | # INSTALL CAKE 57 | ########################################################################### 58 | 59 | Add-Type -AssemblyName System.IO.Compression.FileSystem 60 | Function Unzip 61 | { 62 | param([string]$zipfile, [string]$outpath) 63 | 64 | [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) 65 | } 66 | 67 | 68 | # Make sure Cake has been installed. 69 | $CakePath = Join-Path $ToolPath "Cake.CoreCLR.$CakeVersion/Cake.dll" 70 | if (!(Test-Path $CakePath)) { 71 | Write-Host "Installing Cake..." 72 | (New-Object System.Net.WebClient).DownloadFile("https://www.nuget.org/api/v2/package/Cake.CoreCLR/$CakeVersion", "$ToolPath\Cake.CoreCLR.zip") 73 | Unzip "$ToolPath\Cake.CoreCLR.zip" "$ToolPath/Cake.CoreCLR.$CakeVersion" 74 | Remove-Item "$ToolPath\Cake.CoreCLR.zip" 75 | } 76 | 77 | ########################################################################### 78 | # RUN BUILD SCRIPT 79 | ########################################################################### 80 | 81 | & dotnet "$CakePath" $args 82 | exit $LASTEXITCODE -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ########################################################################## 3 | # This is the Cake bootstrapper script for Linux and OS X. 4 | # This file was downloaded from https://github.com/cake-build/resources 5 | # Feel free to change this file to fit your needs. 6 | ########################################################################## 7 | 8 | # Define directories. 9 | SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 10 | TOOLS_DIR=$SCRIPT_DIR/tools 11 | CAKE_VERSION=0.19.3 12 | CAKE_DLL=$TOOLS_DIR/Cake.CoreCLR.$CAKE_VERSION/Cake.dll 13 | 14 | # Make sure the tools folder exist. 15 | if [ ! -d "$TOOLS_DIR" ]; then 16 | mkdir "$TOOLS_DIR" 17 | fi 18 | 19 | ########################################################################### 20 | # INSTALL .NET CORE CLI 21 | ########################################################################### 22 | 23 | echo "Installing .NET CLI..." 24 | if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then 25 | mkdir "$SCRIPT_DIR/.dotnet" 26 | fi 27 | curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh 28 | sudo bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version 1.0.0-preview3-003223 --install-dir .dotnet --no-path 29 | export PATH="$SCRIPT_DIR/.dotnet":$PATH 30 | export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 31 | export DOTNET_CLI_TELEMETRY_OPTOUT=1 32 | "$SCRIPT_DIR/.dotnet/dotnet" --info 33 | 34 | 35 | ########################################################################### 36 | # INSTALL CAKE 37 | ########################################################################### 38 | 39 | if [ ! -f "$CAKE_DLL" ]; then 40 | curl -Lsfo Cake.CoreCLR.zip "https://www.nuget.org/api/v2/package/Cake.CoreCLR/$CAKE_VERSION" && unzip -q Cake.CoreCLR.zip -d "$TOOLS_DIR/Cake.CoreCLR.$CAKE_VERSION" && rm -f Cake.CoreCLR.zip 41 | if [ $? -ne 0 ]; then 42 | echo "An error occured while installing Cake." 43 | exit 1 44 | fi 45 | fi 46 | 47 | # Make sure that Cake has been installed. 48 | if [ ! -f "$CAKE_DLL" ]; then 49 | echo "Could not find Cake.exe at '$CAKE_DLL'." 50 | exit 1 51 | fi 52 | 53 | ########################################################################### 54 | # RUN BUILD SCRIPT 55 | ########################################################################### 56 | 57 | # Start Cake 58 | exec dotnet "$CAKE_DLL" "$@" 59 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5855551F-9330-4DC8-B7E4-BDE18B00B6D8}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D5123C05-90A3-4890-A4A8-FE26CF022544}" 9 | ProjectSection(SolutionItems) = preProject 10 | global.json = global.json 11 | EndProjectSection 12 | EndProject 13 | Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "BitbucketPipelinesShield", "BitbucketPipelinesShield\BitbucketPipelinesShield.xproj", "{5D0CD7C5-DB8C-4F74-B54D-668C8F23AB4B}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {5D0CD7C5-DB8C-4F74-B54D-668C8F23AB4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {5D0CD7C5-DB8C-4F74-B54D-668C8F23AB4B}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {5D0CD7C5-DB8C-4F74-B54D-668C8F23AB4B}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {5D0CD7C5-DB8C-4F74-B54D-668C8F23AB4B}.Release|Any CPU.Build.0 = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | GlobalSection(NestedProjects) = preSolution 30 | {5D0CD7C5-DB8C-4F74-B54D-668C8F23AB4B} = {5855551F-9330-4DC8-B7E4-BDE18B00B6D8} 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/BadgeCacheItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Nancy; 3 | 4 | namespace BitbucketPipelinesShield 5 | { 6 | public class BadgeCacheItem 7 | { 8 | public long Expires { get; } = DateTime.UtcNow.AddSeconds(45).Ticks; 9 | public Func Status { get; } 10 | public Func Url { get; } 11 | 12 | public BadgeCacheItem(Func status, Func url) 13 | { 14 | Status = status; 15 | Url = url; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/BadgeModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Linq; 4 | using System.Net.Http; 5 | using System.Net.Http.Headers; 6 | using System.Threading.Tasks; 7 | using Nancy; 8 | using Nancy.Responses; 9 | 10 | namespace BitbucketPipelinesShield 11 | { 12 | public class BadgeModule : NancyModule 13 | { 14 | public BadgeModule() 15 | { 16 | Get("/", _=> Shields.BitbucketPipelinesShieldResponse()); 17 | Get("/status/{owner}/{repo}/{node}", async _ => await GetBuildStatus(_.owner, _.repo, _.node)); 18 | Get("/url/{owner}/{repo}/{node}", async _ => await GetBuildUrl(_.owner, _.repo, _.node)); 19 | } 20 | 21 | private static readonly ConcurrentDictionary, string> StatusApiUrls = new ConcurrentDictionary, string>(); 22 | private static readonly ConcurrentDictionary, BadgeCacheItem> StatusCache = new ConcurrentDictionary, BadgeCacheItem>(); 23 | 24 | private static async Task GetBuildStatus(string owner, string repo, string node) 25 | { 26 | try 27 | { 28 | return await GetBuildResponse(Tuple.Create(owner, repo, node), true); 29 | } 30 | catch (Exception) 31 | { 32 | return Shields.BuildUnresponsiveResponse(); 33 | } 34 | } 35 | 36 | private static async Task GetBuildUrl(string owner, string repo, string node) 37 | { 38 | try 39 | { 40 | return await GetBuildResponse(Tuple.Create(owner, repo, node), false); 41 | } 42 | catch (Exception) 43 | { 44 | return new RedirectResponse($"https://bitbucket.org/{owner}/{repo}/addon/pipelines/home#!/results/?error=1"); 45 | } 46 | } 47 | 48 | private static async Task GetBuildResponse(Tuple cacheKey, bool status) 49 | { 50 | BadgeCacheItem cacheItem; 51 | if (StatusCache.TryGetValue(cacheKey, out cacheItem) && cacheItem.Expires > DateTime.UtcNow.Ticks) 52 | { 53 | return (status ? cacheItem.Status : cacheItem.Url)(); 54 | } 55 | var bitbucketStatus = await GetBitbucketStatus(cacheKey); 56 | var parsedStats = Newtonsoft.Json.Linq.JObject.Parse(bitbucketStatus); 57 | var build = parsedStats 58 | .SelectTokens("$.values[?(@.type=='build')]") 59 | .Where(token => token.Value("url")?.Contains("/pipelines/") ?? false) 60 | .Select(token => new {State = token.Value("state"), Url = token.Value("url")}) 61 | .FirstOrDefault(); 62 | 63 | cacheItem = new BadgeCacheItem( 64 | GetStatusResponse(build?.State), 65 | () => new RedirectResponse(build?.Url ?? $"https://bitbucket.org/{cacheKey.Item1}/{cacheKey.Item2}/addon/pipelines/home#!/results/") 66 | ); 67 | 68 | StatusCache.AddOrUpdate(cacheKey, cacheItem, (key, old) => cacheItem); 69 | 70 | return (status ? cacheItem.Status : cacheItem.Url)(); 71 | } 72 | 73 | private static Func GetStatusResponse(string state) 74 | { 75 | Func statusResponse; 76 | switch (state) 77 | { 78 | case "SUCCESSFUL": 79 | { 80 | statusResponse = Shields.BuildPassingResponse; 81 | break; 82 | } 83 | case "FAILED": 84 | { 85 | statusResponse = Shields.BuildFailingResponse; 86 | break; 87 | } 88 | case "INPROGRESS": 89 | { 90 | statusResponse = Shields.BuildRunningResponse; 91 | break; 92 | } 93 | default: 94 | { 95 | statusResponse = Shields.BuildUnknownResponse; 96 | break; 97 | } 98 | } 99 | return statusResponse; 100 | } 101 | 102 | private static async Task GetBitbucketStatus(Tuple cacheKey) 103 | { 104 | string bitbucketStatus; 105 | using ( 106 | var client = new HttpClient 107 | { 108 | DefaultRequestHeaders = {CacheControl = new CacheControlHeaderValue {NoCache = true}} 109 | }) 110 | { 111 | bitbucketStatus = await client.GetStringAsync( 112 | StatusApiUrls.GetOrAdd( 113 | cacheKey, 114 | key => $"https://api.bitbucket.org/2.0/repositories/{key.Item1}/{key.Item2}/commit/{key.Item3}/statuses" 115 | ) 116 | ); 117 | } 118 | return bitbucketStatus; 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/BitbucketPipelinesShield.xproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 14.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 9 | 5d0cd7c5-db8c-4f74-b54d-668c8f23ab4b 10 | BitbucketPipelinesShield 11 | .\obj 12 | .\bin\ 13 | v4.5.2 14 | 15 | 16 | 2.0 17 | /subscriptions/b3dbc12a-40d7-4475-a629-61c6736b6aae/resourcegroups/Default-ApplicationInsights-CentralUS/providers/microsoft.insights/components/BitbucketPipelinesShield 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Hosting; 7 | 8 | namespace BitbucketPipelinesShield 9 | { 10 | public class Program 11 | { 12 | public static void Main(string[] args) 13 | { 14 | var host = new WebHostBuilder() 15 | .UseKestrel() 16 | .UseContentRoot(Directory.GetCurrentDirectory()) 17 | .UseIISIntegration() 18 | .UseStartup() 19 | .Build(); 20 | 21 | host.Run(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:52665/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "BitbucketPipelinesShield": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "launchUrl": "http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/Service References/Application Insights/ConnectedService.json: -------------------------------------------------------------------------------- 1 | { 2 | "ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider", 3 | "Version": "7.4.819.2", 4 | "GettingStartedDocument": { 5 | "Uri": "https://go.microsoft.com/fwlink/?LinkID=798432" 6 | } 7 | } -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/Shields.cs: -------------------------------------------------------------------------------- 1 | namespace BitbucketPipelinesShield 2 | { 3 | using Nancy; 4 | public static class Shields 5 | { 6 | private const string SvgContentType = "image/svg+xml"; 7 | private static readonly byte[] BitbucketPipelinesShield = { 0x3c, 0x73, 0x76, 0x67, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x73, 0x76, 0x67, 0x22, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x31, 0x35, 0x38, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x3e, 0x3c, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x78, 0x32, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x79, 0x32, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x62, 0x62, 0x62, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x31, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x3e, 0x3c, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x61, 0x22, 0x3e, 0x3c, 0x72, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x31, 0x35, 0x38, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x20, 0x72, 0x78, 0x3d, 0x22, 0x33, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x61, 0x73, 0x6b, 0x3e, 0x3c, 0x67, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x61, 0x29, 0x22, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x35, 0x35, 0x35, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x31, 0x31, 0x35, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x34, 0x63, 0x31, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x31, 0x31, 0x35, 0x20, 0x30, 0x68, 0x34, 0x33, 0x76, 0x32, 0x30, 0x68, 0x2d, 0x34, 0x33, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x62, 0x29, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x31, 0x35, 0x38, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x3d, 0x22, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3d, 0x22, 0x44, 0x65, 0x6a, 0x61, 0x56, 0x75, 0x20, 0x53, 0x61, 0x6e, 0x73, 0x2c, 0x56, 0x65, 0x72, 0x64, 0x61, 0x6e, 0x61, 0x2c, 0x47, 0x65, 0x6e, 0x65, 0x76, 0x61, 0x2c, 0x73, 0x61, 0x6e, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x69, 0x66, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3d, 0x22, 0x31, 0x31, 0x22, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x35, 0x37, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x42, 0x69, 0x74, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x35, 0x37, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x42, 0x69, 0x74, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x33, 0x35, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x33, 0x35, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x2f, 0x73, 0x76, 0x67, 0x3e }; 8 | private const int BitbucketPipelinesShieldLength = 770; 9 | private static void BitbucketPipelinesShieldContents(System.IO.Stream stream) => stream.Write(BitbucketPipelinesShield, 0, BitbucketPipelinesShieldLength); 10 | public static Response BitbucketPipelinesShieldResponse() => new Response { 11 | ContentType = SvgContentType, 12 | Contents = BitbucketPipelinesShieldContents, 13 | Headers = { 14 | { "Content-Disposition", "inline;filename=BitbucketPipelinesShield.svg" }, 15 | { "Pragma", "no-cache"}, 16 | { "Cache-Control", "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" }, 17 | { "Expires", "-1" } 18 | } 19 | }; 20 | private static readonly byte[] BuildPassing = { 0x3c, 0x73, 0x76, 0x67, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x73, 0x76, 0x67, 0x22, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x38, 0x38, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x3e, 0x3c, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x78, 0x32, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x79, 0x32, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x62, 0x62, 0x62, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x31, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x3e, 0x3c, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x61, 0x22, 0x3e, 0x3c, 0x72, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x38, 0x38, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x20, 0x72, 0x78, 0x3d, 0x22, 0x33, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x61, 0x73, 0x6b, 0x3e, 0x3c, 0x67, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x61, 0x29, 0x22, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x35, 0x35, 0x35, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x33, 0x37, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x34, 0x63, 0x31, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x33, 0x37, 0x20, 0x30, 0x68, 0x35, 0x31, 0x76, 0x32, 0x30, 0x48, 0x33, 0x37, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x62, 0x29, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x38, 0x38, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x3d, 0x22, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3d, 0x22, 0x44, 0x65, 0x6a, 0x61, 0x56, 0x75, 0x20, 0x53, 0x61, 0x6e, 0x73, 0x2c, 0x56, 0x65, 0x72, 0x64, 0x61, 0x6e, 0x61, 0x2c, 0x47, 0x65, 0x6e, 0x65, 0x76, 0x61, 0x2c, 0x73, 0x61, 0x6e, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x69, 0x66, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3d, 0x22, 0x31, 0x31, 0x22, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x36, 0x31, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x70, 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x36, 0x31, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x70, 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x2f, 0x73, 0x76, 0x67, 0x3e }; 21 | private const int BuildPassingLength = 736; 22 | private static void BuildPassingContents(System.IO.Stream stream) => stream.Write(BuildPassing, 0, BuildPassingLength); 23 | public static Response BuildPassingResponse() => new Response { 24 | ContentType = SvgContentType, 25 | Contents = BuildPassingContents, 26 | Headers = { 27 | { "Content-Disposition", "inline;filename=BuildPassing.svg" }, 28 | { "Pragma", "no-cache"}, 29 | { "Cache-Control", "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" }, 30 | { "Expires", "-1" } 31 | } 32 | }; 33 | private static readonly byte[] BuildFailing = { 0x3c, 0x73, 0x76, 0x67, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x73, 0x76, 0x67, 0x22, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x38, 0x30, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x3e, 0x3c, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x78, 0x32, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x79, 0x32, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x62, 0x62, 0x62, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x31, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x3e, 0x3c, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x61, 0x22, 0x3e, 0x3c, 0x72, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x38, 0x30, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x20, 0x72, 0x78, 0x3d, 0x22, 0x33, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x61, 0x73, 0x6b, 0x3e, 0x3c, 0x67, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x61, 0x29, 0x22, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x35, 0x35, 0x35, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x33, 0x37, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x65, 0x30, 0x35, 0x64, 0x34, 0x34, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x33, 0x37, 0x20, 0x30, 0x68, 0x34, 0x33, 0x76, 0x32, 0x30, 0x48, 0x33, 0x37, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x62, 0x29, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x38, 0x30, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x3d, 0x22, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3d, 0x22, 0x44, 0x65, 0x6a, 0x61, 0x56, 0x75, 0x20, 0x53, 0x61, 0x6e, 0x73, 0x2c, 0x56, 0x65, 0x72, 0x64, 0x61, 0x6e, 0x61, 0x2c, 0x47, 0x65, 0x6e, 0x65, 0x76, 0x61, 0x2c, 0x73, 0x61, 0x6e, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x69, 0x66, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3d, 0x22, 0x31, 0x31, 0x22, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x35, 0x37, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x66, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x35, 0x37, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x66, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x2f, 0x73, 0x76, 0x67, 0x3e }; 34 | private const int BuildFailingLength = 739; 35 | private static void BuildFailingContents(System.IO.Stream stream) => stream.Write(BuildFailing, 0, BuildFailingLength); 36 | public static Response BuildFailingResponse() => new Response { 37 | ContentType = SvgContentType, 38 | Contents = BuildFailingContents, 39 | Headers = { 40 | { "Content-Disposition", "inline;filename=BuildFailing.svg" }, 41 | { "Pragma", "no-cache"}, 42 | { "Cache-Control", "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" }, 43 | { "Expires", "-1" } 44 | } 45 | }; 46 | private static readonly byte[] BuildRunning = { 0x3c, 0x73, 0x76, 0x67, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x73, 0x76, 0x67, 0x22, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x39, 0x30, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x3e, 0x3c, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x78, 0x32, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x79, 0x32, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x62, 0x62, 0x62, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x31, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x3e, 0x3c, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x61, 0x22, 0x3e, 0x3c, 0x72, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x39, 0x30, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x20, 0x72, 0x78, 0x3d, 0x22, 0x33, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x61, 0x73, 0x6b, 0x3e, 0x3c, 0x67, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x61, 0x29, 0x22, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x35, 0x35, 0x35, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x33, 0x37, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x39, 0x66, 0x39, 0x66, 0x39, 0x66, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x33, 0x37, 0x20, 0x30, 0x68, 0x35, 0x33, 0x76, 0x32, 0x30, 0x48, 0x33, 0x37, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x62, 0x29, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x39, 0x30, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x3d, 0x22, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3d, 0x22, 0x44, 0x65, 0x6a, 0x61, 0x56, 0x75, 0x20, 0x53, 0x61, 0x6e, 0x73, 0x2c, 0x56, 0x65, 0x72, 0x64, 0x61, 0x6e, 0x61, 0x2c, 0x47, 0x65, 0x6e, 0x65, 0x76, 0x61, 0x2c, 0x73, 0x61, 0x6e, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x69, 0x66, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3d, 0x22, 0x31, 0x31, 0x22, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x36, 0x32, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x36, 0x32, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x2f, 0x73, 0x76, 0x67, 0x3e }; 47 | private const int BuildRunningLength = 739; 48 | private static void BuildRunningContents(System.IO.Stream stream) => stream.Write(BuildRunning, 0, BuildRunningLength); 49 | public static Response BuildRunningResponse() => new Response { 50 | ContentType = SvgContentType, 51 | Contents = BuildRunningContents, 52 | Headers = { 53 | { "Content-Disposition", "inline;filename=BuildRunning.svg" }, 54 | { "Pragma", "no-cache"}, 55 | { "Cache-Control", "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" }, 56 | { "Expires", "-1" } 57 | } 58 | }; 59 | private static readonly byte[] BuildUnresponsive = { 0x3c, 0x73, 0x76, 0x67, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x73, 0x76, 0x67, 0x22, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x31, 0x32, 0x30, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x3e, 0x3c, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x78, 0x32, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x79, 0x32, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x62, 0x62, 0x62, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x31, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x3e, 0x3c, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x61, 0x22, 0x3e, 0x3c, 0x72, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x31, 0x32, 0x30, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x20, 0x72, 0x78, 0x3d, 0x22, 0x33, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x61, 0x73, 0x6b, 0x3e, 0x3c, 0x67, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x61, 0x29, 0x22, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x35, 0x35, 0x35, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x33, 0x37, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x39, 0x66, 0x39, 0x66, 0x39, 0x66, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x33, 0x37, 0x20, 0x30, 0x68, 0x38, 0x33, 0x76, 0x32, 0x30, 0x48, 0x33, 0x37, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x62, 0x29, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x31, 0x32, 0x30, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x3d, 0x22, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3d, 0x22, 0x44, 0x65, 0x6a, 0x61, 0x56, 0x75, 0x20, 0x53, 0x61, 0x6e, 0x73, 0x2c, 0x56, 0x65, 0x72, 0x64, 0x61, 0x6e, 0x61, 0x2c, 0x47, 0x65, 0x6e, 0x65, 0x76, 0x61, 0x2c, 0x73, 0x61, 0x6e, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x69, 0x66, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3d, 0x22, 0x31, 0x31, 0x22, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x37, 0x37, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x75, 0x6e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x69, 0x76, 0x65, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x37, 0x37, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x75, 0x6e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x69, 0x76, 0x65, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x2f, 0x73, 0x76, 0x67, 0x3e }; 60 | private const int BuildUnresponsiveLength = 752; 61 | private static void BuildUnresponsiveContents(System.IO.Stream stream) => stream.Write(BuildUnresponsive, 0, BuildUnresponsiveLength); 62 | public static Response BuildUnresponsiveResponse() => new Response { 63 | ContentType = SvgContentType, 64 | Contents = BuildUnresponsiveContents, 65 | Headers = { 66 | { "Content-Disposition", "inline;filename=BuildUnresponsive.svg" }, 67 | { "Pragma", "no-cache"}, 68 | { "Cache-Control", "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" }, 69 | { "Expires", "-1" } 70 | } 71 | }; 72 | private static readonly byte[] BuildUnknown = { 0x3c, 0x73, 0x76, 0x67, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0x30, 0x30, 0x30, 0x2f, 0x73, 0x76, 0x67, 0x22, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x39, 0x38, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x3e, 0x3c, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x78, 0x32, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x79, 0x32, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x62, 0x62, 0x62, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x31, 0x22, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x47, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x3e, 0x3c, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x61, 0x22, 0x3e, 0x3c, 0x72, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x39, 0x38, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x32, 0x30, 0x22, 0x20, 0x72, 0x78, 0x3d, 0x22, 0x33, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x61, 0x73, 0x6b, 0x3e, 0x3c, 0x67, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x61, 0x29, 0x22, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x35, 0x35, 0x35, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x33, 0x37, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x39, 0x66, 0x39, 0x66, 0x39, 0x66, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x33, 0x37, 0x20, 0x30, 0x68, 0x36, 0x31, 0x76, 0x32, 0x30, 0x48, 0x33, 0x37, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x75, 0x72, 0x6c, 0x28, 0x23, 0x62, 0x29, 0x22, 0x20, 0x64, 0x3d, 0x22, 0x4d, 0x30, 0x20, 0x30, 0x68, 0x39, 0x38, 0x76, 0x32, 0x30, 0x48, 0x30, 0x7a, 0x22, 0x2f, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x3d, 0x22, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3d, 0x22, 0x44, 0x65, 0x6a, 0x61, 0x56, 0x75, 0x20, 0x53, 0x61, 0x6e, 0x73, 0x2c, 0x56, 0x65, 0x72, 0x64, 0x61, 0x6e, 0x61, 0x2c, 0x47, 0x65, 0x6e, 0x65, 0x76, 0x61, 0x2c, 0x73, 0x61, 0x6e, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x69, 0x66, 0x22, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3d, 0x22, 0x31, 0x31, 0x22, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x31, 0x38, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x36, 0x36, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x35, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x3d, 0x22, 0x23, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x22, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x2d, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3d, 0x22, 0x2e, 0x33, 0x22, 0x3e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x20, 0x78, 0x3d, 0x22, 0x36, 0x36, 0x2e, 0x35, 0x22, 0x20, 0x79, 0x3d, 0x22, 0x31, 0x34, 0x22, 0x3e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x67, 0x3e, 0x3c, 0x2f, 0x73, 0x76, 0x67, 0x3e }; 73 | private const int BuildUnknownLength = 739; 74 | private static void BuildUnknownContents(System.IO.Stream stream) => stream.Write(BuildUnknown, 0, BuildUnknownLength); 75 | public static Response BuildUnknownResponse() => new Response { 76 | ContentType = SvgContentType, 77 | Contents = BuildUnknownContents, 78 | Headers = { 79 | { "Content-Disposition", "inline;filename=BuildUnknown.svg" }, 80 | { "Pragma", "no-cache"}, 81 | { "Cache-Control", "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" }, 82 | { "Expires", "-1" } 83 | } 84 | }; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/Shields.tt: -------------------------------------------------------------------------------- 1 | <#@ assembly name="System.Core" #> 2 | <#@ import namespace="System.Linq" #> 3 | <# 4 | var model = new { 5 | Badges = new [] { 6 | new { Property = "BitbucketPipelinesShield", ShieldIoUrl = "https://img.shields.io/badge/Bitbucket_Pipelines-Shield-brightgreen.svg"}, 7 | new { Property = "BuildPassing", ShieldIoUrl = "https://img.shields.io/badge/build-passing-brightgreen.svg"}, 8 | new { Property = "BuildFailing", ShieldIoUrl = "https://img.shields.io/badge/build-failing-red.svg"}, 9 | new { Property = "BuildRunning", ShieldIoUrl = "https://img.shields.io/badge/build-running-lightgrey.svg"}, 10 | new { Property = "BuildUnresponsive", ShieldIoUrl = "https://img.shields.io/badge/build-unresponsive-lightgrey.svg"}, 11 | new { Property = "BuildUnknown", ShieldIoUrl = "https://img.shields.io/badge/build-unknown-lightgrey.svg"} 12 | } 13 | }; 14 | #> 15 | namespace BitbucketPipelinesShield 16 | { 17 | using Nancy; 18 | public static class Shields 19 | { 20 | private const string SvgContentType = "image/svg+xml"; 21 | <# 22 | using(var client = new System.Net.WebClient()) 23 | { 24 | foreach(var badge in model.Badges) { 25 | var shieldData = client.DownloadData(badge.ShieldIoUrl); 26 | var dataString = string.Join( 27 | ", ", 28 | shieldData.Select( 29 | data=>string.Format("0x{0:x2}", data) 30 | ) 31 | ); 32 | #> 33 | private static readonly byte[] <#=badge.Property#> = { <#=dataString #> }; 34 | private const int <#=badge.Property#>Length = <#=shieldData.Length #>; 35 | private static void <#=badge.Property#>Contents(System.IO.Stream stream) => stream.Write(<#=badge.Property#>, 0, <#=badge.Property#>Length); 36 | public static Response <#=badge.Property#>Response() => new Response { 37 | ContentType = SvgContentType, 38 | Contents = <#=badge.Property#>Contents, 39 | Headers = { 40 | { "Content-Disposition", "inline;filename=<#=badge.Property#>.svg" }, 41 | { "Pragma", "no-cache"}, 42 | { "Cache-Control", "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" }, 43 | { "Expires", "-1" } 44 | } 45 | }; 46 | <# } 47 | }#> 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Logging; 6 | using Nancy.Owin; 7 | 8 | // ReSharper disable UnusedMember.Global 9 | 10 | namespace BitbucketPipelinesShield 11 | { 12 | public class Startup 13 | { 14 | public IConfigurationRoot Configuration { get; } 15 | 16 | public Startup(IHostingEnvironment env) 17 | { 18 | Configuration = new ConfigurationBuilder() 19 | .SetBasePath(env.ContentRootPath) 20 | .AddEnvironmentVariables() 21 | .Build(); 22 | } 23 | 24 | public void ConfigureServices(IServiceCollection services) 25 | { 26 | services.AddApplicationInsightsTelemetry(Configuration); 27 | } 28 | 29 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 30 | { 31 | loggerFactory.AddConsole(); 32 | 33 | if (env.IsDevelopment()) 34 | { 35 | app.UseDeveloperExceptionPage(); 36 | } 37 | else 38 | { 39 | app.UseApplicationInsightsExceptionTelemetry(); 40 | app.UseApplicationInsightsRequestTelemetry(); 41 | app.UseStatusCodePages(); 42 | } 43 | app.UseOwin(o => o.UseNancy()); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.NETCore.App": { 4 | "version": "1.0.0", 5 | "type": "platform" 6 | }, 7 | "Microsoft.AspNetCore.Diagnostics": "1.0.0", 8 | "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 9 | "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", 10 | "Microsoft.Extensions.Logging.Console": "1.0.0", 11 | "Nancy": "2.0.0-barneyrubble", 12 | "Microsoft.AspNetCore.Owin": "1.0.0", 13 | "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", 14 | "Microsoft.Extensions.Configuration.Json": "1.0.0", 15 | "Microsoft.ApplicationInsights.AspNetCore": "1.0.0" }, 16 | 17 | "tools": { 18 | "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" 19 | }, 20 | 21 | "frameworks": { 22 | "netcoreapp1.0": { 23 | "imports": [ 24 | "dotnet5.6", 25 | "portable-net45+win8" 26 | ] 27 | } 28 | }, 29 | 30 | "buildOptions": { 31 | "emitEntryPoint": true, 32 | "preserveCompilationContext": true, 33 | "debugType": "portable" 34 | }, 35 | 36 | "runtimeOptions": { 37 | "configProperties": { 38 | "System.GC.Server": true 39 | } 40 | }, 41 | 42 | "publishOptions": { 43 | "include": [ 44 | "wwwroot", 45 | "web.config" 46 | ] 47 | }, 48 | 49 | "scripts": { 50 | "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/BitbucketPipelinesShield/web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "projects": [ "src", "test" ], 3 | "sdk": { 4 | "version": "1.0.0-preview2-003121" 5 | } 6 | } 7 | --------------------------------------------------------------------------------