oxidecomputer / oxidecomputer/buildomat

Record and expose the PR number for GitHub jobs

Open
#71 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
72
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Right now buildomat tracks some metadata through tags in GitHub jobs (for example gong.run.github_id or gong.head.branch).

I'm working on the Omicron integration with Trunk, which requires running their CLI with a secret token to upload JUnit XML reports to their platform. As Buildomat doesn't support secrets, I created a GitHub Actions workflow with the secret that calls a script responsible for fetching all the metadata Trunk requires, the JUnit XML report, and uploading it to their platform.

This works for the most part, except with PRs coming from forks of omicron outside our organization (which some of our colleagues use). This is because the GitHub API (and the API only, not the web UI) doesn't attach PRs coming from forks to a commit (example check run):

$ gh api repos/oxidecomputer/omicron/check-runs/49281946346 | jq '.head_sha, .pull_requests'
"29f079bdce96a0c4ba328c7e5155c7cd2123bee9"
[]
$ gh api repos/oxidecomputer/omicron/commits/29f079bdce96a0c4ba328c7e5155c7cd2123bee9/pulls
[]

GitHub does return the information if I look directly in the fork, but there is also no way to reliably know which fork the commit comes from:

$ gh api repos/karencfv/omicron/commits/cd38f25aafc93560877f7ec4aa8f21ec81488bd6/pulls | jq '.[].number'
8846

On the other hand, Buildomat does receive the PR number attached to a workflow run in the pull_request event. Exposing the PR number in a machine-readable information would make the script more reliable. A possible implementation would be to add a gong.pr.number tag when the pull_request event is received, and returning a JSON representation of a subset of the details page when Accept is not text/html:

$ curl https://buildomat.eng.oxide.computer/wg/0/details/01K5DJN34XQB9MKG2DPV4X4MAS/GolsAfx7CS23Y9l5J9miocea0lK1p0dQdYoQii1LPXrdxXSR/01K5DJNDHFNE5HV56PE56FBJS0
{
    "tags": {
        "gong.run.id": 12345,
        "gong.pr.number": 234,
        # ...
    },
    "artefacts": [
        {
            "name": "path/to/junit.xml",
            "downlaod": "https://..."
        }
    ]
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at handling of GitHub pull_request events and the /wg/.../details endpoint; inspect how gong tags and content negotiation are currently handled. Add the PR number to the machine-readable metadata and expose the documented JSON subset, then verify fork-origin PR runs and artefact URLs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.