forked from Shopify/shipit-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix corrupt git cache causes "exit status 128"
When the stack's git cache repository is in an invalid state, tasks and deployments will fail indicating that `git: exited with status 128` until a human intervenes to clear the stack's git cache. For example, when shipit first creates a stack a background job like CacheDeploySpecJob and/or FetchDeployedRevisionJob will run shortly after. These make use of the StackCommands#with_temporary_working_directory method to populate the local git cache before performing their primary work. When the initial clone of the git cache fails the git repository may be in an invalid state. Subsequent attempts to interact with the git repository will result in the git program exiting with status 128. A concrete scenario in which we've seen this surface. We recently experienced instability due to over-scheduling of memory resources on one of the nodes in our Kubernetes clusters on which these shipit-engine jobs run. Some of the sidekiq workers running these jobs were OOMKilled by the kernel due to congestion / contention on node memory. The result is that these stacks remain in a state where they did not yet, nor would they ever be able to, cache their deploy spec. This means they appear "stuck" until a human realizes the on-disk git cache is broken and manually schedules a ClearGitCacheJob through the UI for the stack. The idea of behind this bod of work is to make shipit-engine more resilient - self-healing - in such cases. The approach enhances shipit-engine's existing file-system checks of the stack's git cache. If the git cache is a working git repository, then use it. Otherwise throw away the broken on-disk git cache and re-clone the repository.
- Loading branch information
1 parent
12e3c00
commit 00def0c
Showing
3 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters