Skip to content

Commit 41fc9bd

Browse files
authored
Release 23.4 | Routing Update | MGGA release | +semver: minor (#2206)
* Update ReleaseNotes.md * Update docs * Update and test build script
1 parent 27d3df2 commit 41fc9bd

File tree

6 files changed

+153
-193
lines changed

6 files changed

+153
-193
lines changed

ReleaseNotes.md

+26-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
## :fire: Hot fixing v[23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4) (version {0}) aka [October'24](https://github.com/ThreeMammals/Ocelot/milestone/7) release
2-
> Read the Docs: [Ocelot 23.3](https://ocelot.readthedocs.io/en/{0}/)
3-
> Hot fixed version: [23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4)
4-
> Milestone: [October'24](https://github.com/ThreeMammals/Ocelot/milestone/7)
5-
6-
:heart: A heartfelt "Thank You" to **[Nikolai Masson](https://github.com/Niksson)** (@Niksson) and **[Nikolay Kuksov](https://github.com/kick2nick)** (@kick2nick) for their contributions!
1+
## :twisted_rightwards_arrows: Routing Update (version {0}) aka [MGGA](https://github.com/ThreeMammals/Ocelot/commits?author=ggnaegi) release
2+
> Codenamed: **[Make Guillaume Great Again!](https://github.com/ThreeMammals/Ocelot/commits?author=ggnaegi)**
3+
> Read the Docs: [Ocelot {0}](https://ocelot.readthedocs.io/en/{0}/)
74
85
### :information_source: About
9-
This release provides minor bug fixes from the previous [23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4) release. All bugs have been addressed in the [October'24](https://github.com/ThreeMammals/Ocelot/milestone/7) milestone.
6+
This minor release significantly upgrades the [Routing](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/routing.rst) feature by supporting [embedded placeholders](https://github.com/ThreeMammals/Ocelot/blob/{0}/docs/features/routing.rst#embedded-placeholders-1) within path segments (between slashes). Additionally, the team has focused on enhancing the performance of `Regex` objects.
7+
8+
### :new: What's new?
9+
- **[Routing](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/routing.rst)**: Introducing the new "[Embedded Placeholders](https://github.com/ThreeMammals/Ocelot/blob/{0}/docs/features/routing.rst#embedded-placeholders-1)" feature by @ggnaegi.
10+
As of November 2024, Ocelot was unable to process multiple [placeholders](https://github.com/ThreeMammals/Ocelot/blob/{0}/docs/features/routing.rst#placeholders) embedded between two forward slashes. It was also challenging to differentiate the placeholder from other elements within the slashes. For example, `/{{url}}-2/` for `/y-2/` would yield `{{url}} = y-2`. We are excited to introduce an enhanced method for evaluating placeholders that allows for the resolution of [placeholders](https://github.com/ThreeMammals/Ocelot/blob/{0}/docs/features/routing.rst#placeholders) within complex URLs.
11+
For additional information, refer to PR #2200.
1012

11-
:notebook: For projects utilizing the [Service Discovery](https://ocelot.readthedocs.io/en/latest/features/servicediscovery.html) feature, it is recommended to update to this version to benefit from the unstable release [23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4), which includes fixes for both `Consul` and `Kube` discovery providers.
13+
### :up: Focus On
14+
<details>
15+
<summary><b>Features</b>: Routing, Core, Rate Limiting, Middleware Injection</summary>
1216

13-
### :technologist: Technical Information
14-
The Ocelot solution encountered a significant issue with the disabled scope validation of services in the DI-container, affecting both testing projects and the core library. Initially, this was not problematic when services were designed as singletons by previous contributors and our team. However, with the introduction of more scoped services by the Ocelot team, it became clear that our testing projects could not adequately handle them.
15-
This patch introduces scope validation across all domains: unit tests, acceptance tests, and the core library itself. We advise always enabling scope validation in your custom Ocelot solutions, especially when dealing with numerous C# overridden classes in the DI-container and any attached custom functionality.
17+
- [Routing](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/routing.rst): The new feature is "[Embedded Placeholders](https://github.com/ThreeMammals/Ocelot/blob/{0}/docs/features/routing.rst#embedded-placeholders-1)" by @ggnaegi.
18+
- [Core](https://github.com/ThreeMammals/Ocelot/labels/Core): All `Regex` logic has been refactored by @EngRajabi.
19+
The Ocelot Core now boasts improved performance of `Regex` objects, striving to adhere to the [Best Practices for Regular Expressions in .NET](https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices). It is estimated that each request could save from 1 to over 10 microseconds in processing time (though no benchmarks have been developed to measure this).
20+
- [Rate Limiting](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/ratelimiting.rst): The persistent issue with [Rate Limiting headers](https://github.com/ThreeMammals/Ocelot/blob/{0}/docs/features/ratelimiting.rst#global-configuration:~:text=headers) has been resolved by @jlukawska.
21+
The problem was the absence of unofficial `X-Rate-Limit-*` headers (found in the [RateLimitingHeaders](https://github.com/ThreeMammals/Ocelot/blob/{0}/src/Ocelot/RateLimiting/RateLimitingHeaders.cs) class) in the `RateLimitingMiddleware`'s response. For more details, see PR #1307.
22+
Note that these unofficial headers have not yet been documented, so they may be subject to change since [Ocelot's RateLimiting headers do not align with industry standards, see links](https://github.com/ThreeMammals/Ocelot/blob/27d3df2d0fdfbf5acde12d9442dfc08836e8b982/src/Ocelot/RateLimiting/RateLimitingHeaders.cs#L6).
23+
- [Middleware Injection](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/middlewareinjection.rst): The `OcelotPipelineConfiguration.ClaimsToHeadersMiddleware` property has been introduced by @kesskalli.
24+
This new property enables the overriding of the [ClaimsToHeadersMiddleware](https://github.com/ThreeMammals/Ocelot/blob/{0}/docs/features/middlewareinjection.rst#middleware-injection:~:text=ClaimsToHeadersMiddleware). For additional information, refer to PR #1403.
25+
</details>
1626

17-
The patch enhances functionality for two primary [Service Discovery](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/servicediscovery.rst) providers:
18-
- The [Ocelot.Provider.Consul](https://www.nuget.org/packages/Ocelot.Provider.Consul) provider. The addressed bug is issue #2178, reported on October 17, 2024.
19-
The `System.InvalidOperationException` error stating _"Cannot resolve scoped service 'Ocelot.Provider.Consul.Interfaces.IConsulServiceBuilder' from root provider"_ has been resolved.
20-
To clarify, the `IConsulServiceBuilder` service is a scoped service in DI, injected via the `AddConsul()` or [AddConsul&lt;T&gt;()](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/servicediscovery.rst#addconsult-method) methods. Therefore, the `DefaultConsulServiceBuilder` should also be a scoped service, with `HttpContext` injected to meet your development requirements.
21-
- The [Ocelot.Provider.Kubernetes](https://www.nuget.org/packages/Ocelot.Provider.Kubernetes) provider had an issue reported as #977 on August 1, 2019.
22-
It involved a `System.InvalidOperationException` with the message: _"Cannot resolve scoped service 'KubeClient.IKubeApiClient' from root provider."_ This "invalid scopes" error occurred only in development mode, as release mode DLLs do not validate scopes. However, the `KubeApiClient` is designed to have a [scoped](https://github.com/tintoy/dotnet-kube-client/blob/84b055c885a2afe00781559ea400c0bd8cdfce6d/src/KubeClient.Extensions.DependencyInjection/ClientRegistrationExtensions.cs#L42-L43) lifetime. Acceptance tests passed because scope validation was disabled, and the `KubeClient` was [replaced](https://github.com/ThreeMammals/Ocelot/blob/414f63439d32ed9a3c09a77c86f035ed9c34aa56/test/Ocelot.AcceptanceTests/ServiceDiscovery/KubernetesServiceDiscoveryTests.cs#L315) with a singleton. This inconsistency was identified and reproduced by the old [977 issue](https://github.com/ThreeMammals/Ocelot/issues/977). As a temporary solution, the `IKubeApiClient` was [registered as a singleton](https://github.com/ThreeMammals/Ocelot/blob/e4bc9ff59d9defc385996a09be85fbb845e06af9/src/Ocelot.Provider.Kubernetes/OcelotBuilderExtensions.cs#L16).
23-
Looking ahead, our team intends to redesign the Kubernetes provider to have a default service builder that is scoped, similar to the Consul provider.
27+
<details>
28+
<summary><b>Documentation</b> for <a href="https://ocelot.readthedocs.io/en/{0}/">v{0}</a></summary>
2429

25-
### :exclamation: Breaking Changes
26-
Upgrading from [23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4) to [{0}](https://github.com/ThreeMammals/Ocelot/releases/tag/{0}) introduces **no breaking changes**. However, upgrading from [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0) or earlier versions may result in some incompatibilities. For further information, please refer to the release notes of v[23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4).
30+
- [Routing](https://ocelot.readthedocs.io/en/{0}/features/routing.html): Introducing a new section on [Embedded Placeholders](https://ocelot.readthedocs.io/en/{0}/features/routing.html#embedded-placeholders)
31+
- [Middleware Injection](https://ocelot.readthedocs.io/en/{0}/features/middlewareinjection.html): Documentation now includes the [ClaimsToHeadersMiddleware](https://ocelot.readthedocs.io/en/{0}/features/middlewareinjection.html#middleware-injection:~:text=ClaimsToHeadersMiddleware) feature
32+
</details>

build.cake

+21-15
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ Task("Version")
138138
Task("GitLogUniqContributors")
139139
.Does(() =>
140140
{
141-
Information("---==< Unique Contributors >==---");
142141
var command = "log --format=\"%aN|%aE\" ";
143142
// command += IsRunningOnCircleCI() ? "| sort | uniq" :
144143
// IsRunningInPowershell() ? "| Sort-Object -Unique" : "| sort | uniq";
@@ -159,7 +158,7 @@ Task("GitLogUniqContributors")
159158

160159
Task("CreateReleaseNotes")
161160
.IsDependentOn("Version")
162-
.IsDependentOn("GitLogUniqContributors")
161+
//.IsDependentOn("GitLogUniqContributors")
163162
.Does(() =>
164163
{
165164
Information($"Generating release notes at {releaseNotesFile}");
@@ -204,12 +203,14 @@ Task("CreateReleaseNotes")
204203
var emailInfo = debugUserEmail ? ", " + contributor.Email : string.Empty;
205204
return $"{stars} {contributor.Author}{emailInfo}";
206205
}
207-
// foreach (var contributor in summary)
208-
// {
209-
// starring.Add(CreateStars(contributor.Commits, contributor.Author));
210-
// }
211-
// Information("---==< Old Starring >==---");
212-
// Information(string.Join(Environment.NewLine, starring));
206+
207+
Information("------==< Old Starring >==------");
208+
foreach (var contributor in summary)
209+
{
210+
starring.Add(CreateStars(contributor.Commits, contributor.Author));
211+
}
212+
Information(string.Join(Environment.NewLine, starring));
213+
213214
var commitsGrouping = summary
214215
.GroupBy(x => x.Commits)
215216
.Select(CreateCommitsGroupingItem)
@@ -221,7 +222,7 @@ Task("CreateReleaseNotes")
221222
byFiles: (log, group, fGroup) => CreateStars(group.Commits, fGroup.Contributors.First().Contributor),
222223
byInsertions: (log, group, fGroup, insGroup) => CreateStars(group.Commits, insGroup.Contributors.First().Contributor),
223224
byDeletions: (log, group, fGroup, insGroup, contributor) => CreateStars(group.Commits, contributor.Contributor));
224-
Information("---==< Starring >==---");
225+
Information("------==< New Starring >==------");
225226
Information(string.Join(Environment.NewLine, starring));
226227

227228
// Honoring aka Top Contributors
@@ -366,15 +367,20 @@ Task("CreateReleaseNotes")
366367
}
367368
return log;
368369
} // END of IterateCommits
369-
// releaseNotes.Add("### Honoring :medal_sports: aka Top Contributors :clap:");
370-
// releaseNotes.AddRange(topContributors.Take(3)); // Top 3 only, disabled 'breaker' logic
371-
// releaseNotes.Add("");
370+
releaseNotes.Add("### Honoring :medal_sports: aka Top Contributors :clap:");
371+
releaseNotes.AddRange(topContributors.Take(3)); // Top 3 only, disabled 'breaker' logic
372+
releaseNotes.Add("");
372373
releaseNotes.Add("### Starring :star: aka Release Influencers :bowtie:");
373374
releaseNotes.AddRange(starring);
374375
releaseNotes.Add("");
375-
// releaseNotes.Add($"### Features in Release {releaseVersion}");
376-
// var commitsHistory = GitHelper($"log --no-merges --date=format:\"%A, %B %d at %H:%M\" --pretty=format:\"<sub>%h by **%aN** on %ad &rarr;</sub>%n%s\" {lastRelease}..HEAD");
377-
// releaseNotes.AddRange(commitsHistory);
376+
releaseNotes.Add($"### Features in Release {releaseVersion}");
377+
releaseNotes.Add("");
378+
releaseNotes.Add("<details><summary>Logbook</summary>");
379+
releaseNotes.Add("");
380+
var commitsHistory = GitHelper($"log --no-merges --date=format:\"%A, %B %d at %H:%M\" --pretty=format:\"- <sub>%h by **%aN** on %ad &rarr;</sub>%n %s\" {lastRelease}..HEAD");
381+
releaseNotes.AddRange(commitsHistory);
382+
releaseNotes.Add("</details>");
383+
releaseNotes.Add("");
378384
WriteReleaseNotes();
379385
});
380386

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
project = 'Ocelot Gateway'
1010
copyright = ' 2016-2024, ThreeMammals Ocelot team'
1111
author = 'Tom Pallister, Raman Maksimchuk'
12-
release = '23.3'
12+
release = '23.4'
1313

1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/features/routing.rst

+28-12
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@ This means that when Ocelot tries to match the incoming upstream URL with an ups
7676
Embedded Placeholders [#f1]_
7777
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7878

79-
Until now (November 2024), Ocelot could not evaluate multiple placeholders embedded between two forward slashes.
80-
Additionally, it was not possible to distinguish the placeholder from other elements between the slashes.
81-
For instance, ``/{url}-2/`` for ``/y-2/`` would return ``{url} = y-2``. We now propose a revised version of placeholder evaluation that enables the resolution of placeholders in complex URLs, such as:
79+
Prior to version `23.4`_, Ocelot was unable to evaluate multiple placeholders embedded between two forward slashes, ``/``.
80+
It was also challenging to differentiate the placeholder from other elements within the slashes.
81+
For example, ``/{url}-2/`` when applied to ``/y-2/`` would yield ``{url} = y-2``.
8282

83-
Path pattern: ``/api/invoices_{url0}/{url1}-{url2}_abcd/{url3}?urlId={url4}``
83+
We now introduce an improved method of placeholder evaluation that facilitates the identification of placeholders in complex URLs. For example:
8484

85-
Upstream path: ``/api/invoices_super/123-456_abcd/789?urlId=987``
85+
- **Given** path pattern: ``/api/invoices_{url0}/{url1}-{url2}_abcd/{url3}?urlId={url4}``
86+
- **When** upstream URL path: ``/api/invoices_super/123-456_abcd/789?urlId=987``
87+
- **Then** resulting placeholders would be ``{url0} = super``, ``{url1} = 123``, ``{url2} = 456``, ``{url3} = 789``, ``{url4} = 987``
8688

87-
Parsed placeholders: ``{url0} = super``, ``{url1} = 123``, ``{url2} = 456``, ``{url3} = 789``, ``{url4} = 987``
89+
**Note**, we believe this feature should be compatible with any URL query strings, although it has not been thoroughly tested.
8890

8991
.. _routing-empty-placeholders:
9092

@@ -419,16 +421,30 @@ The idea is to enable dynamic routing when using a :doc:`../features/servicedisc
419421
See the :ref:`sd-dynamic-routing` docs if this sounds interesting to you.
420422

421423

422-
.. [#f1] ":ref:`routing-embedded-placeholders`" feature was requested as part of `issue 2199 <https://github.com/ThreeMammals/Ocelot/issues/2199>`_.
423-
.. [#f2] ":ref:`routing-empty-placeholders`" feature is available starting in version `23.0 <https://github.com/ThreeMammals/Ocelot/releases/tag/23.0.0>`_, see issue `748 <https://github.com/ThreeMammals/Ocelot/issues/748>`_ and the `23.0 <https://github.com/ThreeMammals/Ocelot/releases/tag/23.0.0>`__ release notes for details.
424-
.. [#f3] ":ref:`routing-upstream-host`" feature was requested as part of `issue 216 <https://github.com/ThreeMammals/Ocelot/pull/216>`_.
425-
.. [#f4] ":ref:`routing-upstream-headers`" feature was proposed in `issue 360 <https://github.com/ThreeMammals/Ocelot/issues/360>`_, and released in version `24.0 <https://github.com/ThreeMammals/Ocelot/releases/tag/24.0.0>`_.
426-
.. [#f5] ":ref:`routing-security-options`" feature was requested as part of `issue 628 <https://github.com/ThreeMammals/Ocelot/issues/628>`_ (of `12.0.1 <https://github.com/ThreeMammals/Ocelot/releases/tag/12.0.1>`_ version), then redesigned and improved by `issue 1400 <https://github.com/ThreeMammals/Ocelot/issues/1400>`_, and published in version `20.0 <https://github.com/ThreeMammals/Ocelot/releases/tag/20.0.0>`_ docs.
427-
.. [#f6] ":ref:`routing-dynamic`" feature was requested as part of `issue 340 <https://github.com/ThreeMammals/Ocelot/issues/340>`_. Complete reference: :ref:`sd-dynamic-routing`.
424+
.. [#f1] ":ref:`routing-embedded-placeholders`" feature was requested as part of issue `2199`_ , and released in version `23.4`_
425+
.. [#f2] ":ref:`routing-empty-placeholders`" feature is available starting in version `23.0`_, see issue `748`_ and the `23.0`_ release notes for details.
426+
.. [#f3] ":ref:`routing-upstream-host`" feature was requested as part of issue `216`_.
427+
.. [#f4] ":ref:`routing-upstream-headers`" feature was proposed in issue `360`_, and released in version `23.3`_.
428+
.. [#f5] ":ref:`routing-security-options`" feature was requested as part of issue `628`_ (version `12.0.1`_), then redesigned and improved by issue `1400`_, and published in version `20.0`_ docs.
429+
.. [#f6] ":ref:`routing-dynamic`" feature was requested as part of issue `340`_. Refer to complete reference: :ref:`sd-dynamic-routing`.
428430
429431
.. _model binding: https://learn.microsoft.com/en-us/aspnet/core/mvc/models/model-binding?view=aspnetcore-8.0#collections
430432
.. _Bind arrays and string values from headers and query strings: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/parameter-binding?view=aspnetcore-8.0#bind-arrays-and-string-values-from-headers-and-query-strings
433+
434+
.. _216: https://github.com/ThreeMammals/Ocelot/issues/216
431435
.. _270: https://github.com/ThreeMammals/Ocelot/issues/270
436+
.. _340: https://github.com/ThreeMammals/Ocelot/issues/340
437+
.. _360: https://github.com/ThreeMammals/Ocelot/issues/360
432438
.. _473: https://github.com/ThreeMammals/Ocelot/issues/473
439+
.. _628: https://github.com/ThreeMammals/Ocelot/issues/628
440+
.. _748: https://github.com/ThreeMammals/Ocelot/issues/748
433441
.. _952: https://github.com/ThreeMammals/Ocelot/issues/952
434442
.. _1174: https://github.com/ThreeMammals/Ocelot/issues/1174
443+
.. _1400: https://github.com/ThreeMammals/Ocelot/issues/1400
444+
.. _2199: https://github.com/ThreeMammals/Ocelot/issues/2199
445+
446+
.. _12.0.1: https://github.com/ThreeMammals/Ocelot/releases/tag/12.0.1
447+
.. _20.0: https://github.com/ThreeMammals/Ocelot/releases/tag/20.0.0
448+
.. _23.0: https://github.com/ThreeMammals/Ocelot/releases/tag/23.0.0
449+
.. _23.3: https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0
450+
.. _23.4: https://github.com/ThreeMammals/Ocelot/releases/tag/23.4.0

0 commit comments

Comments
 (0)