fix(github): create build records for all unique taskGroupIds by nitishagar · Pull Request #8756 · taskcluster/taskcluster · GitHub
Skip to content

fix(github): create build records for all unique taskGroupIds#8756

Open
nitishagar wants to merge 1 commit into
taskcluster:mainfrom
nitishagar:fix/8751-github-multi-taskgroup-builds
Open

fix(github): create build records for all unique taskGroupIds#8756
nitishagar wants to merge 1 commit into
taskcluster:mainfrom
nitishagar:fix/8751-github-multi-taskgroup-builds

Conversation

@nitishagar

Copy link
Copy Markdown
Contributor

Problem

When a .taskcluster.yml defines tasks with different taskGroupId values, the GitHub service only recorded tasks[0]'s taskGroupId in the github_builds table and only published taskGroupCreationRequested for that first group. All other task groups were invisible to GitHub checks and statuses — the build record was never created, so no status was ever posted.

What changed

services/github/src/handlers/job.js

The graphConfig.tasks processing block now:

  1. Builds an ordered Map<taskGroupId, routes> over all tasks, keeping the routes of the first task in each group.
  2. Creates one github_builds row per unique taskGroupId (parallel, like the hooks path).
  3. Calls createTasks unchanged (still a single call with all tasks).
  4. Calls cancelPreviousTaskGroups once with the first new build. Sibling builds from the same event share the same event_id and are already excluded by the existing event_id filter inside cancelPreviousTaskGroups, so no interface change was needed there.
  5. Publishes taskGroupCreationRequested once per unique taskGroupId (mirroring the hooks code path).

No database schema or API changes are needed — github_builds already supports multiple rows per SHA with different task_group_id values, and downstream handlers (status.js, deprecatedStatus.js, taskGroupCreation.js) look up builds by taskGroupId and need no changes.

Test coverage

  • New fixture valid-yaml-v1-multi-group.json: 3 tasks — task1 and task2 in group A, task3 in group B.
  • multi-group yml creates one build record per unique taskGroupId — verifies 2 github_builds rows (one per group), both pending.
  • multi-group yml publishes taskGroupCreationRequested once per unique group — verifies exactly 2 publishes, one per group ID.
  • multi-group yml calls cancelPreviousTaskGroups once for pull_request — verifies the function is called exactly once regardless of group count.
  • does not cancel sibling task groups from the same event (in cancelPreviousTaskGroups unit suite) — verifies that builds from the same event (same event_id) are not cancelled when cancelPreviousTaskGroups is called for one of them.

Maintainer note

I followed the hooks code path (job.js:335-392) as the structural model, which already publishes taskGroupCreationRequested once per hook. I'd welcome feedback on whether publishing once per unique taskGroupId is the right behaviour, or whether there are downstream consumers that expect a single publish per job event.

Fixes #8751

@nitishagar nitishagar requested a review from a team as a code owner June 12, 2026 15:32
@nitishagar nitishagar requested review from lotas, matt-boris and petemoore and removed request for a team June 12, 2026 15:32
@github-project-automation github-project-automation Bot moved this to Backlog / Inbox in TC intake board Jun 12, 2026
@nitishagar nitishagar force-pushed the fix/8751-github-multi-taskgroup-builds branch from e5d7967 to ab52904 Compare June 12, 2026 15:41
@lissyx

lissyx commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

…uster#8751)

When .taskcluster.yml defines tasks with different taskGroupId values,
the github service now creates one github_builds row and publishes one
taskGroupCreationRequested message per unique taskGroupId. Previously
only tasks[0]'s group was recorded, leaving all other task groups
invisible to GitHub checks and statuses.

cancelPreviousTaskGroups is called once after all records are created;
sibling builds from the same event share the same event_id and are
already excluded by the existing event_id filter, so no interface
change was needed there.

Fixes taskcluster#8751
@nitishagar nitishagar force-pushed the fix/8751-github-multi-taskgroup-builds branch from ab52904 to 4c07ea1 Compare June 19, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog / Inbox

Development

Successfully merging this pull request may close these issues.

Github service only tracks taskGroupId of first defined task

2 participants