Skip to content

Commit

Permalink
Merge pull request #32 from petabridge/dev
Browse files Browse the repository at this point in the history
v0.1.2 Release
  • Loading branch information
Aaronontheweb authored Nov 19, 2019
2 parents a9dc2d6 + 2cee16f commit fa15f16
Show file tree
Hide file tree
Showing 15 changed files with 326 additions and 55 deletions.
14 changes: 3 additions & 11 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
#### 0.1.1 November 12 2018 ####
Made the Petabridge.Tracing.ApplicationInsights strong-named using [Public Signing](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/public-signing.md#public-signing)

#### 0.1.0 September 21 2018 ####
Initial release of Petabridge.Tracing.ApplicationInsights.

We built this driver in order to provide a layer of [OpenTracing](http://opentracing.io/) compatibility on top of [Microsoft's Application Insights](https://azure.microsoft.com/en-us/services/application-insights/) telemetry and analytics service.

This driver follows [the Application Insights to OpenTracing conventions](https://docs.microsoft.com/en-us/azure/application-insights/application-insights-correlation#open-tracing-and-application-insights) outlined by the Application Insights team.

`Petabridge.Tracing.ApplicationInsights` is professionally maintained and tested by [Petabridge](http://petabridge.com/) and is used inside some of our commercial products, such as [Phobos: Enterprise Akka.NET DevOps](https://phobos.petabridge.com/).
#### 0.1.2 November 18 2019 ####
* [Resolved: case insensitive HTTP headers](https://github.com/petabridge/Petabridge.Tracing.ApplicationInsights/issues/22)
* Updated all underlying dependencies.
13 changes: 13 additions & 0 deletions appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"SignClient": {
"AzureAd": {
"AADInstance": "https://login.microsoftonline.com/",
"ClientId": "1e983f21-9ea5-4f21-ab99-28080225efc9",
"TenantId": "2fa36080-af12-4894-a64b-a17d8f29ec52"
},
"Service": {
"Url": "https://pb-sign.azurewebsites.net/",
"ResourceId": "https://SignService/eef8e2e7-24b1-4a3b-a73b-a84d66f9abee"
}
}
}
8 changes: 8 additions & 0 deletions build-system/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Azure Pipelines Build Files
These `.yaml` files are used by Windows Azure DevOps Pipelines to help execute the following types of builds:

- Pull request validation on Linux (Mono / .NET Core)
- Pull request validation on Windows (.NET Framework / .NET Core)
- NuGet releases with automatic release notes posted to a Github Release repository.

**NOTE**: you will need to change some of the pipeline variables inside the `windows-release.yaml` for your specific project and you will also want to create variable groups with your signing and NuGet push information.
45 changes: 45 additions & 0 deletions build-system/azure-pipeline.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
parameters:
name: ''
displayName: ''
vmImage: ''
scriptFileName: ''
scriptArgs: 'all'
timeoutInMinutes: 120

jobs:
- job: ${{ parameters.name }}
displayName: ${{ parameters.displayName }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool:
vmImage: ${{ parameters.vmImage }}
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
clean: false # whether to fetch clean each time
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: true
# Linux or macOS
- task: Bash@3
displayName: Linux / OSX Build
inputs:
filePath: ${{ parameters.scriptFileName }}
arguments: ${{ parameters.scriptArgs }}
continueOnError: true
condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )
# Windows
- task: BatchScript@1
displayName: Windows Build
inputs:
filename: ${{ parameters.scriptFileName }}
arguments: ${{ parameters.scriptArgs }}
continueOnError: true
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx' #TestResults folder usually
testRunTitle: ${{ parameters.name }}
mergeTestResults: true
- script: 'echo 1>&2'
failOnStderr: true
displayName: 'If above is partially succeeded, then fail'
condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues')
26 changes: 26 additions & 0 deletions build-system/nightly-builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Release task for PbLib projects
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference

pool:
vmImage: vs2017-win2016
demands: Cmd

trigger: none
pr: none

schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build
branches:
include:
- dev

variables:
- group: nugetKeys #create this group with SECRET variables `nugetKey`

steps:
- task: BatchScript@1
displayName: 'FAKE Build'
inputs:
filename: build.cmd
arguments: 'Nuget nugetprerelease=dev nugetpublishurl=$(nightlyUrl) nugetkey=$(nightlyKey)'
33 changes: 33 additions & 0 deletions build-system/pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Pull request validation for Windows against the `dev` and `master` branches
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
trigger:
branches:
include:
- dev
- master

pr:
autoCancel: true # indicates whether additional pushes to a PR should cancel in-progress runs for the same PR. Defaults to true
branches:
include: [ dev, master ] # branch names which will trigger a build

variables:
- group: appInsightsVariables

name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

jobs:
- template: azure-pipeline.template.yaml
parameters:
name: 'windows_pr'
displayName: 'Windows PR Validation'
vmImage: 'vs2017-win2016'
scriptFileName: build.cmd
scriptArgs: all
- template: azure-pipeline.template.yaml
parameters:
name: 'linux_pr'
displayName: 'Linux PR Validation'
vmImage: 'ubuntu-16.04'
scriptFileName: ./build.sh
scriptArgs: all
40 changes: 40 additions & 0 deletions build-system/windows-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Release task for PbLib projects
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference

pool:
vmImage: vs2017-win2016
demands: Cmd

trigger:
branches:
include:
- refs/tags/*

pr: none

variables:
- group: signingSecrets
- group: nugetKeys
- name: githubConnectionName
value: PbReleaseNotes
- name: projectName
value: Petabridge.Tracing.ApplicationInsights
- name: githubRepositoryName
value: petabridge/Petabridge.Tracing.ApplicationInsights

steps:
- task: BatchScript@1
displayName: 'FAKE Build'
inputs:
filename: build.cmd
arguments: 'All SignClientUser=$(signingUsername) SignClientSecret=$(signingPassword) nugetpublishurl=https://api.nuget.org/v3/index.json nugetkey=$(nugetKey)'

- task: GitHubRelease@0
displayName: 'GitHub release (create)'
inputs:
gitHubConnection: $(githubConnectionName)
repositoryName: $(githubRepositoryName)
title: '$(projectName) v$(Build.SourceBranchName)'
releaseNotesFile: 'RELEASE_NOTES.md'
assets: |
bin\nuget\*.nupkg
95 changes: 83 additions & 12 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ open Fake.DotNetCli
open Fake.DocFxHelper

// Information about the project for Nuget and Assembly info files
let product = "OpenTracing.ApplicationInsights"
let product = "Petabridge.Library"
let configuration = "Release"

// Metadata used when signing packages and DLLs
let signingName = "Petabridge.Tracing.Zipkin"
let signingDescription = "Zipkin dristributed tracing engine driver, developed by Petabridge®"
let signingUrl = "https://github.com/petabridge/Petabridge.Tracing.Zipkin"

// Read release notes and version
let solutionFile = FindFirstMatchingFile "*.sln" __SOURCE_DIRECTORY__ // dynamically look up the solution
let buildNumber = environVarOrDefault "BUILD_NUMBER" "0"
let hasTeamCity = (not (buildNumber = "0")) // check if we have the TeamCity environment variable for build # set
let preReleaseVersionSuffix = (if (not (buildNumber = "0")) then (buildNumber) else "") + "-beta"
let preReleaseVersionSuffix = "beta" + (if (not (buildNumber = "0")) then (buildNumber) else DateTime.UtcNow.Ticks.ToString())
let versionSuffix =
match (getBuildParam "nugetprerelease") with
| "dev" -> preReleaseVersionSuffix
Expand All @@ -40,6 +45,8 @@ let workingDir = output @@ "build"
let nugetExe = FullName @"./tools/nuget.exe"

Target "Clean" (fun _ ->
ActivateFinalTarget "KillCreatedProcesses"

CleanDir output
CleanDir outputTests
CleanDir outputPerfTests
Expand Down Expand Up @@ -94,20 +101,21 @@ Target "RunTests" (fun _ ->
let projects =
match (isWindows) with
| true -> !! "./src/**/*.Tests.csproj"
-- "./src/**/*.Integration.Tests.csproj" // Zipkin containers can't run on Windows VMs
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here

let runSingleProject project =
let arguments =
match (hasTeamCity) with
| true -> (sprintf "xunit -c Release -nobuild -parallel none -teamcity -xml %s_xunit.xml" (outputTests @@ fileNameWithoutExt project))
| false -> (sprintf "xunit -c Release -nobuild -parallel none -xml %s_xunit.xml" (outputTests @@ fileNameWithoutExt project))
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" (outputTests))
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none" (outputTests))

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- (Directory.GetParent project).FullName
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)

ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.DontFailBuild result
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.DontFailBuild result

projects |> Seq.iter (log)
projects |> Seq.iter (runSingleProject)
Expand Down Expand Up @@ -136,6 +144,54 @@ Target "NBench" <| fun _ ->
projects |> Seq.iter runSingleProject


//--------------------------------------------------------------------------------
// Code signing targets
//--------------------------------------------------------------------------------
Target "SignPackages" (fun _ ->
let canSign = hasBuildParam "SignClientSecret" && hasBuildParam "SignClientUser"
if(canSign) then
log "Signing information is available."

let assemblies = !! (outputNuGet @@ "*.nupkg")

let signPath =
let globalTool = tryFindFileOnPath "SignClient.exe"
match globalTool with
| Some t -> t
| None -> if isWindows then findToolInSubPath "SignClient.exe" "tools/signclient"
elif isMacOS then findToolInSubPath "SignClient" "tools/signclient"
else findToolInSubPath "SignClient" "tools/signclient"

let signAssembly assembly =
let args = StringBuilder()
|> append "sign"
|> append "--config"
|> append (__SOURCE_DIRECTORY__ @@ "appsettings.json")
|> append "-i"
|> append assembly
|> append "-r"
|> append (getBuildParam "SignClientUser")
|> append "-s"
|> append (getBuildParam "SignClientSecret")
|> append "-n"
|> append signingName
|> append "-d"
|> append signingDescription
|> append "-u"
|> append signingUrl
|> toText

let result = ExecProcess(fun info ->
info.FileName <- signPath
info.WorkingDirectory <- __SOURCE_DIRECTORY__
info.Arguments <- args) (System.TimeSpan.FromMinutes 5.0) (* Reasonably long-running task. *)
if result <> 0 then failwithf "SignClient failed.%s" args

assemblies |> Seq.iter (signAssembly)
else
log "SignClientSecret not available. Skipping signing"
)

//--------------------------------------------------------------------------------
// Nuget targets
//--------------------------------------------------------------------------------
Expand Down Expand Up @@ -204,6 +260,19 @@ Target "DocFx" (fun _ ->
DocFxJson = docsPath @@ "docfx.json" })
)

//--------------------------------------------------------------------------------
// Cleanup
//--------------------------------------------------------------------------------

FinalTarget "KillCreatedProcesses" (fun _ ->
log "Shutting down dotnet build-server"
let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- __SOURCE_DIRECTORY__
info.Arguments <- "build-server shutdown") (System.TimeSpan.FromMinutes 2.0)
if result <> 0 then failwithf "dotnet build-server shutdown failed"
)

