[MGNLHOOK-309] Make REST client environment aware on SaaS Created: 13/Dec/22  Updated: 06/Jan/23  Resolved: 06/Jan/23

Status: Closed
Project: Magnolia Webhooks
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0

Type: Story Priority: Neutral
Reporter: Javier Benito Assignee: Dai Ha
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLHOOK-307 Random problem reading environments o... Closed
relates to MGNLHOOK-308 Use new api to register custom rest c... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLHOOK-310 Implement Sub-task Completed Jaroslav Simak  
MGNLHOOK-311 Review Sub-task Completed Dai Ha  
MGNLHOOK-312 piQA Sub-task Completed Dai Ha  
MGNLHOOK-313 QA Sub-task Completed Dai Ha  
Team: DeveloperX
Date of First Response:
Epic Link: Webhook on SaaS
Sprint: DevX 28
Story Points: 5

 Description   

Description

REST client environment awareness on SaaS at this moment doesn't work well, it only manages properly one environment at a time.

Steps to reproduce

  • Create a webhook definition file on main environment, named webhook1 and having webhook1 as name inside the yaml file.
  • Push the file to git main branch.
  • Create the same file, with different URL for the request, but in environment/branch env/test.
  • Push the file to git env/test branch.

Current behaviour

When the file is pushed to env/test, it overrides the URL on the automatically created Rest Client (it can be checked on Definitions app on both environments, the share the same configuration).

Expected behaviour

Each environment must have its own Rest Client definition, even if the names are the same, so Rest Client definitions must be Environment Bounded.

Developer notes

We'll need to check if the problem is on Rest Client (how it manages definitions coming from different environments) or in Webhooks module (how it automatically creates/removes Rest Clients).



 Comments   
Comment by Dai Ha [ 21/Dec/22 ]

Issue: https://git.magnolia-cms.com/projects/ENTERPRISE/repos/webhooks/browse/magnolia-webhooks-core/src/main/java/info/magnolia/webhooks/rest/configuration/RestClientRegistryConfigurationSource.java#114

External rest client definitions from webhook were registered in memory -> last loaded environment will take effect on saas.

Propose:

  • Maintain a set of external definitions in info.magnolia.rest.client.registry.RestClientRegistry, append to getAllProviders and call onUpdate from getAllProviders to trigger environment aware registration

Estimation: 3-5 SP

Comment by Dai Ha [ 02/Jan/23 ]

On initialize, only defs from main is recognized due to MGNLHOOK-307, the workaround for other envs is triggering a small definition change for a full reload.

Generated at Mon Feb 12 10:03:00 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.