@@ -33,12 +33,11 @@ type Source struct {
3333
3434// New creates a new version source
3535func New (cluster string ) * Source {
36- // Build the deployment pattern: "the current recomended deployment for <cluster> is:"
37- // Note: The documentation has a typo - it says "recomended" (missing 'm') instead of "recommended"
36+ // Build the deployment pattern: "the current recommended deployment for <cluster> is:"
3837 // Convert cluster name to lowercase for case-insensitive matching
3938 clusterLower := strings .ToLower (cluster )
4039 // Compile the pattern once at creation time
41- deploymentPattern := regexp .MustCompile (fmt .Sprintf (`the current recomended deployment for %s is:` , clusterLower ))
40+ deploymentPattern := regexp .MustCompile (fmt .Sprintf (`the current recommended deployment for %s is:` , clusterLower ))
4241
4342 return & Source {
4443 cluster : clusterLower ,
@@ -107,6 +106,9 @@ func (s *Source) fetchVersionFromDocs() (string, error) {
107106 }
108107
109108 // Parse HTML to find version strings
109+ // TODO: This is pretty hacky, alternative could be to piece together the latest version for the running os,distro and arch like this:
110+ // curl -s "https://dl.cloudsmith.io/public/malbeclabs/doublezero/deb/ubuntu/dists/jammy/main/binary-amd64/Packages.gz" | gunzip | grep -A 1 "^Package: doublezero$" | grep "^Version:" | sort -V | tail -1 | cut -d' ' -f2
111+ // the problem here is that it doesn't differentiate between mainnet and testnet or whether it is recommended.
110112 versionString , err := s .parseVersionFromHTML (resp .Body )
111113 if err != nil {
112114 return "" , fmt .Errorf ("failed to parse version from docs: %w" , err )
@@ -116,8 +118,7 @@ func (s *Source) fetchVersionFromDocs() (string, error) {
116118}
117119
118120// parseVersionFromHTML parses the HTML to extract the DoubleZero version for the configured cluster
119- // Looks for the text pattern "The current recomended deployment for <cluster> is:" (case-insensitive)
120- // Note: The documentation has a typo - it says "recomended" (missing 'm') instead of "recommended"
121+ // Looks for the text pattern "The current recommended deployment for <cluster> is:" (case-insensitive)
121122// Once found, extracts the version from the Debian/Ubuntu code block that follows it
122123// RHEL users should use {{ .VersionTo }} template variable, Debian users should use {{ .PackageVersionTo }}
123124func (s * Source ) parseVersionFromHTML (body io.Reader ) (string , error ) {
0 commit comments