Skip to content

Conversation

@Peeanio
Copy link
Contributor

@Peeanio Peeanio commented Apr 2, 2025

Adding service catalog app registry backend. Supports creating/listing applications and associating resources. Associated resources can be tag value or Cloudformation stacks. AWS API raises "ResourceNotFoundException" when the CF stack is not present, but not sure how to search for the stack internally on the backend, or if it is required.

Happy to work through anything else missing.

@Peeanio Peeanio marked this pull request as ready for review April 8, 2025 20:33
Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Peeanio! It looks like the tests in ServerMode are currently failing, see for example: https://github.com/getmoto/moto/actions/runs/14364128261/job/40273952245?pr=8759

See for the documentation on how to run the tests locally in ServerMode, hopefully that gives some insight into why it's not working:
https://docs.getmoto.org/en/latest/docs/contributing/development_tips/tests.html#servermode-tests

Let me know if you get stuck - happy to have a look as well!

app = self._find_app_by_any_value(application)
if options is None:
options = []
new_resource = AssociatedResource(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Backend also has an associate_resource-method which does the same thing, we would be the 'proper' way to do it - did you mean to use that instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - I think did this out of order and came back to this. Addressed in latest commits

self.name = resource
cf_backend = cloudformation_backends[account_id][region_name]
try:
cf_backend.get_stack(self.name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see an integration with other services immediately builtin 👍

@Peeanio
Copy link
Contributor Author

Peeanio commented Apr 15, 2025

Thanks for your comments. I took a look at the docs, but could not see how to address the 404's that appear in server mode. My intuition is that there's probably some mismatch in the backend index matching "servicecatalog-appregistry" vs "servicecatalogappregistry" not hitting the defined URLs, but I can't find it even with some changes. Any advice there would be appreciated.

@bblommers
Copy link
Collaborator

@Peeanio These are the changes necessary to make the build pass:

Peeanio/moto@master...bblommers:servicecatalog-appregistry-fix-urls

Explanation, in order:

  1. CodeDeploy was presumably removed by accident from your branch, so I'm just adding that back in
  2. MotoServer has no way of differentiating AppRegistry requests from regular ServiceCatalog-requests. Incoming requests only say 'servicecatalog` in the headers, so MotoServer has no choice but to send them to the ServiceCatalog-service. Adding the AppRegistry-URL's to the ServiceCatalog-service is a trick to make sure we still invoke the correct method
  3. The regex change is necessary to support ARN's, as they may contain a slash

@codecov
Copy link

codecov bot commented Apr 21, 2025

Codecov Report

Attention: Patch coverage is 95.86207% with 6 lines in your changes missing coverage. Please review.

Project coverage is 92.82%. Comparing base (fcb513c) to head (403c645).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
moto/servicecatalogappregistry/responses.py 92.59% 4 Missing ⚠️
moto/servicecatalogappregistry/models.py 97.36% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #8759    +/-   ##
========================================
  Coverage   92.82%   92.82%            
========================================
  Files        1266     1271     +5     
  Lines      110646   110791   +145     
========================================
+ Hits       102704   102843   +139     
- Misses       7942     7948     +6     
Flag Coverage Δ
servertests 28.04% <1.37%> (-0.04%) ⬇️
unittests 92.80% <95.86%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Peeanio
Copy link
Contributor Author

Peeanio commented Apr 21, 2025

Changes looked good, thanks for the explanation.

@Peeanio Peeanio requested a review from bblommers April 21, 2025 17:14
Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thank you for adding this service to Moto @Peeanio!

@bblommers bblommers added this to the 5.1.4 milestone Apr 27, 2025
@bblommers bblommers merged commit 558dfd2 into getmoto:master Apr 27, 2025
56 of 57 checks passed
@bblommers bblommers modified the milestones: 5.1.4, 5.1.5 Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants