Cheat notes · Module 09 · Secure and extend
Capstone: team-checkout's ownership check
A five-minute review for when you have done this module and want it back in your head. Open the full module for the steps and the lab, or the full text to print.
The idea
A plugin is done when other teams can extend it without asking you. team-checkout ships an owner-is-team check as its own module, links a runbook, and the platform proves every test is green.
Remember
- team-checkout's module:
readiness-backend-module-ownership, generated withyarn new, addsowner-is-teamthrough the extension point, with its own test. - Background-safe: the check calls the catalog with the plugin's own credentials, because it also runs in the scheduled job, where there is no user.
- Get to 100: add the runbook to
metadata.linksin checkout'scatalog-info.yaml, refresh the entity, evaluate. - Prove it:
yarn tscand every plugin's tests; seven checks,checkoutat 100%.
Pitfalls
- Calling the catalog with the request's credentials inside a check: it fails in the scheduled job, which has no user.
- Changing the plugin to add a team's check. If the team needed you, the extension point is not doing its job.
Commands
for p in readiness readiness-backend readiness-backend-module-api readiness-backend-module-ownership permission-backend-module-acme; do yarn --cwd plugins/$p test --watchAll=false || break; done | Run every plugin's tests |
curl -s -H "Authorization: Bearer $PORTAL_API_TOKEN" -X POST -H 'Content-Type: application/json' localhost:7007/api/readiness/evaluate -d '{"entityRef":"component:default/checkout"}' | jq .score | Score checkout now |
Test yourself
Answer in your head first, then open the answer.
What did team-checkout need from the platform team to add owner-is-team?
Nothing: the extension point, yarn new and a review of their own folder.
Why does owner-is-team call the catalog with the plugin's own credentials?
It runs in the scheduled job too, where there is no user.
What would you build next for this plugin?
Notifications to the owning team when a score drops below the pass score.
Where module 09 leaves you: Seven checks, checkout at 100%, every test green, all merged.