This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't link failed builds to 'latest' link
NOTE: We use the terms 'link' and 'symlink' interchangeably. BACKGROUND: 1. Builds that exit with a non-zero status code are (and should be) considered failed by mistry's semantics. Those builds are not linked to the 'latest' build, since we only want successful builds to serve as a cache for incremental building. 2. When a new build is submitted, we first check if there's an identical (i.e. same params) previous build already finished, so that we can short-circuit and use it's results (aka. "build result cache") instead of building again the same things. However, if that previous build was a failure, we remove it completely from the filesystem and proceed with the new build (essentially re-building). BUG: The code that determined if we should link a finished build to 'latest' (i.e. by checking if the build was successful), did NOT check the exit code of the build's container. Therefore we would (erroneously) link failed builds to 'latest', which violates (1). Then if a subsequent identical build was submitted, we'd see that the cached result is a failure and we'd remove the build (see (2)), despite it being a link to 'latest'. This is obviously bad, since we should never delete a build pointed to by the 'latest' link. This would cause builds to fallback to non-incremental mode (i.e. start with cold caches), even though they should be incremental. FIX: From now on, take into account the container command exit code to determine if the build should be linked from the 'latest' link. If the build exited with a non-zero status code, we do not link it.
- Loading branch information
Showing
6 changed files
with
54 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM debian:stretch | ||
|
||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | ||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh | ||
|
||
WORKDIR /data | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] |
2 changes: 2 additions & 0 deletions
2
cmd/mistryd/testdata/projects/failed-build-link/docker-entrypoint.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
exit `cat params/_exitcode` |
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