Skip to content

Commit 2ef700e

Browse files
committed
fix(ui): link CLI download to GitHub releases for all platforms (#27805)
The Help page only offered the server's Linux binary served from the pod, which is the wrong architecture for macOS/Windows/arm clients and surprises users with a large (~200MB) download. Add an "All platforms" link to the GitHub releases page for the running server version so users can choose the right binary; released versions deep-link to their tag and dev builds fall back to the releases list. Signed-off-by: KKamJi <xowl5460@naver.com>
1 parent dd4f826 commit 2ef700e

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {cliDownloadURL, RELEASES_URL} from './help';
2+
3+
test('links released versions to their GitHub release tag', () => {
4+
expect(cliDownloadURL('v3.4.1')).toBe(`${RELEASES_URL}/tag/v3.4.1`);
5+
expect(cliDownloadURL('v3.4.0-rc1')).toBe(`${RELEASES_URL}/tag/v3.4.0-rc1`);
6+
});
7+
8+
test('falls back to the releases list for dev builds and unknown versions', () => {
9+
// dev builds carry semver build metadata
10+
expect(cliDownloadURL('v3.5.0+0dc5b3f')).toBe(RELEASES_URL);
11+
// empty/unavailable version
12+
expect(cliDownloadURL('')).toBe(RELEASES_URL);
13+
expect(cliDownloadURL(undefined as unknown as string)).toBe(RELEASES_URL);
14+
// anything that is not a recognizable version
15+
expect(cliDownloadURL('latest')).toBe(RELEASES_URL);
16+
});

ui/src/app/help/components/help.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ import classNames from 'classnames';
77

88
require('./help.scss');
99

10+
export const RELEASES_URL = 'https://github.com/argoproj/argo-cd/releases';
11+
12+
// Build a link to the GitHub release matching the running server version, so users can grab a
13+
// binary for their own OS/arch instead of only the server-arch Linux binary served from the pod.
14+
// Released versions ("v3.4.1", "v3.4.0-rc1") link to their tag; dev builds carry semver build
15+
// metadata ("v3.5.0+0dc5b3f") and unknown versions fall back to the releases list.
16+
export const cliDownloadURL = (version: string): string => {
17+
const tag = (version || '').trim();
18+
return /^v\d+\.\d+\.\d+(-[0-9A-Za-z.]+)?$/.test(tag) ? `${RELEASES_URL}/tag/${tag}` : RELEASES_URL;
19+
};
20+
1021
export const Help = () => {
1122
return (
1223
<DataLoader
@@ -23,12 +34,14 @@ export const Help = () => {
2334
return {
2435
binaryUrls: settings.help.binaryUrls || {},
2536
// Platform is "<os>/<arch>" (e.g. "linux/amd64"); may be empty.
26-
hostArch: (version.Platform || '').split('/')[1] || ''
37+
hostArch: (version.Platform || '').split('/')[1] || '',
38+
downloadURL: cliDownloadURL(version.Version)
2739
};
2840
}}>
29-
{(settings?: {binaryUrls: Record<string, string>; hostArch: string}) => {
41+
{(settings?: {binaryUrls: Record<string, string>; hostArch: string; downloadURL: string}) => {
3042
const binaryUrls = settings?.binaryUrls || {};
3143
const hostArch = settings?.hostArch || '';
44+
const downloadURL = settings?.downloadURL || RELEASES_URL;
3245
return (
3346
<Consumer>
3447
{() => (
@@ -45,6 +58,13 @@ export const Help = () => {
4558
<div className='columns large-4 small-6'>
4659
<div className='help-box'>
4760
<p>Want to download the CLI tool?</p>
61+
{/* Primary option: the GitHub releases page for the running version, where users can
62+
pick a binary for their own OS/architecture. The in-cluster link below only serves the
63+
server's Linux binary, which is wrong for macOS/Windows/arm clients. */}
64+
<a href={downloadURL} target='_blank' rel='noopener noreferrer' className='user-info-panel-buttons argo-button argo-button--base'>
65+
<i className='fab fa-github' /> All platforms
66+
</a>
67+
&nbsp;
4868
{/* Arch-agnostic link: targets the suffix-less /argocd-linux route, which every
4969
server serves from its own embedded binary regardless of the server's architecture.
5070
This keeps the UI bundle architecture-independent (no arch baked in) and avoids

0 commit comments

Comments
 (0)