WEBVTT

00:00:00.500 --> 00:00:04.000
Your team writes a tool everyone
needs, a command line program.

00:00:04.600 --> 00:00:07.760
Where should it live so every laptop
and CI runner gets it?

00:00:08.240 --> 00:00:12.780
It can sit on the registry you already
run for your images, behind its login.

00:00:13.600 --> 00:00:15.780
This is the OCX Podcast,

00:00:16.059 --> 00:00:20.260
for engineers who install tools
on laptops and in pipelines.

00:00:20.780 --> 00:00:21.613
I'm Vera.

00:00:21.660 --> 00:00:22.493
And I'm Max.

00:00:23.080 --> 00:00:26.120
This episode assumes you know
what a container registry is,

00:00:26.560 --> 00:00:30.140
and that one image name can carry
a build for each platform.

00:00:30.620 --> 00:00:32.780
Swap the image for a plain tool.

00:00:33.380 --> 00:00:35.820
How does each machine get
a build it can run?

00:00:36.180 --> 00:00:37.360
It's Friday afternoon.

00:00:37.880 --> 00:00:41.180
A developer on a Mac starts
a Linux container to try the build.

00:00:41.820 --> 00:00:45.560
That build needs the team's command
line tool, so the container runs

00:00:45.600 --> 00:00:47.920
the install script everyone copies around.

00:00:48.540 --> 00:00:50.560
I can guess what's in that script.

00:00:51.220 --> 00:00:52.180
A case statement,

00:00:52.780 --> 00:00:56.420
which operating system,
which chip, and for each pair,

00:00:56.700 --> 00:00:58.980
a file name on the tool's release page.

00:00:59.520 --> 00:01:03.540
This Mac has an ARM chip,
so the container is Linux on ARM.

00:01:04.180 --> 00:01:08.560
The page lists Linux on Intel,
a Mac build, and a Windows zip.

00:01:09.180 --> 00:01:11.860
The script finds no line for it and stops.

00:01:12.300 --> 00:01:14.880
What gets me is the container itself.

00:01:15.480 --> 00:01:17.960
It came out of a registry under one name,

00:01:18.440 --> 00:01:20.960
and that name had a build for this chip.

00:01:21.740 --> 00:01:23.820
Two things were headed for that laptop,

00:01:24.220 --> 00:01:27.260
and only the one that needed
a table didn't make it.

00:01:27.640 --> 00:01:31.800
The registry that served that container
can hold the tool the same way.

00:01:32.440 --> 00:01:35.660
One tag, a build
for each platform behind it.

00:01:36.160 --> 00:01:38.311
That doesn't make
the table go away though.

00:01:38.680 --> 00:01:42.500
Somebody still decides which builds
exist, same as on a release page.

00:01:42.940 --> 00:01:43.960
The publisher does.

00:01:44.600 --> 00:01:47.820
On Friday, nobody had
published Linux on ARM,

00:01:48.240 --> 00:01:51.340
so a tag alone wouldn't
have saved that afternoon.

00:01:52.140 --> 00:01:54.900
What it changes is where the fix goes,

00:01:55.220 --> 00:01:57.560
and how many copies it has to reach.

00:01:58.020 --> 00:02:01.780
Ask a tag what it holds,
and you don't get a file back.

00:02:02.500 --> 00:02:04.440
Take the search tool ripgrep.

00:02:04.980 --> 00:02:07.580
One of its tags lists six builds.

00:02:08.020 --> 00:02:10.421
How does each of those builds
say what it's for?

00:02:11.000 --> 00:02:14.120
On the release page, the script
only had file names to go on.

00:02:14.500 --> 00:02:18.500
They're labeled by platform,
Linux, Mac, and Windows,

00:02:19.020 --> 00:02:21.220
each on Intel and on ARM.

00:02:21.620 --> 00:02:24.760
And the Linux on ARM entry says
a bit more than the rest.

00:02:25.260 --> 00:02:27.800
It names its C library, glibc.

