diff --git a/CHANGELOG.md b/CHANGELOG.md index efd704fb..ac813ee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.15.2](https://github.com/release-argus/Argus/compare/0.15.1...0.15.2) (2024-01-17) + + +### Bug Fixes + +* **latest_version:** double check new releases ([5610a28](https://github.com/release-argus/Argus/commits/5610a28d6982f3033e041903a3ded75585ac4e74)) + ### [0.15.1](https://github.com/release-argus/Argus/compare/0.15.0...0.15.1) (2024-01-13) diff --git a/package-lock.json b/package-lock.json index ef13e850..746e74bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "commit-check", - "version": "0.15.1", + "version": "0.15.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "commit-check", - "version": "0.15.1", + "version": "0.15.2", "license": "ISC", "dependencies": { "@commitlint/cli": "^18.4.4", diff --git a/package.json b/package.json index cfa99ea0..090bcc23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "commit-check", - "version": "0.15.1", + "version": "0.15.2", "description": "", "main": "index.js", "scripts": { diff --git a/service/latest_version/query.go b/service/latest_version/query.go index 4e39db0a..fb441c31 100644 --- a/service/latest_version/query.go +++ b/service/latest_version/query.go @@ -21,6 +21,7 @@ import ( "io" "net/http" "strings" + "time" "github.com/Masterminds/semver/v3" github_types "github.com/release-argus/Argus/service/latest_version/api_type" @@ -31,7 +32,9 @@ import ( // Query queries the Service source, updating Service.LatestVersion // and returning true if it has changed (is a new release), // otherwise returns false. -func (l *Lookup) query(logFrom *util.LogFrom) (bool, error) { +// +// checkNumber - 0 for first check, 1 for second check (if the first check found a new version) +func (l *Lookup) query(logFrom *util.LogFrom, checkNumber int) (bool, error) { rawBody, err := l.httpRequest(logFrom) if err != nil { return false, err @@ -48,8 +51,16 @@ func (l *Lookup) query(logFrom *util.LogFrom) (bool, error) { // If this version is different (new?). latestVersion := l.Status.LatestVersion() if version != latestVersion { + // Verify that the version has changed. (GitHub may have just omitted the tag for some reason) + if checkNumber == 0 { + msg := fmt.Sprintf("Possibly found a new version (From %q to %q). Checking again", latestVersion, version) + jLog.Verbose(msg, *logFrom, latestVersion != "") + time.Sleep(time.Second) + return l.query(logFrom, 1) + } + if wantSemanticVersioning { - // Check it's a valid semnatic version + // Check it's a valid semantic version newVersion, err := semver.NewVersion(version) if err != nil { err = fmt.Errorf("failed converting %q to a semantic version. If all versions are in this style, consider adding url_commands to get the version into the style of 'MAJOR.MINOR.PATCH' (https://semver.org/), or disabling semantic versioning (globally with defaults.service.semantic_versioning or just for this service with the semantic_versioning var)", @@ -103,6 +114,8 @@ func (l *Lookup) query(logFrom *util.LogFrom) (bool, error) { return true, nil } + msg := fmt.Sprintf("Staying on %q as that's the latest version in the second check", version) + jLog.Verbose(msg, *logFrom, checkNumber == 1) // Announce `LastQueried` l.Status.AnnounceQuery() // No version change. @@ -114,7 +127,7 @@ func (l *Lookup) query(logFrom *util.LogFrom) (bool, error) { // // metrics - if true, set Prometheus metrics based on the query func (l *Lookup) Query(metrics bool, logFrom *util.LogFrom) (newVersion bool, err error) { - newVersion, err = l.query(logFrom) + newVersion, err = l.query(logFrom, 0) if metrics { l.queryMetrics(err) @@ -228,7 +241,8 @@ func (l *Lookup) httpRequest(logFrom *util.LogFrom) (rawBody []byte, err error) } // Has tags/releases } else { - jLog.Verbose("Potentially found new releases (new ETag)", *logFrom, true) + msg := fmt.Sprintf("Potentially found new releases (new ETag %s)", newETag) + jLog.Verbose(msg, *logFrom, true) } // 304 - Resource has not changed diff --git a/service/latest_version/query_test.go b/service/latest_version/query_test.go index fd041db5..832d3821 100644 --- a/service/latest_version/query_test.go +++ b/service/latest_version/query_test.go @@ -359,12 +359,12 @@ func TestLookup_QueryGitHubETag(t *testing.T) { "three requests only uses 1 api limit": { attempts: 3, eTagChanged: 1, - eTagUnchangedUseCache: 2, + eTagUnchangedUseCache: 3, // 2 attempts + 1 recheck errRegex: `^$`}, "if initial request fails filter, cached results will be used": { attempts: 3, eTagChanged: 1, - eTagUnchangedUseCache: 2, + eTagUnchangedUseCache: 3, // 2 attempts + 1 recheck initialRequireRegexVersion: `^FOO$`, errRegex: `regex not matched on version`}, "invalid url_commands will catch no versions": { diff --git a/service/track_test.go b/service/track_test.go index 6a23cbdf..d434d26b 100644 --- a/service/track_test.go +++ b/service/track_test.go @@ -76,7 +76,7 @@ func TestSlice_Track(t *testing.T) { slice.Track(&tc.ordering, &sync.RWMutex{}) // THEN the function exits straight away - time.Sleep(time.Second) + time.Sleep(2 * time.Second) for i := range *slice { if !util.Contains(tc.ordering, i) { if (*slice)[i].Status.LatestVersion() != "" { diff --git a/web/ui/package-lock.json b/web/ui/package-lock.json index 6647ac23..c71e0dac 100644 --- a/web/ui/package-lock.json +++ b/web/ui/package-lock.json @@ -5233,9 +5233,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001576", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", - "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", + "version": "1.0.30001578", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", + "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==", "funding": [ { "type": "opencollective", @@ -15589,7 +15589,7 @@ }, "react-app": { "name": "argus", - "version": "0.15.1", + "version": "0.15.2", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.5.1", "@fortawesome/free-brands-svg-icons": "^6.5.1", diff --git a/web/ui/react-app/package.json b/web/ui/react-app/package.json index 0d581664..78100f10 100644 --- a/web/ui/react-app/package.json +++ b/web/ui/react-app/package.json @@ -1,6 +1,6 @@ { "name": "argus", - "version": "0.15.1", + "version": "0.15.2", "description": "Automated checks for new software releases", "homepage": "https://release-argus.io", "private": true,