Correct use of apt proxy - Sonatype Nexus Repository / Best Practices - Sonatype Community
Correct use of apt proxy
post by andy2 on Sep 22, 2022
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!
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?
post by jtom on Oct 10, 2022
Hello,
I believe NEXUS-23790 APT proxies: "distribution" field is required but should not be - Sonatype JIRA speaks to what you found. From that ticket, it looks like it’s not needed for proxy but presumably needed for hosted in the current implementation. I am not clear if the bug is that it should be needed for proxy or that it shouldn’t show as a (required) field for proxy. But hope that helps.
-Joe
post by ralph on Sep 14, 2023
Hi Joe Tom,
I can’t access the JIRA site. What ist the result of the ticket. Is it possible to configure an agnostic ubuntu repo as Andy did it?
regards
post by mpiggott on Sep 14, 2023
We moved to JIRA cloud and for licensing reasons its not available publicly.
You can file issues at Issues · sonatype/nexus-public · GitHub