Skip to content
ocx
install

Your registry is already a package backend

How the container registry you already run can carry a command-line tool, one build per platform behind one tag, and why a missing platform becomes one push instead of an edit to every install script.

Duration

Transcript

Your team writes a tool everyone needs, a command line program.

Where should it live so every laptop and CI runner gets it?

It can sit on the registry you already run for your images, behind its login.

This is the OCX Podcast, for engineers who install tools on laptops and in pipelines.

I'm Vera.

And I'm Max.

This episode assumes you know what a container registry is, and that one image name can carry a build for each platform.

Swap the image for a plain tool.

How does each machine get a build it can run?

It's Friday afternoon.

A developer on a Mac starts a Linux container to try the build.

That build needs the team's command line tool, so the container runs the install script everyone copies around.

I can guess what's in that script.

A case statement, which operating system, which chip, and for each pair, a file name on the tool's release page.

This Mac has an ARM chip, so the container is Linux on ARM.

The page lists Linux on Intel, a Mac build, and a Windows zip.

The script finds no line for it and stops.

What gets me is the container itself.

It came out of a registry under one name, and that name had a build for this chip.

Two things were headed for that laptop, and only the one that needed a table didn't make it.

The registry that served that container can hold the tool the same way.

One tag, a build for each platform behind it.

That doesn't make the table go away though.

Somebody still decides which builds exist, same as on a release page.

The publisher does.

On Friday, nobody had published Linux on ARM, so a tag alone wouldn't have saved that afternoon.

What it changes is where the fix goes, and how many copies it has to reach.

Ask a tag what it holds, and you don't get a file back.

Take the search tool ripgrep.

One of its tags lists six builds.

How does each of those builds say what it's for?

On the release page, the script only had file names to go on.

They're labeled by platform, Linux, Mac, and Windows, each on Intel and on ARM.

And the Linux on ARM entry says a bit more than the rest.

It names its C library, glibc.

That's the libc tax, written right into the list.

How a machine matches on it is a later episode.

What matters for Friday is who writes a list like this.

Whoever publishes the tool does it once in the registry.

It's the case statements table after all, kept in one place instead of copied into every install script.

A list doesn't install anything by itself.

Something on your machine has to read it.

OCX is a package manager, and that's its job.

It reads the list there and installs the build that fits.

The question the case statement asked, which operating system and which chip, moves into the package manager, and it already knows the answer because it's running on that machine.

Only the chosen build comes down, plus the package's description.

One file, whichever platform you're on.

The builds it doesn't pick never even get requested.

And none of that choosing happens on the registry. It doesn't have to know it's holding a tool at all.

Inside the registry, a package is made of the same pieces as an image.

Each entry in that list looks like an image built for a single platform.

An image keeps its files apart from its settings.

What goes where for a tool?

There's a compressed archive of the tool where the files would go, and the package's description where the settings would go.

One label is OCX's own.

It marks the whole thing as a package.

Which makes that list an ordinary image index, the kind that lets one image name carry a build per platform.

And that's why your tools can sit right beside the container images you keep in that registry.

Say the tool is your team's own, and the registry is a stock open source one.

Nothing from OCX is installed on the server.

The publisher builds an archive for Linux on Intel, along with the package's description, and pushes both to a tag.

Right now, the list behind that tag has a single entry.

Linux on ARM would be a second archive, built for that chip and pushed to the same tag.

And the Intel build stays where it is.

That push merges into the list instead of replacing it.

So the tag now holds both builds.

From then on, a fresh Linux machine on either chip installs the tool by its full name, straight from the registry.

Put a password on that registry, and OCX gets turned away like any other client, on a push and on an install.

With credentials, both go through.

That's the login on the registry that served Friday's container.

You already have the infrastructure, and nobody sets up a second login for one tool.

For a private tool, Homebrew wants a tap with formulas.

Here, the registry's own rules decide who gets in, and OCX adds none.

Suppose the publisher only ever pushed Linux on Intel.

A container on an ARM Mac asks the same tag and gets a plain not found.

You'd get the same message for a tag that doesn't exist.

It doesn't name the platform that's missing either.

In a build log, that reads exactly like a typo in the tag.

How would anyone tell those two apart?

They ask the tag what it holds.

If the list comes back with Linux on Intel and nothing else, the name was fine.

The ARM build was never published.

Or they look at which machines failed.

A typo breaks the Linux laptops and runners on Intel too, while a missing ARM build leaves those working.

Friday's ARM Mac and its Linux container.

Only now, the tool is a tag in the team's registry, and that tag has no Linux on ARM yet.

For the developer on that laptop, the install inside the container stops at the missing entry.

Until someone builds the tool for Linux on ARM and pushes it to the same tag.

It merges into the list, and the next fresh container on that Mac finds its entry.

Without anyone editing an install script.

With the release page, every repository's copy of that case statement would have needed a new line.

Here, the table lives only in the tag.

So the real decision is which platforms to publish.

If anyone runs Linux containers on an ARM Mac, Linux on ARM is one of them.

The machines that read a list today already had the package manager on them.

A new laptop doesn't.

Getting it there and running a first tool is episode two, From Nothing To A Version On Screen.

Everything's at ocx.sh.

Same tool chain on every laptop.

And in CI.

See you next episode.