Let auto-build slots run their own build command under their own name
A branches.<name>.autoBuild.times entry is now either a plain HH:MM string or an object with time, its own buildCommand, and a name, so a nightly slot can run a fuller check than the on-commit builds. The watcher passes the slot's command and name to the executor, persisted in the build result — UI restarts, gittally retry, and the startup recovery repeat a build with the command and name it originally ran under. A named slot (e.g. master@nightly) gets its own pool: repository grouping, retention count, branches-view row (sorted after its branch), latest status, and permanent latest-green artifact link are keyed by the build name, while origin lookups, gone-branch pruning, worktrees, and Gitea links/statuses stay keyed by the real branch. Without a name, slot builds share the branch's pool as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
f292badac1
commit
8aee3190ea
@@ -9,7 +9,10 @@ val BuildStatus.jsonName: String
|
||||
get() = name.lowercase()
|
||||
|
||||
data class BuildResultDto(
|
||||
/** The git branch that was built; the UI links this to Gitea. */
|
||||
val branch: String,
|
||||
/** The build name the result is recorded under; the UI displays and restarts by this (= [branch] unless a named auto-build slot). */
|
||||
val name: String = branch,
|
||||
val commit: String,
|
||||
val status: String,
|
||||
val startedAt: Instant,
|
||||
@@ -17,7 +20,7 @@ data class BuildResultDto(
|
||||
val runningSince: Instant? = null,
|
||||
val durationSeconds: Long?,
|
||||
val artifactKey: String,
|
||||
/** The permanent branch URL, set only on the build it resolves to — the branch's latest green build. */
|
||||
/** The permanent branch URL, set only on the build it resolves to — the name's latest green build. */
|
||||
val latestGreenUrl: String? = null,
|
||||
) {
|
||||
companion object {
|
||||
@@ -26,13 +29,14 @@ data class BuildResultDto(
|
||||
isLatestGreen: Boolean = false,
|
||||
) = BuildResultDto(
|
||||
branch = result.branch,
|
||||
name = result.name,
|
||||
commit = result.commit,
|
||||
status = result.status.jsonName,
|
||||
startedAt = result.startedAt,
|
||||
runningSince = result.runningSince,
|
||||
durationSeconds = result.duration?.seconds,
|
||||
artifactKey = result.artifactKey,
|
||||
latestGreenUrl = if (isLatestGreen) BranchPermalinks.permanentUrl(result.branch) else null,
|
||||
latestGreenUrl = if (isLatestGreen) BranchPermalinks.permanentUrl(result.name) else null,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -45,7 +49,10 @@ data class BuildResultDto(
|
||||
* where it resolves to.
|
||||
*/
|
||||
data class BranchDto(
|
||||
/** The git branch; the UI links this to Gitea. */
|
||||
val branch: String,
|
||||
/** The row's build name; = [branch], except for the extra rows of named auto-build slots. */
|
||||
val name: String = branch,
|
||||
val commit: String,
|
||||
val status: String,
|
||||
val startedAt: Instant?,
|
||||
@@ -60,9 +67,11 @@ data class BranchDto(
|
||||
headCommit: String,
|
||||
latest: BuildResult?,
|
||||
isLatestGreen: Boolean = false,
|
||||
name: String = branch,
|
||||
) = if (latest == null) {
|
||||
BranchDto(
|
||||
branch = branch,
|
||||
name = name,
|
||||
commit = headCommit,
|
||||
status = CommitStatusDto.UNKNOWN_STATUS,
|
||||
startedAt = null,
|
||||
@@ -72,13 +81,14 @@ data class BranchDto(
|
||||
} else {
|
||||
BranchDto(
|
||||
branch = branch,
|
||||
name = name,
|
||||
commit = latest.commit,
|
||||
status = latest.status.jsonName,
|
||||
startedAt = latest.startedAt,
|
||||
runningSince = latest.runningSince,
|
||||
durationSeconds = latest.duration?.seconds,
|
||||
artifactKey = latest.artifactKey,
|
||||
latestGreenUrl = if (isLatestGreen) BranchPermalinks.permanentUrl(branch) else null,
|
||||
latestGreenUrl = if (isLatestGreen) BranchPermalinks.permanentUrl(name) else null,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -87,6 +97,8 @@ data class BranchDto(
|
||||
/** One entry of `GET /api/builds/current`; the log grows while the build runs. */
|
||||
data class CurrentBuildDto(
|
||||
val branch: String,
|
||||
/** The build name; = [branch] unless a named auto-build slot triggered this build. */
|
||||
val name: String = branch,
|
||||
val commit: String,
|
||||
val artifactKey: String,
|
||||
val status: String,
|
||||
|
||||
Reference in New Issue
Block a user