Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Configurable ArgoCD binary download links on Help page. Fixes #7698 #7755

Merged
merged 12 commits into from
Nov 30, 2021

Conversation

terrytangyuan
Copy link
Member

@terrytangyuan terrytangyuan commented Nov 19, 2021

Fixes #7698.

image

image

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
@codecov
Copy link

codecov bot commented Nov 19, 2021

Codecov Report

Merging #7755 (efa43e5) into master (8e8a1de) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7755      +/-   ##
==========================================
+ Coverage   41.43%   41.46%   +0.02%     
==========================================
  Files         163      169       +6     
  Lines       22082    22245     +163     
==========================================
+ Hits         9150     9224      +74     
- Misses      11629    11703      +74     
- Partials     1303     1318      +15     
Impacted Files Coverage Δ
util/settings/settings.go 47.24% <100.00%> (+0.40%) ⬆️
cmd/argocd/commands/admin/admin.go 14.51% <0.00%> (-0.12%) ⬇️
util/notification/settings/settings.go 0.00% <0.00%> (ø)
util/notification/expression/time/time.go 37.50% <0.00%> (ø)
util/notification/settings/legacy.go 58.51% <0.00%> (ø)
util/notification/expression/strings/strings.go 66.66% <0.00%> (ø)
cmd/argocd/commands/admin/notifications.go 0.00% <0.00%> (ø)
util/notification/expression/expr.go 88.88% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e8a1de...efa43e5. Read the comment docs.

Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
@terrytangyuan terrytangyuan changed the title feat: Configurable ArgoCD binary download links on Help page feat: Configurable ArgoCD binary download links on Help page. Fixes #7698 Nov 22, 2021
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
@terrytangyuan terrytangyuan marked this pull request as ready for review November 23, 2021 02:41
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

From backend perspective, it LGTM.

@alexmt any issue with the frontend?

Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

Thank you @terrytangyuan . Added couple suggestions for API and UI

<i className='fab fa-linux' /> Linux
</a>
&nbsp;
{binaryUrls.hasOwnProperty('darwin-amd64') && (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Page crashes if binaryUrls is not defined/null. Instead of writing separate if for every permutation you can use following snipped :

import classNames from 'classnames';
...
{Object.keys(binaryUrls || {}).map(binaryName => {
    const url = binaryUrls[binaryName];
    const match = binaryName.match(/.*(darwin|windows|linux)-(amd64|arm64)/);
    const [platform, arch] = match ? match.slice(1) : ['', ''];
    return (
        <>
            &nbsp;
            <a key={binaryName} href={url} className='user-info-panel-buttons argo-button argo-button--base'>
                <i
                    className={classNames('fab', {
                        'fa-windows': platform === 'windows',
                        'fa-apple': platform === 'darwin',
                        'fa-linux': platform === 'linux'
                    })}
                />{' '}
                MacOS {arch && `( ${arch} )`}
            </a>
        </>
    );
})}

Copy link
Member Author

@terrytangyuan terrytangyuan Nov 24, 2021

Choose a reason for hiding this comment

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

I tried refactoring this in 5e93d00 but got stuck with some additional issues.

Though I was able to fix the page crushing issue very easily. Would you mind leaving the refactoring of typescript code later as I have zero experience and don't have much bandwidth to debug further currently?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for long response. Thanks for fixing the crash. I think it is ok to keep it as is - refactoring is optional.

@@ -1061,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"} {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Users might want to add arm/amd linux . I think list should include linux-arm and linux-amd64

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
@terrytangyuan terrytangyuan requested a review from alexmt November 30, 2021 15:10
@terrytangyuan
Copy link
Member Author

@alexmt Could you take another look when you get a chance? Thanks.

<i className='fab fa-linux' /> Linux
</a>
&nbsp;
{binaryUrls.hasOwnProperty('darwin-amd64') && (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for long response. Thanks for fixing the crash. I think it is ok to keep it as is - refactoring is optional.

@alexmt alexmt merged commit d8cfafb into argoproj:master Nov 30, 2021
@alexmt
Copy link
Collaborator

alexmt commented Nov 30, 2021

@terrytangyuan , I just realized the change should be in upgrading instructions. Can you please document the change in docs/operator-manual/upgrading/2.2-2.3.md ?

@terrytangyuan
Copy link
Member Author

@terrytangyuan , I just realized the change should be in upgrading instructions. Can you please document the change in docs/operator-manual/upgrading/2.2-2.3.md ?

Good call. I'll send a PR today.

@terrytangyuan terrytangyuan deleted the configurable-download-url branch November 30, 2021 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable download links on Help page
3 participants