//--------------------------------------------------------------------------------
// Help
//--------------------------------------------------------------------------------
Expand All @@ -214,11 +283,12 @@ Target "Help" <| fun _ ->
"./build.ps1 [target]"
""
" Targets for building:"
" * Build Builds"
" * Nuget Create and optionally publish nugets packages"
" * RunTests Runs tests"
" * All Builds, run tests, creates and optionally publish nuget packages"
" * DocFx Creates a DocFx-based website for this solution"
" * Build Builds"
" * Nuget Create and optionally publish nugets packages"
" * SignPackages Signs all NuGet packages, provided that the following arguments are passed into the script: SignClientSecret={secret} and SignClientUser={username}"
" * RunTests Runs tests"
" * All Builds, run tests, creates and optionally publish nuget packages"
" * DocFx Creates a DocFx-based website for this solution"
""
" Other Targets"
" * Help Display this help"
Expand All @@ -236,13 +306,14 @@ Target "Nuget" DoNothing
"Clean" ==> "RestorePackages" ==> "AssemblyInfo" ==> "Build" ==> "BuildRelease"

// tests dependencies
"Clean" ==> "RestorePackages" ==> "Build" ==> "RunTests"

// nuget dependencies
"Clean" ==> "RestorePackages" ==> "Build" ==> "CreateNuget"
"CreateNuget" ==> "PublishNuget" ==> "Nuget"
"CreateNuget" ==> "SignPackages" ==> "PublishNuget" ==> "Nuget"

// docs
"BuildRelease" ==> "Docfx"
"Clean" ==> "RestorePackages" ==> "BuildRelease" ==> "Docfx"

// all
"BuildRelease" ==> "All"
Expand Down
Loading

0 comments on commit fa15f16

Please sign in to comment.