Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Create v9.0.0 (#509)
Browse files Browse the repository at this point in the history
* Create codeql-analysis.yml (#370)

* fix: Correct comment about default TypeName (#393)

The default TypeName was changed to '_doc' in #298

* Proper handling of TypeName = null from appsettings.json (#420)

Co-authored-by: Marius Wingerei <[email protected]>

* Add `ElasticsearchSinkOptions.BufferFileRollingInterval` option (#416)

* Add `ElasticsearchSinkOptions.BufferFileRollingInterval` option

- Using this option we can customize buffer file rolling interval. The default is `RollingInterval.Day` (so no changes here). In some cases higher granularity may be needed.
- Changed regular expression for FileSet to get buffer files to support different rolling interval file name formats - from Infinite to Minute. All of them are different amount of digits representing date - 0(Infinite), 4(Year),..., 12 (Minute). So replaced expression part for day format `(?<date>\\d{8})` with the expression for all interval date `(?<date>\\d{0,12})`.

* Add tests for the desired functionality, which fail now.

- Return code to support only Daily rolling interval
- Add RollingIntervalExtensions.cs (origin: Serilog.Sinks.File) with InternalVisible attribute to be able to test
- Add InternalVisible to FileSet.cs to be able to test it
- Sign tests assembly the same way as Serilog.Sinks.Elasticsearch for InternalVisible to work

* Support different rolling intervals for DurableElasticsearchSink rolling files.

- Make support only for intervals like Day, Hour, Minute. As for less frequent intervals we cannot get specific date (specific day) for passing to _getIndexForEvent in `ElasticsearchPayloadReader`.
- Support handling rolling files for different intervals in `ElasticsearchPayloadReader` and `FileSet` by using corresponding formats and search patterns.
- Add tests of changed code - for `ElasticsearchPayloadReader` and `FileSet`

* Remove redundant spaces

* Fix internal or IntelliSense typos (#406)

Cleaning up a few very minor typos in internal methods or exposed via
IntelliSense:

 * "semi column" -> "semi-colon"
 * "preforming" -> "performing"
 * "CreatePlayLoad" -> "CreatePayload"

Co-authored-by: Bo Flynn <[email protected]>

* Clean package sources

* clean obsolete .net versions

* updated packages

* added dependabot

* Bump actions/setup-dotnet from 1 to 2 (#431)

Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 1 to 2.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](actions/setup-dotnet@v1...v2)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/checkout from 2 to 3 (#427)

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/cache from 2 to 3 (#429)

Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/download-artifact from 2 to 3 (#424)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* added dependencies

* copy local files

* updating versions

* publish test results

* remove old nuspec and updated icons

* added icon

* updates

* fix build

* multiple packages

* name

* cicd

* skip test for now as it is flaky

* version

* Names

* use correct folder

* older version

* diffferent way of pushing

* enviroment

* Remove app veyor and dotnet-version

* Use repo owner

* use dotnet nuget

* logging

* remove @

* --skip-duplicate

* update project url

* Updated changelog

* paths

* use correct output path

* remove the source

* skip duplicates

* Bump actions/setup-dotnet from 2 to 3.0.2 (#478)

Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 2 to 3.0.2.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](actions/setup-dotnet@v2...v3.0.2)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update cicd.yaml

* Bump actions/download-artifact from 1 to 3 (#439)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 1 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v1...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/upload-artifact from 2 to 3 (#438)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update cicd.yaml

* fix file references in the Visual Studio Solution file. (#461)

Co-authored-by: Nenad Vicentic <[email protected]>

* Bump actions/setup-dotnet from 3.0.2 to 3.0.3 (#487)

Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](actions/setup-dotnet@v3.0.2...v3.0.3)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github/codeql-action from 1 to 2 (#426)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@v1...v2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Automatically handle `TypeName` parameter for different versions of Elasticsearch (<7, 7 or higher) (#462)

* fix file references in the Visual Studio Solution file.

* Do not set `TypeName` by default any more.
* last version of Elasticsearch that supported user-defined `_type` field - v6.8.x is running out of support on 2022-02-10 (https://www.elastic.co/support/eol)

* Automatically handle `ElasticsearchSinkOptions.TypeName` for different versions Elasticsearch (<7, 7+) when `ElasticsearchSinkOptions.DetectElasticsearchVersion` is enabled.

* Add unit test for automatic settings of `TypeName` when `DetectElasticsearchVersion` is set to `true`.
- Two methods used - instantiate `ElasticsearchSinkState` directly and via `LoggerConfiguration`

* Add Elasticsearch v8 template + parsing of Elasticsearch major version to `int` + decision branch for which version of index-template API to use + removal of obsolete `ElasticsearchTemplateProvider.GetTemplate(...)` method overload.

* Upgrade to .NET 6.0 and update test-frameworks related NuGet pacakges

* Upgrade to Elasticsearch.NET 7.17.5 + handle new "preflight" request

https://discuss.elastic.co/t/the-client-is-unable-to-verify-that-the-server-is-elasticsearch-due-to-an-unsuccessful-product-check-call-some-functionality-may-not-be-compatible-if-the-server-is-running-an-unsupported-product/310969/9

"The 7.16 client performs a pre-flight GET request to the root URL of the server before the first request.".

* Make `ConnectionStub` a bit more robust .

* Use `System.Version` to parse Elasticsearch server version number (similar to what `Elasticsearch.Net` does)

* Update NuGet packages

* Replace obsolete NuGet package `Serilog.Sinks.ColoredConsole` with `Serilog.Sinks.Console`

* Update `Serilog.Sinks.PeriodicBatching` package and reimplent `ElasticsearchSink` so that it does not use obsolete `PeriodicBatchingSink` constructor.

* Better handling of Elasticsearch server version number in mocked `ConnectionStub`

* Cleanup: refactor to use single `JsonEquals` method.

* Turn on `DetectElasticSearchVersion` option by default. Assume version 7 on fallback.

* Cleanup: remove unused namespaces

* Cleanup: move `ElasticsearchSinkTestsBase` into `Stubs` subfolder.

* Refactor: extract `ConnectionStub` into a separate file.

* Fix: json comparison in .NET Framework 4.6+

* Run unit-tests on multiple .NET frameworks.

* Cleanup: remove unused NUnit runner package.

* Use newer, built-in compilation constants.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#conditional-compilation

* Use standard MSBuild property `IsPackable` for clarity.

* Cleanup: remove unused package refrence.

* Update GitHub actions

* docs: updated documentation to reflect  changes in behavior of the sink.

Co-authored-by: Nenad Vicentic <[email protected]>

* Update dotnet sdk

* disable net48 tests

* set api key

* Remove support for Elasticsearch v2 and v5. (#488)

* Remove support for Elasticsearch v2 and v5.

* Code-conventions: add rule for underscore `_` on private fields (as it already is in the code).

* Remove GitHub's `set-output` command deprication warning.

Co-authored-by: Nenad Vicentic <[email protected]>

* added path for tests

* fix: Example in README is incorrect #402 (#496)

* Applying right versioning

* Update AssemblyInfo.cs

* Remove `AssemblyInfo.cs` and move attributes to the `*.csproj` file. This enables setting assembly version via command line and CI. (#501)

1. Build and pack:
    dotnet build -c Release -p:Version=9.0.0-beta11
    dotnet pack -c Release --no-build  -p:Version=9.0.0-beta11
2. Pack (with implicit build)
    dotnet pack -c Release -p:Version=9.0.0-beta11

Co-authored-by: Nenad Vicentic <[email protected]>

* Read Elasticsearch server version from a root page response (#502)

Co-authored-by: Nenad Vicentic <[email protected]>

* Versioning and permission for unit tests

* [no ci]

* #498 Disable `PublicSign` to fix strong-name signature verification issue of assemblies from public NuGet package: (#504)

> Could not load file or assembly 'Serilog.Formatting.Elasticsearch' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)"

Co-authored-by: Nenad Vicentic <[email protected]>

* [no ci]

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Mikkel Nylander Bundgaard <[email protected]>
Co-authored-by: mariwing <[email protected]>
Co-authored-by: Marius Wingerei <[email protected]>
Co-authored-by: Andrey Kozlov <[email protected]>
Co-authored-by: Bo Flynn <[email protected]>
Co-authored-by: Bo Flynn <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nenad Vićentić <[email protected]>
Co-authored-by: Nenad Vicentic <[email protected]>
  • Loading branch information
10 people authored Feb 2, 2023
1 parent 7825f68 commit 376ec1e
Show file tree
Hide file tree
Showing 86 changed files with 1,690 additions and 1,232 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,19 @@ indent_size = 4

[*.csproj]
indent_size = 2

# Code files
[*.{cs,csx,vb,vbx}]
###############################
# Naming Conventions #
###############################
# Underscore for private fields
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.severity = suggestion

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget"
directory: "/" # Location of package manifests
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
150 changes: 150 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Continuous Integration

on:
push:
pull_request:
release:
types:
- published
env:
Configuration: Release
ContinuousIntegrationBuild: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/serilog-contrib/
GITHUB_USER: mivano
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
package:
runs-on: ubuntu-latest
name: Run tests and create NuGet package
outputs:
coverage-reports: ${{ steps.dotnet-test.outputs.coverage-reports }}
version: ${{ steps.dotnet-pack.outputs.version }}
nupkg-filename: ${{ steps.dotnet-pack.outputs.nupkg-filename }}
release-body: ${{ steps.tag-message.outputs.release-notes }}
steps:
- name: Checkout git repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install .NET SDK
uses: actions/[email protected]
with:
dotnet-version: '7.0.x'

- name: Retrieve cached NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}

- name: Restore NuGet packages
run: dotnet restore

- name: Build solution
run: dotnet build --no-restore -c Release

- name: Run tests
run: dotnet test --no-build -c Release --logger "html;LogFileName=TestResults-${{ runner.os }}.html" --logger "trx;LogFileName=TestResults-${{ runner.os }}.trx" --logger GitHubActions
id: dotnet-test

- name: Upload received files from failing tests
uses: actions/upload-artifact@v3
if: failure()
with:
name: Received-${{ runner.os }}
path: "**/*.received.*"

- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: TestResults-${{ runner.os }}
path: test/Serilog.Sinks.Elasticsearch.Tests/TestResults/TestResults-${{ runner.os }}.html

- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results (${{ runner.os }})
path: '**.trx'
reporter: dotnet-trx

- name: Create NuGet packages
run: dotnet pack --no-build -c Release --version-suffix "ci-$GITHUB_RUN_ID" --include-symbols --include-source --output .
id: dotnet-pack

- name: Upload NuGet package artifact
uses: actions/upload-artifact@v3
with:
name: nuget
path: '**/*.nupkg'

prerelease:
needs: package
name: Create prerelease
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: nuget
path: nuget
- name: Push to GitHub Feed
run: |
dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/serilog-contrib/index.json"
for f in ./nuget/*.nupkg
do
echo $f
dotnet nuget push $f --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
done
publish:
runs-on: ubuntu-latest
needs: package
if: github.event_name == 'release'
name: Publish NuGet package
steps:
- name: Checkout git repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install .NET SDK
uses: actions/[email protected]

- name: Retrieve cached NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}

- name: Restore NuGet packages
run: dotnet restore

- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
VERSION="${VERSION//v}"
dotnet pack -v normal -c Release --include-symbols --include-source -p:Version=$VERSION -o ./nuget
- name: Push to GitHub Feed
run: |
dotnet nuget add source --username $GITHUB_USER --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/serilog-contrib/index.json"
for f in ./nuget/*.nupkg
do
dotnet nuget push $f --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
done

- name: Publish NuGet package on nuget.org
run: dotnet nuget push ./nuget/*.nupkg --api-key "${{ secrets.NUGET_API_KEY }}" --skip-duplicate
73 changes: 73 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
# ******** NOTE ********

name: "CodeQL"

on:
push:
branches: [ dev, master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ dev ]
schedule:
- cron: '27 7 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup dotnet
uses: actions/[email protected]
with:
dotnet-version: '6.0.x'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
15 changes: 10 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"version": "0.1.0",
"version": "2.0.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"label": "build",
"type": "shell",
"command": "dotnet",
"args": [
"build",
"${workspaceRoot}/sample/Serilog.Sinks.Elasticsearch.Sample/Serilog.Sinks.Elasticsearch.Sample.csproj"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
"problemMatcher": "$msCompile",
"group": {
"_id": "build",
"isDefault": false
}
}
]
}
16 changes: 16 additions & 0 deletions .vscode/tasks.json.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
"${workspaceRoot}/sample/Serilog.Sinks.Elasticsearch.Sample/Serilog.Sinks.Elasticsearch.Sample.csproj"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
52 changes: 0 additions & 52 deletions Build.ps1

This file was deleted.

Loading

0 comments on commit 376ec1e

Please sign in to comment.