00:02:28.480 --> 00:02:32.120
That's the libc tax,
written right into the list.

00:02:32.900 --> 00:02:35.940
How a machine matches
on it is a later episode.

00:02:36.560 --> 00:02:40.180
What matters for Friday
is who writes a list like this.

00:02:40.760 --> 00:02:44.680
Whoever publishes the tool
does it once in the registry.

00:02:45.060 --> 00:02:47.111
It's the case statements table after all,

00:02:47.520 --> 00:02:51.100
kept in one place instead of copied
into every install script.

00:02:51.420 --> 00:02:54.240
A list doesn't install anything by itself.

00:02:54.800 --> 00:02:56.980
Something on your machine has to read it.

00:02:57.700 --> 00:03:01.360
OCX is a package manager,
and that's its job.

00:03:01.960 --> 00:03:05.320
It reads the list there
and installs the build that fits.

00:03:05.780 --> 00:03:10.180
The question the case statement asked,
which operating system and which chip,

00:03:10.700 --> 00:03:13.640
moves into the package manager,
and it already knows

00:03:13.680 --> 00:03:16.081
the answer because it's running
on that machine.

00:03:16.420 --> 00:03:20.540
Only the chosen build comes down,
plus the package's description.

00:03:21.120 --> 00:03:23.520
One file, whichever platform you're on.

00:03:24.200 --> 00:03:27.260
The builds it doesn't pick
never even get requested.

00:03:27.640 --> 00:03:31.180
And none of that choosing happens
on the registry. It doesn't have

00:03:31.220 --> 00:03:32.971
to know it's holding a tool at all.

00:03:33.220 --> 00:03:38.080
Inside the registry, a package is made
of the same pieces as an image.

00:03:38.820 --> 00:03:43.400
Each entry in that list looks like
an image built for a single platform.

00:03:43.800 --> 00:03:46.580
An image keeps its files
apart from its settings.

00:03:47.120 --> 00:03:48.600
What goes where for a tool?

00:03:49.060 --> 00:03:52.500
There's a compressed archive
of the tool where the files would go,

00:03:53.020 --> 00:03:55.980
and the package's description
where the settings would go.

00:03:56.820 --> 00:03:59.040
One label is OCX's own.

00:03:59.540 --> 00:04:01.760
It marks the whole thing as a package.

00:04:02.160 --> 00:04:04.840
Which makes that list
an ordinary image index,

00:04:05.260 --> 00:04:08.460
the kind that lets one image
name carry a build per platform.

00:04:08.840 --> 00:04:13.420
And that's why your tools can sit right
beside the container images you keep

00:04:13.460 --> 00:04:14.360
in that registry.

00:04:14.680 --> 00:04:19.339
Say the tool is your team's own, and
the registry is a stock open source one.

00:04:20.060 --> 00:04:22.520
Nothing from OCX
is installed on the server.

00:04:23.020 --> 00:04:26.320
The publisher builds
an archive for Linux on Intel,

00:04:26.720 --> 00:04:30.760
along with the package's description,
and pushes both to a tag.

00:04:31.420 --> 00:04:35.280
Right now, the list behind
that tag has a single entry.

00:04:35.720 --> 00:04:38.160
Linux on ARM would be a second archive,

00:04:38.540 --> 00:04:41.060
built for that chip
and pushed to the same tag.

00:04:41.360 --> 00:04:43.580
And the Intel build stays where it is.

00:04:44.240 --> 00:04:47.700
That push merges into the list
instead of replacing it.

00:04:48.160 --> 00:04:50.380
So the tag now holds both builds.

00:04:50.780 --> 00:04:51.613
From then on,

00:04:51.660 --> 00:04:55.980
a fresh Linux machine on either chip
installs the tool by its full name,

00:04:56.400 --> 00:04:57.751
straight from the registry.

00:04:57.800 --> 00:04:59.620
Put a password on that registry,

