Skip to content

Create a proper build step details page#1685

Open
Ericson2314 wants to merge 5 commits intoNixOS:masterfrom
obsidiansystems:webapp-more-step
Open

Create a proper build step details page#1685
Ericson2314 wants to merge 5 commits intoNixOS:masterfrom
obsidiansystems:webapp-more-step

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

Please review the commits in order, and see each commit message for details.

Compute URLs and title strings upfront instead of repeating inline
ternaries throughout the template. Use consistent `${...}` variable
interpolation style.

No behavior changes.
Soon, we're going to make a new build step page which will share a
number of things with the build page.

In order to get ready for that, extract the following into a new
`build-common.tt` for reuse:

- `renderOutputs`
- `renderStepStatus`
- `renderStepDuration`
- `renderStepMachine`
- `renderLogButtons`

Likewise, move the `showLog` helper out of `Build.pm` into
`Hydra::Helper::LogEndpoints`. Both are needed by the BuildStep
controller introduced in a later commit.

As a bonus, the new `renderLogButtons` is already used twice within
`build.tt` itself (for the build log and the runcommand log),
deduplicating previously identical button markup.

No behavior changes.
Add a `renderOutputsTable` block in `build-common.tt` that renders
outputs as a nested info-table with name and path columns. Use it on
the build detail page, replacing the old inline `renderOutputs` which
only showed paths.

I like this much better because I want to see the output names at a
glance, not just the store paths. This layout is especially good for CA
derivations where we don't know the output paths in advanced of building
them.
Build steps are, in my view, an important concept that Hydra doesn't
yet give enough attention. This is my attempt to rectify that.

A new detail page at `/build/:id/step/:stepnr` shows output paths,
derivation, system, machine, duration, status, and log links, reusing
the shared blocks extracted in the previous commit. Clicking anywhere in
the build steps table row now navigates to this page, instead of the
step log page. The step log pages also have a link back to this page.

Also reflecting giving build steps more status, introduce
`Hydra::Controller::BuildStep`, chained off `/build/buildChain`, giving
them a first-class controller.

For a bit of back story, note that in the future, we might switch
associating build steps more with derivations than builds. This
reflects that we don't really care *why* something was scheduled (the
build/root derivation) as much as *what* was scheduled, especially when
multiple new builds would "race" to schedule the same derivation. It
also bodes well for a future where Hydra can act as a Nix derivation
that receives ad-hoc build requests, so the "build" in this case would
be rather lacking in metadata. Both these scenarios point to a world
where `BuildStep`s become more important than `Build`s, building (ahem)
atop this refactor.

The step log handling is now better suited to live as part of this
controller. Accordingly, it is moved from
`/build/:id/nixlog/:stepnr[/raw|/tail]` to
`/build/:id/step/:stepnr/log[/raw|/tail]`. The old `nixlog` URLs are
preserved as 301 redirects in `Build.pm`. All templates updated to
generate the new canonical URLs.
@Ericson2314
Copy link
Copy Markdown
Member Author

@mweinelt While the last commit adds a redirect from nixlog so users get no breaking change, I suspect a deployment config change might be needed to change a nixlog/n/raw -> S3 redirect to a step/n/log/raw S3 redirect?

In other words, while there isn't a user-facing breaking change, I think there is a sysadmin-facing breaking change.

@mweinelt
Copy link
Copy Markdown
Member

I don't believe we currently do any redirects to S3 ourselves.

https://github.com/NixOS/infra/blob/main/build/hydra-proxy.nix#L68-L102

@Ericson2314
Copy link
Copy Markdown
Member Author

OK Thanks @mweinelt. I guess, we will see!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants