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

[Automation] Should we settle on a single language for automation scripts? Which one? #783

Closed
larsks opened this issue May 12, 2021 · 13 comments

Comments

@larsks
Copy link
Contributor

larsks commented May 12, 2021

From the discussion @HumairAK started in operate-first/apps#635:

one issue I'm seeing is right now we have a few scripts in bash, one in python (that @larsks has worked on) we will need to narrow down to one language if we are to wrap these, lest we start calling bash / python scripts from golang or something (yuck).

@larsks
Copy link
Contributor Author

larsks commented May 12, 2021

I don't feel strongly about settle on a single language (or not), but I would love to see us stop parsing YAML in bash, especially given the existence of two yq commands with mutually incompatible syntax.

@HumairAK
Copy link
Member

I'm happy with golang, working as closely as we do with openshift/k8s it could be valuable experience. Also, we may want to extend the tooling to also communicate with OCP and thus client-go support could serve useful. But I don't know how suitable Go is for scripts, since it requires compilation, it may add additional overhead. But on the other hand, wrapping these go scripts into one cli/program in the future would become a lot easier. We could, for now, just settle for running these via go run.

@tumido
Copy link
Member

tumido commented May 12, 2021

Yeah, I'd like to bring us closer to clis like kubectl, kustomize, argocd etc. We can easily include those as subcommands if we want to since it's all golang libs.
Other tool we might want to consider including or extending is kam.

I think the necessity to compile go binaries actually makes it more portable and it's useful. It's very easy to build go binary for various platforms without any overhead (it's just 2 build flags, that's it). It also means there's zero dependencies - no Python version constraint or pip dependencies required, proper windows support if we want it to, etc.

I think an immerse interactive CLI would be an appreciated end result.

@tumido
Copy link
Member

tumido commented May 12, 2021

Note: My previous comment was more focused on the "end goal" for our "immerse" CLI. Which is maybe further down the road than this issue... In the end I think we should have a well defined end goal (that I can fork from the previous comment) and all our refactoring should keep that in mind and do small steps towards that direction.

So.. if our end goal is an extendable interactive CLI, I'd say it would be for the best to use golang for that, hence refactor the scripts into the same language as the future CLI so it aligns with the end goal here.

@HumairAK
Copy link
Member

HumairAK commented May 12, 2021

Skimming through the kam tool...this seems extremely heavily opinionated of things that we are also very heavily opinionated on.

For example the way their environments are declaratively structured.

@tumido
Copy link
Member

tumido commented May 12, 2021

this seems extremely heavily opinionated

Yeah, I've reached the same conclusion @HumairAK 👍

@HumairAK
Copy link
Member

further thinking on this, why not just do a single binary right off the bat and separate what would have been different scripts in to different sub commands, e.g:

./cli [subcommand] ....<additional flags or sub-sub-commands> 

So like:

./cli onboarding blah-blah
./cli enable-monitoring blah-blah
./cli update-cluster-version blah-blah

Then re-using common code will be a bit clearer/intuitive. I think folks will also stay more consistent in their formatting as they are likely to copy the standards set in the existing code.

@tumido
Copy link
Member

tumido commented May 12, 2021

Yeah, that sounds good 🙂

@HumairAK HumairAK changed the title Should we settle on a single language for automation scripts? Which one? [Automation] Should we settle on a single language for automation scripts? Which one? May 12, 2021
@HumairAK HumairAK transferred this issue from operate-first/apps May 12, 2021
@larsks
Copy link
Contributor Author

larsks commented May 17, 2021

@HumairAK @tumido maybe something like https://github.com/larsks/opfcli?

@HumairAK
Copy link
Member

@larsks yes, this is great! I was thinking cobra/viper as well -- I'll give this a look/test.

@HumairAK
Copy link
Member

Can we have this moved to the operate-first org? Suggested options:

  1. move repo directly to this org
  2. create a repo, make a pr for review for discussion / implementation details

@larsks
Copy link
Contributor Author

larsks commented May 17, 2021

@HumairAK operate-first/opfcli#1

larsks referenced this issue in larsks/opfcli May 17, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 17, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 17, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 17, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 17, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 18, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 19, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 19, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
larsks referenced this issue in larsks/opfcli May 19, 2021
This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.
sesheta referenced this issue in operate-first/opfcli May 19, 2021
* Initial import of opfcli command line tool

This is my attempt at implementing what we talked about in
operate-first/SRE#299. It's an integrated command line tool written in
Go that currently provides equivalents for:

- onboarding.sh (called create-project)
- enable-monitoring.sh
- operate-first/apps#626 (called grant-access)

This is my first time writing Go, ever, so there may be lots of
non-idiomatic code. In your reviews, be kind, but be thorough smile.

* Fix problems in pre-commit configuration

- Disable remove-tabs in pre-commit hook

  Standard go style includes using tabs for indentation. This is
  enforced by gofmt.

- Trailing whitespace in Markdown documents is significant

  We shouldn't be running the trailing-whitespace check on Markdown
  documents (because that's how you indicate a line break without
  introducing a new paragraph).
@HumairAK
Copy link
Member

We've settled on a golang cli, see https://github.com/operate-first/opfcli

@durandom durandom transferred this issue from operate-first/operations Sep 6, 2022
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

No branches or pull requests

3 participants