Correct use of apt proxy

When creating an apt proxy, we are asked for the “distribution”. So I went ahead and created two apt proxies for bionic and focal called bionic and focal.

I then configured the apt repos on my hosts like so:

deb http://my.nexus.com/repository/<distro> <distro> main restricted universe multiverse

which works perfectly well.

However, we discovered that when upgrading a bionic host to focal using do-release-upgrade, the process switches the second instance of <distro> to the new distro name. So

deb http://my.nexus.com/repository/bionic bionic main restricted universe multiverse

became

deb http://my.nexus.com/repository/bionic focal main restricted universe multiverse

and to my amusement, the bionic repository began happily proxying and caching packages from the focal distro!

image

Which brings me to my question: if an apt proxy is agnostic of distribution, why bother with the distribution at all?

I tested this by creating a new apt proxy, called ubuntu, and for the distribution I put in ubuntu. This seems to work completely fine, reduces configuration complexity, and avoids the do-release-upgrade issue described above, as my apt sources now look like:

deb http://my.nexus.com/repository/ubuntu <distro> main restricted universe multiverse

Is there a gotcha I’m missing here? I’m aware of this issue to support multiple distributions in the same repository, but it seems to me that we already have this support?