Skip to content

Conversation

@DaanHoogland
Copy link
Contributor

Description

This PR...

Fixes: #10522

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Mar 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.00%. Comparing base (b8359e8) to head (8aae38e).
⚠️ Report is 334 commits behind head on 4.20.

Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #10533   +/-   ##
=========================================
  Coverage     16.00%   16.00%           
+ Complexity    13104    13103    -1     
=========================================
  Files          5651     5651           
  Lines        495841   495842    +1     
  Branches      60044    60044           
=========================================
+ Hits          79365    79368    +3     
  Misses       407613   407613           
+ Partials       8863     8861    -2     
Flag Coverage Δ
uitests 4.00% <ø> (-0.01%) ⬇️
unittests 16.84% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DaanHoogland DaanHoogland requested a review from vishesh92 March 10, 2025 09:31
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@apache apache deleted a comment from blueorangutan Mar 10, 2025
@DaanHoogland
Copy link
Contributor Author

@blueorangutan ui

@blueorangutan
Copy link

@DaanHoogland a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/10533 (QA-JID-575)

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 12718

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12719

@Pearl1594 Pearl1594 requested a review from vishesh92 March 14, 2025 16:05
@rohityadavcloud rohityadavcloud added this to the 4.20.1 milestone Mar 18, 2025
SetCsLatestVersion ({ commit }, rolename) {
if (!vueProps.$config.notifyLatestCSVersion) {
return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of Github, we should query one of the ASF or repo links to find latest release? For example - https://dlcdn.apache.org/cloudstack/releases/ - we may even introduce to put like a file that gives latest version info say from https://download.cloudstack.org/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohityadavcloud , I am not sure this would be easily cleanly implemented.

https://api.github.com/repos/apache/cloudstack/releases give a cleanish yaml with results.

In contrast https://dlcdn.apache.org/cloudstack/releases/ gives a directory listing.
https://download.cloudstack.org/ also gives a directory listing which is really messy.

I would prefer to continue as is but make the retrieval of new version optional, advising operators to set it on test environments and to disable it in production.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just put a file on cloudstack.apache.org, for example

https://cloudstack.apache.org/latest_cloudstack_version ?

We do not need to get the new version very soon after the release, 1-7 days delay is good I think.

@Pearl1594 Pearl1594 modified the milestones: 4.20.1, 4.20.2 Jun 3, 2025
@weizhouapache weizhouapache modified the milestones: 4.20.2, 4.20.3 Sep 10, 2025
Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the idea of making the version check configurable.
One issue I see with our current approach of storing fetched version in store is that if the admin logs in 50 times in an Incognito window it will query for version 50 times.

Maybe we can also improve the overall readability of SetCsLatestVersion

diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js
index 6113f3ed94..5b724d1664 100644
--- a/ui/src/store/modules/user.js
+++ b/ui/src/store/modules/user.js
@@ -556,27 +556,32 @@ const user = {
       commit('SET_DOMAIN_STORE', domainStore)
     },
     SetCsLatestVersion ({ commit }, rolename) {
-      const lastFetchTs = store.getters.latestVersion?.fetchedTs ? store.getters.latestVersion.fetchedTs : 0
-      if (rolename === 'Root Admin' && (+new Date() - lastFetchTs) > 24 * 60 * 60 * 1000) {
-        axios.get(
-          'https://api.github.com/repos/apache/cloudstack/releases'
-        ).then(response => {
-          let latestReleaseVersion = getParsedVersion(response[0].tag_name)
-          let latestTag = response[0].tag_name
-
-          for (const release of response) {
-            if (release.tag_name.toLowerCase().includes('rc')) {
-              continue
-            }
-            const parsedVersion = getParsedVersion(release.tag_name)
-            if (semver.gte(parsedVersion, latestReleaseVersion)) {
-              latestReleaseVersion = parsedVersion
-              latestTag = release.tag_name
-              commit('SET_LATEST_VERSION', { version: latestTag, fetchedTs: (+new Date()) })
-            }
-          }
-        }).catch(ignored => {})
+      if (!vueProps.$config.notifyLatestCSVersion) {
+        return
       }
+      const lastFetchTs = store.getters.latestVersion?.fetchedTs || 0
+      if (rolename !== 'Root Admin' || (+new Date() - lastFetchTs) <= 24 * 60 * 60 * 1000) {
+        return
+      }
+      let lastFetchedVersion = store.getters.latestVersion?.version || '0.0.0'
+      const parsedLastFetchedVersion = getParsedVersion(lastFetchedVersion)
+      axios.get(
+        'https://api.github.com/repos/apache/cloudstack/releases'
+      ).then(response => {
+        for (const release of response) {
+          if (release.tag_name.toLowerCase().includes('rc') || release.draft || release.prerelease) {
+            continue
+          }
+          const parsedVersion = getParsedVersion(release.tag_name)
+          if (semver.gte(getParsedVersion(release.tag_name), parsedLastFetchedVersion)) {
+            lastFetchedVersion = release.tag_name
+            break
+          }
+        }
+      }).catch(ignored => {
+      }).finally(() => {
+        commit('SET_LATEST_VERSION', { version: lastFetchedVersion, fetchedTs: (+new Date()) })
+      })
     },
     SetDarkMode ({ commit }, darkMode) {
       commit('SET_DARK_MODE', darkMode)

const result = response.listusersresponse.user[0]
commit('SET_INFO', result)
commit('SET_NAME', result.firstname + ' ' + result.lastname)
store.dispatch('SetCsLatestVersion', result.rolename)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the issue where it is making 2 API calls.

@NuxRo
Copy link
Contributor

NuxRo commented Oct 3, 2025

Good feature, but anything that makes CloudStack rely on external resources should be disable-able.

Some/Many corporate environments are run in closed down intranets where this is causing UI errors and generating reports from users. I know of at least 2 such situations.

@vishesh92
Copy link
Member

Tested this PR. This works as expected. When notifyLatestCSVersion is set to false, no requests are made to github.

@DaanHoogland DaanHoogland marked this pull request as ready for review October 3, 2025 17:52
@weizhouapache
Copy link
Member

Tested this PR. This works as expected. When notifyLatestCSVersion is set to false, no requests are made to github.

thanks @vishesh92
if notifyLatestCSVersion is set to true, how many requests are sent to github ?

@vishesh92
Copy link
Member

Tested this PR. This works as expected. When notifyLatestCSVersion is set to false, no requests are made to github.

thanks @vishesh92 if notifyLatestCSVersion is set to true, how many requests are sent to github ?

In case of failures, it was sent twice earlier. Now it's sent only once.

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

thanks @vishesh92
can you approve it ?

@weizhouapache weizhouapache merged commit 270d3f9 into apache:4.20 Oct 8, 2025
26 checks passed
@weizhouapache weizhouapache modified the milestones: 4.20.3, 4.20.2 Oct 8, 2025
@DaanHoogland DaanHoogland deleted the ghi10522-crosssiteAPIcall branch October 8, 2025 11:32
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Oct 17, 2025
sandeeplocharla pushed a commit to NetApp/cloudstack that referenced this pull request Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two API requests done towards api.github.com anytime someone visits ACS UI

8 participants