don't mark already non-interceptible builds
also simplify build status check; if it's completed and not
aborted/failed/errored, it can only be succeeded, which seems clearer as
that's more strictly the case where we don't want to intercept
concourse/concourse#1218
@@ -69,16 +69,13 @@ func (f *buildFactory) MarkNonInterceptibleBuilds() error {
_, err := psql.Update("builds").
Prefix(latestBuildsPrefix).
Set("interceptible", false).
- Where(sq.Or{
- sq.Expr("id NOT IN (select build_id FROM latest_builds)"),
- sq.And{
- sq.NotEq{"status": string(BuildStatusAborted)},
- sq.NotEq{"status": string(BuildStatusFailed)},
- sq.NotEq{"status": string(BuildStatusErrored)},
- },
- }).
Where(sq.Eq{
"completed": true,
+ "interceptible": true,
+ }).
+ Where(sq.Or{
+ sq.Expr("id NOT IN (select build_id FROM latest_builds)"),
+ sq.Eq{"status": string(BuildStatusSucceeded)},
}).
RunWith(f.conn).
Exec()
