Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Suggestion: Simplify get-tce-release script #1442

Closed
karuppiah7890 opened this issue Aug 25, 2021 · 1 comment
Closed

Suggestion: Simplify get-tce-release script #1442

karuppiah7890 opened this issue Aug 25, 2021 · 1 comment

Comments

@karuppiah7890
Copy link
Contributor

karuppiah7890 commented Aug 25, 2021

Feature Request

This is a suggestion / feature request to simplify get-tce-release.sh script

I'm looking at -

Reducing

  • Complexity - Currently the script is 68 lines long. We do a lot of processing in it and use a lot of tools
  • Maintenance - I know this is most probably a one time script that we most probably don't have to modify, unless GitHub removes the API that we use. In any case, this is something we might to maintain if we use it, for example I notice it being mentioned in the docs - https://quirky-franklin-8969be.netlify.app/docs/latest/cli-installation/

Currently the complexity and maintenance mostly is due to the fact that TCE is a private repo and hence we have to use GitHub APIs and can't use direct download URLs available on releases page like public repos, for example https://github.com/vmware-tanzu/community-edition/releases/download/v0.7.0/tce-linux-amd64-v0.7.0.tar.gz then it's easy to just use curl along with that link. But looks like we want to support ability to install any asset with just the substring looking at this code, so that looks like we want to support this even after public launch. Also, all the error messages that we show for tag not present

Maybe one thing that might change after public launch is - removal of the need for a token, and we can validate most things with just https://github.com URLs instead of the API with API token. Or we could just use the API without the API token, as it will be a public repo after launch and GitHub APIs can work to a good extent (with acceptable rate limits) without API tokens for public resources

If we think this script is going to be used for quite sometime (till public launch or even beyond) and will be used many times and if we are looking for improvements, some things I can think of are -

Improving

  • Fault tolerance - Currently the script relies on many tools which will mostly be present, except maybe jq, which we don't install as part of the script
  • Simplicity - Lots of lines of code to download a tar ball from a private repo. Lots of lines looks like a complex thing, to read and understand and also modify in the future

The alternative I thought was - using something like fetch tool, which can download from private repos. I tried it out and it worked pretty well. Just a few lines of code - https://github.com/karuppiah7890/tce/blob/tce-release-bin-install/test/fetch-and-install-tce-release.sh#L52-L56

But yeah, it comes with tradeoffs

  • We have to install an extra tool. We have to install fetch probably locally in some ~/.bin like directory and invoke it from that path like ~/.bin/fetch ...
  • We may not get the error messages / the custom error messages / exact error messages from fetch like we get from get-tce-release.sh script regarding token not valid, wrong release tag input, wrong asset name input. I need to check more on this though

I just wanted to bring it up to mention that we can delegate the feature to something like fetch instead of writing and maintaining our own code

Describe alternatives you've considered

Keep using get-tce-release.sh script

@karuppiah7890 karuppiah7890 added triage/needs-triage Needs triage by TCE maintainers kind/feature A request for a new feature and removed triage/needs-triage Needs triage by TCE maintainers kind/feature A request for a new feature labels Aug 25, 2021
@karuppiah7890
Copy link
Contributor Author

Closing this temporarily to avoid too many open issues during launch time. If this idea comes up again later we can open it up

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant