2

Is there a good web console or tool that would help enable us to review Shell Scripts?

Usually when maintaining a system, we would run scripts that are managed, or we could run scripts that run only once. However, these scripts must go through a vetting process to make sure they are secure, compliant, and won't create an issue.

We could of course create a git repo and create PR each time we want to run a script, but I am looking for a way for our members to submit scripts without fussing too much about format or folder structure.

3

I am looking for a way for our members to submit scripts without fussing too much about format or folder structure.

It sounds like you need some combination of testing and linting, perhaps with a few utility scripts to organise and gate content from landing in the repo.

The "Vetting process" you mention sounds to me exactly like "tests need to pass on the scripts". A widely-used framework to write such tests is the Bash Automated Testing System - BATS.

It would be up to you to write the tests to check whether, as you desire, these scripts are "secure, compliant and won't create an issue", but at least you have a framework for generating and running them.

At a more superficial level, you could use the Shellcheck linter to assert that any proposed new code adheres to whatever set of common rules you adopt in your community.

Pulling these together into a GitHub action (e.g. using https://github.com/github/super-linter), or a git pre-commit hook etc could be a good way to add a quick inspection to new contributions, and help maintainers.

These would provide quantitative measures of correctness. In order to also provide some qualitative or more subjective measures of acceptance, this would depend greatly on the operating environment and which tools would fit naturally into yours.

However, some tools do attempt to address this need by design. Without further knowledge of the environment it's difficult to provide concrete answers, but here is a comparison of two options:

GitHub, GitLab requests

Assuming the code is destined for a GitHub or GitLab repo, GitHub or GitLab itself could of course be used as the "review console". A contributor would fork the repo, send a new contribution in the form of a PR against the repo, and then the checks referred to above would be executed.

The actions could take care of the organisation, based on some internal convention, e.g. using labels, i.e. "file scripts in PRs labelled admin in the admin directory".

Gerrit

Another purpose-built tool to manage code contributions is Gerrit. Gerrit is heavily backed by git workflow and may not be relevant, but I mention it since it's one of the first such peer-review systems for software.

As described on the Gerrit website, a similar workflow is followed:

Making the Change

Creating the Review

Reviewing the Change

Reworking the Change

Verifying the Change

Submitting the Change

Next Steps

Much of the actual work here is done by the reviewer or contributor, and Gerrit serves to organise their collaboration.

I suspect that neither of these corresponds exactly to what you are asking for, though, however a general purpose tool to which arbitrary contributions can be submitted is a big ask and likely a mirage.

It seems more feasible that this should be achieved by adopting shared conventions in existing code collaboration platforms rather than a dedicated service to manage ingestion.


Finally, you mention:

Usually when maintaining a system...

If you meant "maintaining a configuration state of a system", perhaps an approach with Zuul. Zuul is

... a program that drives continuous integration, delivery, and deployment systems with a focus on project gating and interrelated projects.

While quite heavy, it is a means to actually execute and evaluate the result of a proposed script. This provides more meaningful feedback, but is of course more onerous in terms of setup and maintenance.

3
  • 1
    The github.com/github/super-linter includes shellcheck and is designed to work as a github action already. – chicks Dec 28 '20 at 15:51
  • Thanks for the input. What I am looking for is not a linter or unit test for the scripts submitted, although very helpful before submitting for review, but a tool for peer review and approval to run. – JeffJen Dec 29 '20 at 2:51
  • Thanks for the clarification. I'll update the answer. – Bruce Becker Dec 29 '20 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.