From dd2615eeb6ad59d8a27a7873605cca39002188a9 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Thu, 18 Nov 2021 16:57:46 -0500 Subject: [PATCH 01/12] Add BinaryURLs Signed-off-by: Yuan Tang --- assets/swagger.json | 7 + pkg/apiclient/settings/settings.pb.go | 308 ++++++++++++++---- .../application/v1alpha1/openapi_generated.go | 1 + .../v1alpha1/zz_generated.deepcopy.go | 1 + server/settings/settings.go | 1 + server/settings/settings.proto | 2 + util/settings/settings.go | 8 + 7 files changed, 257 insertions(+), 71 deletions(-) diff --git a/assets/swagger.json b/assets/swagger.json index eb31d9b9123d0..daab3b132f26e 100644 --- a/assets/swagger.json +++ b/assets/swagger.json @@ -3570,6 +3570,13 @@ "type": "object", "title": "Help settings", "properties": { + "binaryUrls": { + "type": "object", + "title": "the URLs for downloading argocd binaries", + "additionalProperties": { + "type": "string" + } + }, "chatText": { "type": "string", "title": "the text for getting chat help, defaults to \"Chat now!\"" diff --git a/pkg/apiclient/settings/settings.pb.go b/pkg/apiclient/settings/settings.pb.go index 5b0ce19d2d910..3a13e97a89f2d 100644 --- a/pkg/apiclient/settings/settings.pb.go +++ b/pkg/apiclient/settings/settings.pb.go @@ -334,10 +334,12 @@ type Help struct { // the URL for getting chat help, this will typically be your Slack channel for support ChatUrl string `protobuf:"bytes,1,opt,name=chatUrl,proto3" json:"chatUrl,omitempty"` // the text for getting chat help, defaults to "Chat now!" - ChatText string `protobuf:"bytes,2,opt,name=chatText,proto3" json:"chatText,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ChatText string `protobuf:"bytes,2,opt,name=chatText,proto3" json:"chatText,omitempty"` + // the URLs for downloading argocd binaries + BinaryUrls map[string]string `protobuf:"bytes,3,rep,name=binaryUrls,proto3" json:"binaryUrls,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Help) Reset() { *m = Help{} } @@ -387,6 +389,13 @@ func (m *Help) GetChatText() string { return "" } +func (m *Help) GetBinaryUrls() map[string]string { + if m != nil { + return m.BinaryUrls + } + return nil +} + // Plugin settings type Plugin struct { // the name of the plugin, e.g. "kasane" @@ -631,6 +640,7 @@ func init() { proto.RegisterMapType((map[string]*v1alpha1.ResourceOverride)(nil), "cluster.Settings.ResourceOverridesEntry") proto.RegisterType((*GoogleAnalyticsConfig)(nil), "cluster.GoogleAnalyticsConfig") proto.RegisterType((*Help)(nil), "cluster.Help") + proto.RegisterMapType((map[string]string)(nil), "cluster.Help.BinaryUrlsEntry") proto.RegisterType((*Plugin)(nil), "cluster.Plugin") proto.RegisterType((*DexConfig)(nil), "cluster.DexConfig") proto.RegisterType((*Connector)(nil), "cluster.Connector") @@ -641,73 +651,75 @@ func init() { func init() { proto.RegisterFile("server/settings/settings.proto", fileDescriptor_a480d494da040caa) } var fileDescriptor_a480d494da040caa = []byte{ - // 1041 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x5d, 0x6f, 0x1b, 0x45, - 0x17, 0x96, 0xe3, 0x34, 0xb1, 0x8f, 0x9b, 0x38, 0x99, 0xf6, 0xcd, 0xbb, 0x58, 0x95, 0x63, 0x7c, - 0x51, 0x19, 0x04, 0x6b, 0xe2, 0x0a, 0x81, 0x10, 0x12, 0x60, 0xbb, 0x6a, 0x4d, 0x1d, 0x12, 0xa6, - 0x49, 0x2f, 0x90, 0x50, 0x34, 0xd9, 0x1d, 0x36, 0x83, 0xd7, 0x33, 0xab, 0x99, 0x59, 0x53, 0xf7, - 0x92, 0x3b, 0x6e, 0xb8, 0x81, 0x1f, 0xc5, 0x25, 0x12, 0xf7, 0x11, 0xb2, 0xf8, 0x09, 0xfc, 0x00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x81, 0xd0, 0x9e, 0x7d, - 0xbb, 0xcc, 0x8e, 0xf2, 0x77, 0x43, 0x7f, 0xf0, 0xcb, 0xa2, 0x59, 0xfa, 0x75, 0xd1, 0x2c, 0xfd, - 0xbe, 0x68, 0x96, 0xbe, 0x7a, 0xff, 0xbf, 0xbd, 0x61, 0x92, 0x6f, 0x98, 0x07, 0xb9, 0xdc, 0xb2, - 0x2f, 0x8e, 0x47, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x3b, 0xb2, 0x61, 0x60, 0x09, 0x00, - 0x00, + // 1082 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x8f, 0x1b, 0x35, + 0x14, 0xd7, 0x34, 0xdb, 0xdd, 0xe4, 0xa5, 0xdb, 0xec, 0xba, 0xa5, 0x0c, 0x51, 0xc9, 0x86, 0x1c, + 0xaa, 0x80, 0x60, 0xc2, 0xa6, 0x42, 0x20, 0xa4, 0x0a, 0x48, 0x52, 0xb5, 0xa1, 0x29, 0x5d, 0xdc, + 0x6e, 0x0f, 0x48, 0x68, 0xe5, 0x9d, 0x31, 0xb3, 0x26, 0x13, 0x7b, 0x64, 0x7b, 0x42, 0xd3, 0x23, + 0x37, 0x2e, 0x5c, 0xe0, 0xd3, 0xf0, 0x09, 0x38, 0x22, 0x71, 0x5f, 0xa1, 0x88, 0x8f, 0xc0, 0x07, + 0x40, 0xf6, 0xfc, 0xd9, 0xd9, 0x24, 0xfc, 0x91, 0x7a, 0x7b, 0xfe, 0xfd, 0xde, 0x3f, 0x3f, 0x3f, + 0xfb, 0x19, 0x5a, 0x8a, 0xca, 0x39, 0x95, 0x3d, 0x45, 0xb5, 0x66, 0x3c, 0x54, 0x85, 0xe0, 0xc5, + 0x52, 0x68, 0x81, 0x76, 0xfc, 0x28, 0x51, 0x9a, 0xca, 0xe6, 0xcd, 0x50, 0x84, 0xc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, 0xfd, 0x3a, 0xcd, 0x0f, 0x8b, 0x6f, 0xcb, 0x60, + 0xf8, 0xeb, 0xb2, 0xe5, 0xfc, 0xb6, 0x6c, 0x39, 0x7f, 0x2c, 0x5b, 0xce, 0x57, 0x1f, 0xfc, 0xbf, + 0x2f, 0x54, 0x7a, 0x86, 0x85, 0x93, 0xd3, 0x6d, 0xfb, 0xe1, 0xb9, 0xfb, 0x77, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xfe, 0x6b, 0x22, 0xb7, 0xdf, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1133,6 +1145,25 @@ func (m *Help) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.BinaryUrls) > 0 { + for k := range m.BinaryUrls { + v := m.BinaryUrls[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintSettings(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSettings(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSettings(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } if len(m.ChatText) > 0 { i -= len(m.ChatText) copy(dAtA[i:], m.ChatText) @@ -1516,6 +1547,14 @@ func (m *Help) Size() (n int) { if l > 0 { n += 1 + l + sovSettings(uint64(l)) } + if len(m.BinaryUrls) > 0 { + for k, v := range m.BinaryUrls { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovSettings(uint64(len(k))) + 1 + len(v) + sovSettings(uint64(len(v))) + n += mapEntrySize + 1 + sovSettings(uint64(mapEntrySize)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2652,6 +2691,133 @@ func (m *Help) Unmarshal(dAtA []byte) error { } m.ChatText = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BinaryUrls", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSettings + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSettings + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSettings + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BinaryUrls == nil { + m.BinaryUrls = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSettings + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSettings + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthSettings + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSettings + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSettings + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthSettings + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthSettings + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipSettings(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSettings + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.BinaryUrls[mapkey] = mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSettings(dAtA[iNdEx:]) diff --git a/pkg/apis/application/v1alpha1/openapi_generated.go b/pkg/apis/application/v1alpha1/openapi_generated.go index ae18e9a8aa540..889de2fb47239 100644 --- a/pkg/apis/application/v1alpha1/openapi_generated.go +++ b/pkg/apis/application/v1alpha1/openapi_generated.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by openapi-gen. DO NOT EDIT. diff --git a/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go index baf46e93095ec..0265a10ba37de 100644 --- a/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by deepcopy-gen. DO NOT EDIT. diff --git a/server/settings/settings.go b/server/settings/settings.go index b9a1fda2f5f5c..d2488bda0e3d8 100644 --- a/server/settings/settings.go +++ b/server/settings/settings.go @@ -99,6 +99,7 @@ func (s *Server) Get(ctx context.Context, q *settingspkg.SettingsQuery) (*settin Help: &settingspkg.Help{ ChatUrl: help.ChatURL, ChatText: help.ChatText, + BinaryUrls: help.BinaryURLs, }, Plugins: plugins, UserLoginsDisabled: userLoginsDisabled, diff --git a/server/settings/settings.proto b/server/settings/settings.proto index 06243710eec93..fe5e9443a79cf 100644 --- a/server/settings/settings.proto +++ b/server/settings/settings.proto @@ -50,6 +50,8 @@ message Help { string chatUrl = 1; // the text for getting chat help, defaults to "Chat now!" string chatText = 2; + // the URLs for downloading argocd binaries + map binaryUrls = 3; } // Plugin settings diff --git a/util/settings/settings.go b/util/settings/settings.go index fc53a1644837b..c71ec04e0aa38 100644 --- a/util/settings/settings.go +++ b/util/settings/settings.go @@ -106,6 +106,8 @@ type Help struct { ChatURL string `json:"chatUrl,omitempty"` // the text for getting chat help, defaults to "Chat now!" ChatText string `json:"chatText,omitempty"` + // the URLs for downloading argocd binaries + BinaryURLs map[string]string `json:"binaryUrl,omitempty"` } type OIDCConfig struct { @@ -927,6 +929,12 @@ func (mgr *SettingsManager) GetHelp() (*Help, error) { return &Help{ ChatURL: argoCDCM.Data[helpChatURL], ChatText: chatText, + BinaryURLs: map[string]string{ + "windows-amd64": argoCDCM.Data["help.download.windows-amd64"], + "linux-amd64": argoCDCM.Data["help.download.linux-amd64"], + "darwin-amd64": argoCDCM.Data["help.download.darwin-amd64"], + "darwin-arm64": argoCDCM.Data["help.download.darwin-arm64"], + }, }, nil } From 911f1e7e57ebbe4ac109d448d976e97ef1e5dbaf Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Fri, 19 Nov 2021 16:07:19 -0500 Subject: [PATCH 02/12] Add to UI Signed-off-by: Yuan Tang --- ui/src/app/help/components/help.tsx | 108 +++++++++++++++++++--------- ui/src/app/shared/models.ts | 1 + util/settings/settings.go | 1 + 3 files changed, 75 insertions(+), 35 deletions(-) diff --git a/ui/src/app/help/components/help.tsx b/ui/src/app/help/components/help.tsx index 9fa432550bb72..a30f2d98dba8e 100644 --- a/ui/src/app/help/components/help.tsx +++ b/ui/src/app/help/components/help.tsx @@ -1,40 +1,78 @@ import * as React from 'react'; -import {Page} from '../../shared/components'; +import {DataLoader, Page} from '../../shared/components'; import {Consumer} from '../../shared/context'; +import {combineLatest} from 'rxjs'; +import {services} from '../../shared/services'; +import {map} from 'rxjs/operators'; require('./help.scss'); -export const Help = () => ( - - {ctx => ( - -
-
-
-

New to Argo CD?

- - Read the docs - -
-
-
-
-

Want to download the CLI tool?

- - Linux - -
-
-
-
-

You want to develop against Argo CD's API?

- - Open the API docs - -
-
-
-
- )} -
-); +export const Help = () => { + return ( + + combineLatest([services.authService.settings(), services.viewPreferences.getPreferences()]).pipe( + map(items => { + return { + binaryUrls: items[0].help.binaryUrls + }; + }) + ) + }> + {({binaryUrls}: {binaryUrls: Record}) => { + return ( + + {() => ( + +
+
+
+

New to Argo CD?

+ + Read the docs + +
+
+
+
+

Want to download the CLI tool?

+ + Linux + +   + {binaryUrls['darwin-amd64'] && ( + + MacOS (amd64) + + )} +   + {binaryUrls['darwin-arm64'] && ( + + MacOS (arm64) + + )} +   + {binaryUrls['windows-amd64'] && ( + + Windows + + )} +
+
+
+
+

You want to develop against Argo CD's API?

+ + Open the API docs + +
+
+
+
+ )} +
+ ); + }} +
+ ); +}; diff --git a/ui/src/app/shared/models.ts b/ui/src/app/shared/models.ts index f54e7bede7abe..9b3fef919937b 100644 --- a/ui/src/app/shared/models.ts +++ b/ui/src/app/shared/models.ts @@ -445,6 +445,7 @@ export interface AuthSettings { help: { chatUrl: string; chatText: string; + binaryUrls: Record; }; plugins: Plugin[]; userLoginsDisabled: boolean; diff --git a/util/settings/settings.go b/util/settings/settings.go index c71ec04e0aa38..0e211b1de7a53 100644 --- a/util/settings/settings.go +++ b/util/settings/settings.go @@ -1080,6 +1080,7 @@ func updateSettingsFromConfigMap(settings *ArgoCDSettings, argoCDCM *apiv1.Confi settings.UiBannerContent = argoCDCM.Data[settingUiBannerContentKey] settings.UiBannerPermanent = argoCDCM.Data[settingUiBannerPermanentKey] == "true" settings.UiBannerPosition = argoCDCM.Data[settingUiBannerPositionKey] + // TODO: Do we need to add binaryUrls here so updates get populated? if err := validateExternalURL(argoCDCM.Data[settingURLKey]); err != nil { log.Warnf("Failed to validate URL in configmap: %v", err) } From 6ed91a9dca49476ef76143c8326bf2f7611cf4dc Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Fri, 19 Nov 2021 16:14:03 -0500 Subject: [PATCH 03/12] Update configmap Signed-off-by: Yuan Tang --- util/settings/settings.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/util/settings/settings.go b/util/settings/settings.go index 0e211b1de7a53..78f63e9726685 100644 --- a/util/settings/settings.go +++ b/util/settings/settings.go @@ -88,6 +88,8 @@ type ArgoCDSettings struct { UiBannerPosition string `json:"uiBannerPosition,omitempty"` // PasswordPattern for password regular expression PasswordPattern string `json:"passwordPattern,omitempty"` + // BinaryUrls contains the URLs for downloading argocd binaries + BinaryUrls map[string]string `json:"binaryUrls,omitempty"` } type GoogleAnalytics struct { @@ -311,6 +313,8 @@ const ( settingUiBannerPermanentKey = "ui.bannerpermanent" // settingUiBannerPositionKey designates the key for the position of the banner settingUiBannerPositionKey = "ui.bannerposition" + // settingsBinaryUrls designates the key for the argocd binary URLs + settingsBinaryUrls = "help.download" // globalProjectsKey designates the key for global project settings globalProjectsKey = "globalProjects" // initialPasswordSecretName is the name of the secret that will hold the initial admin password @@ -1080,7 +1084,14 @@ func updateSettingsFromConfigMap(settings *ArgoCDSettings, argoCDCM *apiv1.Confi settings.UiBannerContent = argoCDCM.Data[settingUiBannerContentKey] settings.UiBannerPermanent = argoCDCM.Data[settingUiBannerPermanentKey] == "true" settings.UiBannerPosition = argoCDCM.Data[settingUiBannerPositionKey] - // TODO: Do we need to add binaryUrls here so updates get populated? + if argoCDCM.Data[settingUiBannerPositionKey] != "" { + settings.BinaryUrls = map[string]string{ + // TODO: Check existence before inserting to the map + "darwin-amd64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-amd64"], + "darwin-arm64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-arm64"], + "windows-amd64": argoCDCM.Data[settingUiBannerPositionKey+".windows-amd64"], + } + } if err := validateExternalURL(argoCDCM.Data[settingURLKey]); err != nil { log.Warnf("Failed to validate URL in configmap: %v", err) } From 944eb4485dba1a37474cb9a51563f7ae656da0c5 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Sat, 20 Nov 2021 21:51:31 -0500 Subject: [PATCH 04/12] Lint fix Signed-off-by: Yuan Tang --- pkg/apis/application/v1alpha1/openapi_generated.go | 1 - pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | 1 - server/settings/settings.go | 4 ++-- util/settings/settings.go | 10 +++++----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/apis/application/v1alpha1/openapi_generated.go b/pkg/apis/application/v1alpha1/openapi_generated.go index 889de2fb47239..ae18e9a8aa540 100644 --- a/pkg/apis/application/v1alpha1/openapi_generated.go +++ b/pkg/apis/application/v1alpha1/openapi_generated.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by openapi-gen. DO NOT EDIT. diff --git a/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go index 0265a10ba37de..baf46e93095ec 100644 --- a/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by deepcopy-gen. DO NOT EDIT. diff --git a/server/settings/settings.go b/server/settings/settings.go index d2488bda0e3d8..10f01cddb2352 100644 --- a/server/settings/settings.go +++ b/server/settings/settings.go @@ -97,8 +97,8 @@ func (s *Server) Get(ctx context.Context, q *settingspkg.SettingsQuery) (*settin AnonymizeUsers: gaSettings.AnonymizeUsers, }, Help: &settingspkg.Help{ - ChatUrl: help.ChatURL, - ChatText: help.ChatText, + ChatUrl: help.ChatURL, + ChatText: help.ChatText, BinaryUrls: help.BinaryURLs, }, Plugins: plugins, diff --git a/util/settings/settings.go b/util/settings/settings.go index 78f63e9726685..86b84f9fe5ec4 100644 --- a/util/settings/settings.go +++ b/util/settings/settings.go @@ -935,9 +935,9 @@ func (mgr *SettingsManager) GetHelp() (*Help, error) { ChatText: chatText, BinaryURLs: map[string]string{ "windows-amd64": argoCDCM.Data["help.download.windows-amd64"], - "linux-amd64": argoCDCM.Data["help.download.linux-amd64"], - "darwin-amd64": argoCDCM.Data["help.download.darwin-amd64"], - "darwin-arm64": argoCDCM.Data["help.download.darwin-arm64"], + "linux-amd64": argoCDCM.Data["help.download.linux-amd64"], + "darwin-amd64": argoCDCM.Data["help.download.darwin-amd64"], + "darwin-arm64": argoCDCM.Data["help.download.darwin-arm64"], }, }, nil } @@ -1087,8 +1087,8 @@ func updateSettingsFromConfigMap(settings *ArgoCDSettings, argoCDCM *apiv1.Confi if argoCDCM.Data[settingUiBannerPositionKey] != "" { settings.BinaryUrls = map[string]string{ // TODO: Check existence before inserting to the map - "darwin-amd64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-amd64"], - "darwin-arm64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-arm64"], + "darwin-amd64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-amd64"], + "darwin-arm64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-arm64"], "windows-amd64": argoCDCM.Data[settingUiBannerPositionKey+".windows-amd64"], } } From 3e51c2e47dfa53f7a9ee99b84481454ea7809ce9 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Mon, 22 Nov 2021 15:25:40 -0500 Subject: [PATCH 05/12] Add unit tests Signed-off-by: Yuan Tang --- util/settings/settings.go | 34 ++++++++++++++++------------------ util/settings/settings_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/util/settings/settings.go b/util/settings/settings.go index 86b84f9fe5ec4..2357cfa7cc097 100644 --- a/util/settings/settings.go +++ b/util/settings/settings.go @@ -313,8 +313,8 @@ const ( settingUiBannerPermanentKey = "ui.bannerpermanent" // settingUiBannerPositionKey designates the key for the position of the banner settingUiBannerPositionKey = "ui.bannerposition" - // settingsBinaryUrls designates the key for the argocd binary URLs - settingsBinaryUrls = "help.download" + // settingsBinaryUrlsKey designates the key for the argocd binary URLs + settingsBinaryUrlsKey = "help.download" // globalProjectsKey designates the key for global project settings globalProjectsKey = "globalProjects" // initialPasswordSecretName is the name of the secret that will hold the initial admin password @@ -931,14 +931,9 @@ func (mgr *SettingsManager) GetHelp() (*Help, error) { chatText = "Chat now!" } return &Help{ - ChatURL: argoCDCM.Data[helpChatURL], - ChatText: chatText, - BinaryURLs: map[string]string{ - "windows-amd64": argoCDCM.Data["help.download.windows-amd64"], - "linux-amd64": argoCDCM.Data["help.download.linux-amd64"], - "darwin-amd64": argoCDCM.Data["help.download.darwin-amd64"], - "darwin-arm64": argoCDCM.Data["help.download.darwin-arm64"], - }, + ChatURL: argoCDCM.Data[helpChatURL], + ChatText: chatText, + BinaryURLs: getDownloadBinaryUrlsFromConfigMap(argoCDCM), }, nil } @@ -1073,6 +1068,16 @@ func (mgr *SettingsManager) ensureSynced(forceResync bool) error { return mgr.initialize(ctx) } +func getDownloadBinaryUrlsFromConfigMap(argoCDCM *apiv1.ConfigMap) map[string]string { + binaryUrls := map[string]string{} + for _, archType := range []string{"darwin-amd64", "darwin-arm64", "windows-amd64"} { + if val, ok := argoCDCM.Data[settingsBinaryUrlsKey+"."+archType]; ok { + binaryUrls[archType] = val + } + } + return binaryUrls +} + // updateSettingsFromConfigMap transfers settings from a Kubernetes configmap into an ArgoCDSettings struct. func updateSettingsFromConfigMap(settings *ArgoCDSettings, argoCDCM *apiv1.ConfigMap) { settings.DexConfig = argoCDCM.Data[settingDexConfigKey] @@ -1084,14 +1089,7 @@ func updateSettingsFromConfigMap(settings *ArgoCDSettings, argoCDCM *apiv1.Confi settings.UiBannerContent = argoCDCM.Data[settingUiBannerContentKey] settings.UiBannerPermanent = argoCDCM.Data[settingUiBannerPermanentKey] == "true" settings.UiBannerPosition = argoCDCM.Data[settingUiBannerPositionKey] - if argoCDCM.Data[settingUiBannerPositionKey] != "" { - settings.BinaryUrls = map[string]string{ - // TODO: Check existence before inserting to the map - "darwin-amd64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-amd64"], - "darwin-arm64": argoCDCM.Data[settingUiBannerPositionKey+".darwin-arm64"], - "windows-amd64": argoCDCM.Data[settingUiBannerPositionKey+".windows-amd64"], - } - } + settings.BinaryUrls = getDownloadBinaryUrlsFromConfigMap(argoCDCM) if err := validateExternalURL(argoCDCM.Data[settingURLKey]); err != nil { log.Warnf("Failed to validate URL in configmap: %v", err) } diff --git a/util/settings/settings_test.go b/util/settings/settings_test.go index 9f23a72fbd8f5..d90ea7f7b27ee 100644 --- a/util/settings/settings_test.go +++ b/util/settings/settings_test.go @@ -591,6 +591,15 @@ func TestSettingsManager_GetHelp(t *testing.T) { assert.Equal(t, "foo", h.ChatURL) assert.Equal(t, "bar", h.ChatText) }) + t.Run("GetBinaryUrls", func(t *testing.T) { + _, settingsManager := fixtures(map[string]string{ + "help.download.darwin-amd64": "amd64-path", + "help.download.unsupported": "nowhere", + }) + h, err := settingsManager.GetHelp() + assert.NoError(t, err) + assert.Equal(t, map[string]string{"darwin-amd64": "amd64-path"}, h.BinaryURLs) + }) } func TestGetOIDCConfig(t *testing.T) { @@ -895,6 +904,22 @@ func Test_GetTLSConfiguration(t *testing.T) { }) } +func TestDownloadArgoCDBinaryUrls(t *testing.T) { + _, settingsManager := fixtures(map[string]string{ + "help.download.darwin-amd64": "some-url", + }) + argoCDCM, err := settingsManager.getConfigMap() + assert.NoError(t, err) + assert.Equal(t, "some-url", argoCDCM.Data["help.download.darwin-amd64"]) + + _, settingsManager = fixtures(map[string]string{ + "help.download.unsupported": "some-url", + }) + argoCDCM, err = settingsManager.getConfigMap() + assert.NoError(t, err) + assert.Equal(t, "some-url", argoCDCM.Data["help.download.unsupported"]) +} + func TestSecretKeyRef(t *testing.T) { data := map[string]string{ "oidc.config": `name: Okta From 82c348e370b9c273f955a0d0c27ecad108422694 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Mon, 22 Nov 2021 20:44:19 -0500 Subject: [PATCH 06/12] Only append when key exists and fix icons Signed-off-by: Yuan Tang --- ui/src/app/help/components/help.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/src/app/help/components/help.tsx b/ui/src/app/help/components/help.tsx index a30f2d98dba8e..c19d0e5699163 100644 --- a/ui/src/app/help/components/help.tsx +++ b/ui/src/app/help/components/help.tsx @@ -40,21 +40,21 @@ export const Help = () => { Linux   - {binaryUrls['darwin-amd64'] && ( + {binaryUrls.hasOwnProperty('darwin-amd64') && ( - MacOS (amd64) + MacOS (amd64) )}   - {binaryUrls['darwin-arm64'] && ( + {binaryUrls.hasOwnProperty('darwin-arm64') && ( - MacOS (arm64) + MacOS (arm64) )}   - {binaryUrls['windows-amd64'] && ( + {binaryUrls.hasOwnProperty('windows-amd64') && ( - Windows + Windows )} From 5c00832751b835e2783c21737abf592817c7acfd Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Mon, 22 Nov 2021 21:34:09 -0500 Subject: [PATCH 07/12] Add docs Signed-off-by: Yuan Tang --- docs/operator-manual/argocd-cm.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/operator-manual/argocd-cm.yaml b/docs/operator-manual/argocd-cm.yaml index be0251015f39f..6268cb51d66fa 100644 --- a/docs/operator-manual/argocd-cm.yaml +++ b/docs/operator-manual/argocd-cm.yaml @@ -30,6 +30,11 @@ data: help.chatUrl: "https://mycorp.slack.com/argo-cd" # the text for getting chat help, defaults to "Chat now!" help.chatText: "Chat now!" + # The URLs to download additional ArgoCD binaries (besides the Linux amd64 binary included by default) + # for different OS architectures. If provided, additional download buttons will be displayed on the help page. + help.download.darwin-amd64: test-path1 + help.download.darwin-arm64: test-path2 + help.download.windows-amd64: test-path3 # A dex connector configuration (optional). See SSO configuration documentation: # https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/sso From e0a5c4d39e96ec679d70c4cc0f7ae91f5cb971c9 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Mon, 22 Nov 2021 21:45:38 -0500 Subject: [PATCH 08/12] Remove unnecessary viewPreferences Signed-off-by: Yuan Tang --- ui/src/app/help/components/help.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/help/components/help.tsx b/ui/src/app/help/components/help.tsx index c19d0e5699163..03b02dfaaf1c8 100644 --- a/ui/src/app/help/components/help.tsx +++ b/ui/src/app/help/components/help.tsx @@ -11,7 +11,7 @@ export const Help = () => { return ( - combineLatest([services.authService.settings(), services.viewPreferences.getPreferences()]).pipe( + combineLatest([services.authService.settings()]).pipe( map(items => { return { binaryUrls: items[0].help.binaryUrls From a158e427eaf108928efb5dc4b9df986a18ffca31 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Mon, 22 Nov 2021 23:01:27 -0500 Subject: [PATCH 09/12] Retrigger CI pipeline Signed-off-by: Yuan Tang From 5e93d0080071ec4ea823d744dd0e59f3c874d6b0 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 24 Nov 2021 15:43:41 -0500 Subject: [PATCH 10/12] Refactor UI code based on feedback Signed-off-by: Yuan Tang --- ui/src/app/help/components/help.tsx | 121 +++++++++++++--------------- util/settings/settings.go | 2 +- 2 files changed, 56 insertions(+), 67 deletions(-) diff --git a/ui/src/app/help/components/help.tsx b/ui/src/app/help/components/help.tsx index 03b02dfaaf1c8..c40e2b60d0fe6 100644 --- a/ui/src/app/help/components/help.tsx +++ b/ui/src/app/help/components/help.tsx @@ -1,78 +1,67 @@ import * as React from 'react'; -import {DataLoader, Page} from '../../shared/components'; -import {Consumer} from '../../shared/context'; +import {Page} from '../../shared/components'; import {combineLatest} from 'rxjs'; import {services} from '../../shared/services'; import {map} from 'rxjs/operators'; +import classNames from 'classnames'; require('./help.scss'); export const Help = () => { - return ( - - combineLatest([services.authService.settings()]).pipe( - map(items => { - return { - binaryUrls: items[0].help.binaryUrls - }; - }) - ) - }> - {({binaryUrls}: {binaryUrls: Record}) => { + const downloadButtons = combineLatest([services.authService.settings()]).pipe( + map(items => { + Object.keys(items[0].help.binaryUrls || {}).map(binaryName => { + const binaryUrls = items[0].help.binaryUrls; + const url = binaryUrls[binaryName]; + const match = binaryName.match(/.*(darwin|windows|linux)-(amd64|arm64)/); + const [platform, arch] = match ? match.slice(1) : ['', '']; return ( - - {() => ( - -
-
-
-

New to Argo CD?

- - Read the docs - -
-
-
-
-

Want to download the CLI tool?

- - Linux - -   - {binaryUrls.hasOwnProperty('darwin-amd64') && ( - - MacOS (amd64) - - )} -   - {binaryUrls.hasOwnProperty('darwin-arm64') && ( - - MacOS (arm64) - - )} -   - {binaryUrls.hasOwnProperty('windows-amd64') && ( - - Windows - - )} -
-
-
-
-

You want to develop against Argo CD's API?

- - Open the API docs - -
-
-
-
- )} -
+ <> +   + + {' '} + platform {arch && `( ${arch} )`} + + ); - }} -
+ }); + }) + ); + return ( + +
+
+
+

New to Argo CD?

+ + Read the docs + +
+
+
+
+

Want to download the CLI tool?

+ + Linux + + {downloadButtons} +
+
+
+
+

You want to develop against Argo CD's API?

+ + Open the API docs + +
+
+
+
); }; diff --git a/util/settings/settings.go b/util/settings/settings.go index 2357cfa7cc097..2135251ae191b 100644 --- a/util/settings/settings.go +++ b/util/settings/settings.go @@ -1070,7 +1070,7 @@ func (mgr *SettingsManager) ensureSynced(forceResync bool) error { func getDownloadBinaryUrlsFromConfigMap(argoCDCM *apiv1.ConfigMap) map[string]string { binaryUrls := map[string]string{} - for _, archType := range []string{"darwin-amd64", "darwin-arm64", "windows-amd64"} { + for _, archType := range []string{"darwin-amd64", "darwin-arm64", "windows-amd64", "linux-arm64", "linux-amd64"} { if val, ok := argoCDCM.Data[settingsBinaryUrlsKey+"."+archType]; ok { binaryUrls[archType] = val } From ca9de90595dc24137533b263e0e154c3a8adf032 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 24 Nov 2021 16:05:42 -0500 Subject: [PATCH 11/12] Fix crushing and revert refactoring Signed-off-by: Yuan Tang --- ui/src/app/help/components/help.tsx | 121 +++++++++++++++------------- 1 file changed, 66 insertions(+), 55 deletions(-) diff --git a/ui/src/app/help/components/help.tsx b/ui/src/app/help/components/help.tsx index c40e2b60d0fe6..fb7b553c46b60 100644 --- a/ui/src/app/help/components/help.tsx +++ b/ui/src/app/help/components/help.tsx @@ -1,67 +1,78 @@ import * as React from 'react'; -import {Page} from '../../shared/components'; +import {DataLoader, Page} from '../../shared/components'; +import {Consumer} from '../../shared/context'; import {combineLatest} from 'rxjs'; import {services} from '../../shared/services'; import {map} from 'rxjs/operators'; -import classNames from 'classnames'; require('./help.scss'); export const Help = () => { - const downloadButtons = combineLatest([services.authService.settings()]).pipe( - map(items => { - Object.keys(items[0].help.binaryUrls || {}).map(binaryName => { - const binaryUrls = items[0].help.binaryUrls; - const url = binaryUrls[binaryName]; - const match = binaryName.match(/.*(darwin|windows|linux)-(amd64|arm64)/); - const [platform, arch] = match ? match.slice(1) : ['', '']; + return ( + + combineLatest([services.authService.settings()]).pipe( + map(items => { + return { + binaryUrls: items[0].help.binaryUrls || {} + }; + }) + ) + }> + {({binaryUrls}: {binaryUrls: Record}) => { return ( - <> -   - - {' '} - platform {arch && `( ${arch} )`} - - + + {() => ( + +
+
+
+

New to Argo CD?

+ + Read the docs + +
+
+
+
+

Want to download the CLI tool?

+ + Linux + +   + {binaryUrls.hasOwnProperty('darwin-amd64') && ( + + MacOS (amd64) + + )} +   + {binaryUrls.hasOwnProperty('darwin-arm64') && ( + + MacOS (arm64) + + )} +   + {binaryUrls.hasOwnProperty('windows-amd64') && ( + + Windows + + )} +
+
+
+
+

You want to develop against Argo CD's API?

+ + Open the API docs + +
+
+
+
+ )} +
); - }); - }) - ); - return ( - -
-
-
-

New to Argo CD?

- - Read the docs - -
-
-
-
-

Want to download the CLI tool?

- - Linux - - {downloadButtons} -
-
-
-
-

You want to develop against Argo CD's API?

- - Open the API docs - -
-
-
-
+ }} +
); }; From efa43e504782a158b4988fa2e45434bc833cec70 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Tue, 30 Nov 2021 10:09:19 -0500 Subject: [PATCH 12/12] chore: Add missing linux-arm64 in the UI Signed-off-by: Yuan Tang --- ui/src/app/help/components/help.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/app/help/components/help.tsx b/ui/src/app/help/components/help.tsx index fb7b553c46b60..3b18bf65dcddd 100644 --- a/ui/src/app/help/components/help.tsx +++ b/ui/src/app/help/components/help.tsx @@ -37,9 +37,15 @@ export const Help = () => {

Want to download the CLI tool?

- Linux + Linux (amd64)   + {binaryUrls.hasOwnProperty('linux-arm64') && ( + + Linux (arm64) + + )} +   {binaryUrls.hasOwnProperty('darwin-amd64') && ( MacOS (amd64)