A build definition says when it runs in a trigger block of its own
`onPush`, `atTimes`, `branches`, and `activeWithin` move into a nested `trigger`. The split is structural on purpose: the inheritance from `builds.default` now subtracts one key instead of a list of four, so a selector added to `TriggerConfig` later is non-inheritable by construction rather than because someone remembered to extend the list. A definition still writing those keys flat is refused by name, per file and scoped like the version check — the machine and project config abort the start, a branch's committed config fails only that branch. Ignoring them would leave the build with no trigger at all, which is a job that quietly stops running: the failure this refusal exists to prevent. Two more things a definition can now say: - A `!` prefix in `trigger.branches` excludes, and an exclusion wins whatever the order. `["*", "!master"]` gives one branch a build of its own without the default build running over it as well — until now the only way out of that double build was to drop the second definition's push trigger. - `statusContext` overrides the Gitea check this build reports as, empty keeping the repository-wide one. Two builds of a commit shared a context and overwrote each other's result, so a quick check beside a long build was not readable in Gitea. Pinned like `requirePullRequest`: a branch that could pick its context could take over the check a branch protection rule depends on. Fixed on the way: a branch whose builds all belong to named definitions rendered an empty row in the branches view, reading as "never built" directly beside its real builds. That row was unreachable before the exclusion patterns made such a branch possible.
This commit is contained in:
@@ -31,6 +31,19 @@ class BranchListingTest : FunSpec() {
|
||||
every { repository.latestPerName() } returns emptyList()
|
||||
}
|
||||
|
||||
test("a branch built only by named definitions loses its empty default row") {
|
||||
val releaseResult = mainResult.copy(build = "release", name = "master@release")
|
||||
every { gitService.originBranchHeads(any()) } returns mapOf("master" to "aaa", "idle" to "bbb")
|
||||
every { repository.latestPerName() } returns listOf(releaseResult.copy(branch = "master"))
|
||||
every { repository.latestFor(any()) } returns null
|
||||
every { repository.latestGreenFor(any()) } returns null
|
||||
|
||||
val rows = listing.branches()
|
||||
|
||||
// no bare "master" row next to master@release — it would read as "never built"
|
||||
rows.map { it.name } shouldBe listOf("master@release", "idle")
|
||||
}
|
||||
|
||||
test("orders main/master first, then flat names, then hierarchical names") {
|
||||
every { gitService.originBranchHeads(any()) } returns
|
||||
mapOf(
|
||||
|
||||
Reference in New Issue
Block a user