00:04:59.920 --> 00:05:03.440
and OCX gets turned away
like any other client,

00:05:03.900 --> 00:05:06.060
on a push and on an install.

00:05:06.700 --> 00:05:08.720
With credentials, both go through.

00:05:09.240 --> 00:05:10.073
That's the login

00:05:10.080 --> 00:05:12.431
on the registry that served
Friday's container.

00:05:13.040 --> 00:05:14.841
You already have the infrastructure,

00:05:15.080 --> 00:05:17.800
and nobody sets up
a second login for one tool.

00:05:18.340 --> 00:05:22.000
For a private tool, Homebrew
wants a tap with formulas.

00:05:22.680 --> 00:05:26.160
Here, the registry's
own rules decide who gets in,

00:05:26.580 --> 00:05:28.600
and OCX adds none.

00:05:28.900 --> 00:05:32.360
Suppose the publisher
only ever pushed Linux on Intel.

00:05:32.900 --> 00:05:37.700
A container on an ARM Mac asks
the same tag and gets a plain not found.

00:05:38.140 --> 00:05:41.400
You'd get the same message
for a tag that doesn't exist.

00:05:41.960 --> 00:05:44.520
It doesn't name the platform
that's missing either.

00:05:44.940 --> 00:05:48.560
In a build log, that reads
exactly like a typo in the tag.

00:05:49.140 --> 00:05:50.220
How would anyone tell

00:05:50.240 --> 00:05:51.073
those two apart?

00:05:51.400 --> 00:05:53.560
They ask the tag what it holds.

00:05:54.160 --> 00:05:59.120
If the list comes back with Linux on Intel
and nothing else, the name was fine.

00:05:59.720 --> 00:06:01.900
The ARM build was never published.

00:06:02.280 --> 00:06:04.440
Or they look at which machines failed.

00:06:04.980 --> 00:06:08.500
A typo breaks the Linux laptops
and runners on Intel too,

00:06:09.040 --> 00:06:11.480
while a missing ARM build
leaves those working.

00:06:11.880 --> 00:06:14.420
Friday's ARM Mac and its Linux container.

00:06:15.040 --> 00:06:18.840
Only now, the tool is a tag
in the team's registry,

00:06:19.380 --> 00:06:22.420
and that tag has no Linux on ARM yet.

00:06:22.900 --> 00:06:24.640
For the developer on that laptop,

00:06:25.020 --> 00:06:28.360
the install inside the container
stops at the missing entry.

00:06:28.760 --> 00:06:33.980
Until someone builds the tool for Linux
on ARM and pushes it to the same tag.

00:06:34.640 --> 00:06:36.080
It merges into the list,

00:06:36.280 --> 00:06:39.820
and the next fresh container
on that Mac finds its entry.

00:06:40.200 --> 00:06:42.500
Without anyone editing an install script.

00:06:43.200 --> 00:06:44.301
With the release page,

00:06:44.620 --> 00:06:48.700
every repository's copy of that case
statement would have needed a new line.

00:06:49.060 --> 00:06:51.900
Here, the table lives only in the tag.

00:06:52.580 --> 00:06:56.120
So the real decision
is which platforms to publish.

00:06:56.920 --> 00:06:59.900
If anyone runs Linux
containers on an ARM Mac,

00:07:00.400 --> 00:07:02.200
Linux on ARM is one of them.

00:07:02.480 --> 00:07:06.560
The machines that read a list today
already had the package manager on them.

00:07:07.080 --> 00:07:08.480
A new laptop doesn't.

00:07:09.140 --> 00:07:12.560
Getting it there and running
a first tool is episode two,

00:07:13.000 --> 00:07:15.300
From Nothing To A Version On Screen.

00:07:15.960 --> 00:07:18.300
Everything's at ocx.sh.

00:07:19.300 --> 00:07:21.760
Same tool chain on every laptop.

00:07:22.180 --> 00:07:23.360
And in CI.

00:07:24.040 --> 00:07:25.120
See you next episode.

