diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 1502e79d..952516a9 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -9,6 +9,8 @@ pipeline { BASE_DIR = "src/go.elastic.co/apm/${env.REPO}" NOTIFY_TO = credentials('notify-to') JOB_GCS_BUCKET = credentials('gcs-bucket') + DOTNET_CLI_TELEMETRY_OPTOUT = 'true' + DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 'true' } options { timeout(time: 1, unit: 'HOURS') @@ -60,7 +62,7 @@ pipeline { unstash 'source' dir("${BASE_DIR}"){ dotnet(){ - sh './build.sh' + sh script: './build.sh', label: 'build' } } } @@ -82,21 +84,38 @@ pipeline { DOTNET_ROOT = "C:\\Program Files\\dotnet" PATH = "${env.DOTNET_ROOT};${env.DOTNET_ROOT}\\tools;${env.PATH};${env.HOME}\\bin" MSBUILDDEBUGPATH = "${env.WORKSPACE}" - DOTNET_CLI_TELEMETRY_OPTOUT = 'true' - DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 'true' } - steps { - withGithubNotify(context: 'Windows') { - unstash 'source' - dir("${BASE_DIR}"){ - bat script: 'choco install dotnetcore-sdk -m -y --no-progress -r --version 3.0.100', label: 'Tools' - bat script: 'build.bat canary', label: 'build' + stages { + stage('Build') { + steps { + withGithubNotify(context: 'Windows') { + unstash 'source' + dir("${BASE_DIR}"){ + bat script: 'choco install dotnetcore-sdk -m -y --no-progress -r --version 3.0.100', label: 'Tools' + bat script: 'build.bat canary', label: 'build' + } + } + } + post { + unsuccessful { + archiveArtifacts(allowEmptyArchive: true, artifacts: "${MSBUILDDEBUGPATH}/**/MSBuild_*.failure.txt") + } } } - } - post { - unsuccessful { - archiveArtifacts(allowEmptyArchive: true, artifacts: "${MSBUILDDEBUGPATH}/**/MSBuild_*.failure.txt") + stage('Deploy') { + when { + branch 'master' + } + steps { + dir("${BASE_DIR}"){ + release('secret/apm-team/ci/elastic-observability-appveyor') + } + } + post { + always { + archiveArtifacts(allowEmptyArchive: true, artifacts: "${BASE_DIR}/**/build/output/**/*.nupkg") + } + } } } } @@ -117,3 +136,10 @@ def dotnet(Closure body){ body() } } + +def release(secret){ + def repo = getVaultSecret(secret: secret) + withEnvMask(vars: [[var: 'REPO_API_KEY', password: repo.data.apiKey], [var: 'REPO_API_URL', password: repo.data.url]]){ + bat(label: 'Deploy', script: ".ci/deploy.bat ${REPO_API_KEY} ${REPO_API_URL}") + } +} diff --git a/.ci/deploy.bat b/.ci/deploy.bat new file mode 100755 index 00000000..16e17817 --- /dev/null +++ b/.ci/deploy.bat @@ -0,0 +1,13 @@ +echo off +set key=%1 +set url=%2 + +@echo on +FOR /R ".\" %%a in (*.nupkg) DO ( + dotnet nuget push "%%a" -k "%key%" -s "%url%" && ( + echo nuget push was successful + ) || ( + echo nuget push failed + exit 1 + ) +) \ No newline at end of file diff --git a/README.md b/README.md index d943bac8..6a403555 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ # Elastic Common Schema .NET +[![Build Status](https://apm-ci.elastic.co/buildStatus/icon?job=apm-agent-dotnet%2Fecs-dotnet-mbp%2Fmaster)](https://apm-ci.elastic.co/job/apm-agent-dotnet/job/ecs-dotnet-mbp/job/master/) + This repository contains .NET integrations that use the Elastic Common Schema (ECS), including popular .NET logging frameworks. Read the [announcement post](https://www.elastic.co/blog/elastic-common-schema-dotnet-library-and-integrations-released-for-elasticsearch). The Elastic Common Schema defines a common set of fields for ingesting data into Elasticsearch. A common schema helps you correlate data from sources like logs and metrics or IT operations analytics and security analytics. Further information on ECS can be found in the official [Elastic documentation](https://www.elastic.co/guide/en/ecs/current/index.html) or [github repository](https://github.com/elastic/ecs). diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index de80dc97..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 1.0.{build} -image: - - Visual Studio 2017 -test: off -environment: - DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true -install: - - cmd: choco install dotnetcore-sdk --version 3.0.100 -build_script: - - cmd: build.bat canary - -nuget: - disable_publish_on_pr: true - -for: - - - branches: - only: - - /^(master|\d+\.x)$/ - artifacts: - - path: .\build\output\_packages\*.nupkg - name: NuGet