A platform move quietly disconnected my deploys
A site of mine kept serving a 56-day-old build because pushes had stopped producing deployments. The check that would have caught it, and a broken contact form I found the day before with the same root problem.
After you push to a site that deploys from Git, look at the deployment list and confirm that a new deployment exists for your commit. If the newest one is older than your push, the pipeline is disconnected, whatever the Git side shows. I found out on May 15 that I had not been doing this, and that one of my sites had been serving the same build for 56 days.
The check
It is one comparison. Take the time of your last push to the production branch. Take the time of the newest production deployment. The second should follow shortly after the first.
Every hosting platform that builds from Git has a deployment list, in the dashboard and usually from a command line tool as well. Looking at it is quick. I had stopped looking because the integration had always worked.
What I found
One of my side businesses has a small site on a hosting platform that builds from a connected Git repository. The platform's documentation describes the normal behavior: automatic deployments on every branch push, and a production deployment each time you merge to the production branch.
On May 15 I pushed a small change to the main branch, a redirect rule in the project's configuration file. The push succeeded. The site did not change.
I listed the project's deployments. The newest one was 56 days old. No build had been queued for my push. The public site had been serving that 56-day-old deployment the whole time, and serving it well, which is why nothing had looked wrong. A static site that is frozen looks identical to one that is healthy until you try to change it.
What had changed
At some point the project had been transferred from one team to another on the hosting platform. One visible trace was left behind. The project's deployment addresses still carried the old team's name, even though the project now sat under the new one.
The platform's documentation for transfers lists the Git repository link among the things that move with a project, and says that integrations attached to a project have to be added again afterward. On my project, pushes stopped producing builds after the move. I have not pinned down the exact mechanism, and I am not going to guess at it here. I know the symptom and I know what cleared it.
Whatever the mechanism, the gap was mine. I moved a project between teams and never pushed a test commit afterward to see whether a build would start.
Why nothing told me
The platform tells me when a build fails. In this case no build started, so there was nothing to fail and nothing to report. The Git host reported a successful push, correctly, because the push did succeed. Each system was telling the truth about its own half.
An uptime monitor would not have helped either. The site was up. It answered every request with a valid page from March.
A broken connection between two healthy systems is hard to see for this reason. Each one monitors itself. The link between them belongs to whoever set it up, and in this case that was me.
- Project moves between teamsAt some point the project was transferred on the hosting platform.
- Pushes stop producing buildsNo build starts, so there is nothing to fail and nothing to report.
- The old build keeps servingThe site answers every request with a valid page, so it looks healthy.
- The deployment list shows itOn May 15 my push succeeded and the newest deployment was 56 days old.
I have not pinned down the exact mechanism. Reconnecting the repository in the project's Git settings cleared it.
Getting the change out
There were two steps.
To ship the change that day, I deployed from the command line. A manual deployment builds whatever is in your working directory, so do it from a clean checkout of the commit you mean to ship. Otherwise you publish whatever half-finished edit happens to be sitting there.
The durable fix is to reconnect the repository in the project's Git settings, then push a commit and watch a build appear. The second half matters. Do not stop when the settings page says the repository is connected. Watch a build start.
Then I went looking for the same problem elsewhere. Any project whose deployment addresses still show an old team name has been through the same kind of move and deserves a test push. I checked another site of that business on the same platform, and it was deploying from Git normally.
The form I had found the day before
On May 14, one day earlier, I had fixed something that turned out to be the same kind of failure.
A contact form on another of that business's sites had been returning an error on every submission since the day it went live. In about 30 days of data there was not one successful submission.
The cause was plain once I read the handler. It tried to insert each submission into a database table whose columns did not match what it was writing. The table had been built for a different purpose. The insert failed every time. The code that sent the notification emails came after the insert, inside the same error-handling block, so the emails never went out either. The handler caught the error and returned a server error to the visitor. I got nothing at all.
I gave the form its own table, with columns that match the form. The new table also records when the notification email was sent, and the error text if sending failed. A failed email now leaves a mark on the row where I will see it.
For that month, the site was up, the page loaded and the form rendered. Anyone who filled it in got an error, and I heard nothing about it.
What I would set up
Both failures passed every check I had, because every check I had asked whether something was running. Neither asked whether the thing had done its job. These are the checks that ask the second question.
- Put the commit ID in the deployed site. A version file or a meta tag is enough. Compare it with the head of the production branch on a schedule. If they differ for more than a few minutes, something between Git and production is broken.
- Test after every account change. When a project moves between teams, or a repository moves between owners, or an integration is reinstalled, push a trivial commit to every affected project and watch for the build. Do it the same day.
- Submit your own forms on a schedule. A test submission should produce a row and an email. Check for both.
- Alert on nothing. Zero submissions in 30 days could be a quiet month or a dead form. Zero deployments in 56 days could be a stable site or a cut wire. A count that stays at zero for longer than you would expect is worth a message either way.
One caveat. Each of these checks is another small thing that can break without telling you. Keep them few, and have each one report when it runs as well as when it fails.
In a larger organization the ownership splits. The platform team owns the integration between the Git host and the deployment system. The application team owns the answer to "did my change reach production," and should not assume the platform team is watching that for them. On my own projects I am both teams, so I have nobody to hand it to.
Views are my own.