Creating a version endpoint
Deploying across services? Ensure end-to-end tests run on the correct version with a simple API for reporting commit hashes.
Premium Field Note
Creating a version endpoint
In my project, I'm deploying an application to both Laravel Forge and Modal.com. My deployment pipeline includes deterministic checks, testing, and then deployment to Forge via a post request that triggers Forge to pull and deploy. The challenge is that the GitHub workflow's success doesn't guarantee a successful Forge deployment. I could have issues like a bad deploy script or composer lock file, and the agent wouldn't know about it. This can lead to end-to-end tests running against the old version or starting prematurely before the deploy is complete.
I also deploy to Modal, which has its own deployment step. For my end-to-end tests, I need both Forge and Modal to be deployed correctly, and the agent needs visibility across both to confirm this. Instead of using the Forge and Modal APIs, I've implemented a simple solution: an API endpoint in both apps that reports the version hash (Git SHA) of the deployed code. The agent can now ping these URLs to confirm that both services are deployed and serving the same commit. This prevents issues where end-to-end tests run against different versions, saving me from frustration. This simple API endpoint exposes the version hash to my agents and has been super helpful.