/anchor

Create Dynamic CLI's as your GitOps Marketplace

Primary LanguageGoMIT LicenseMIT

Go Version GitHub CI status Go Report Card Go Coverage Go Releases License: MIT

RequirementsQuickStartOverviewSupportLicense


Anchor allows you to create dynamic CLI's as your GitOps marketplace. It connects to any git repository with a simple opinionated structure and expose executable commands as dynamic command-line-interface utility to use from any environment, CI and local.

Anchor can help in reducing the amount of CLI utilities created in a variety of languages in an organization, it does so by connecting to an existing/new git repositories and exposing what is required such as shell scripts, Python scripts, binary usage with options/arguments or any other executable.

Anchor has two modes for running an actions / actions-sets (workflows):

  • Interactive menu selector enriched with documentation
  • Non-interactive mode i.e. direct CLI command
❗ WARNING
Anchor is still in alpha stage, breaking changes might occur.

🏴‍☠️ Requirements

  • A Unix-like operating system: macOS, Linux
  • git (recommended v2.30.0 or higher)

⚡️ QuickStart

The fastest way (for macOS and Linux) to install anchor is using Homebrew:

brew install ZachiNachshon/tap/anchor

Alternatively, tap into the formula to have brew search capabilities on that tap formulas:

# Tap
brew tap ZachiNachshon/tap

# Install
brew install anchor

For additional installation methods read here.


⚓️ Overview

Maintainers / Contributors:


⛵ Why Creating Anchor?

  1. Allow a better experience on repositories containing lots of scripts managed by multiple teams, make them approachable and safe to use by having a documented and controlled process with minimum context switches for running scripts / installing applications / orchestrate installations / do whatever you require

  2. Allowing to compose different actions from multiple channels (shell scripts, CLI utilities etc..) into a coherent well documented workflow with rollback procedure

  3. Having an action / workflow execution plan explained in plain english and managed via a central versioned controlled remote repository in a GitOps way that can be shared with others to use easily

  4. Remove the fear of running an arbitrary undocumeted script that relies on ENV vars to control its execution

  5. Using an agnostic client that doesn’t change, rather, changes are reflected based on the remote git repository(ies) it relies on

  6. Reduce the amount of CLI utilities created in a variety of languages in an organization


📖 Documentation

Please refer to the documentation for detailed explanation on how to configure and use anchor.


🐳 Playground

Follow these steps to connect to a remote git playground repository and check the dynamic CLI live experience. All actions are no-op, you can safely run them as they only print to stdout.

Take anchor for a spin using the following steps, connect to a remote playground repository and check the different use-cases it might be used for:

  1. Register to a remote git playground repository and set it as the default config context:

    anchor config set-context-entry playground \
       --repository.remote.url=https://github.com/ZachiNachshon/anchor-playground.git \
       --repository.remote.autoUpdate=false \
       --set-current-context
  2. Type anchor to fetch the repository and print all available commands

  3. Check which items are available under the team-infra command:

    anchor team-infra status
  4. Select the team-infra command to start an interactive action selection, try running an action/workflow:

    anchor team-infra select
  5. Use the run command to run an action non-interactively:

    anchor team-infra run backoffice --action=install-jenkins-master
  6. Run an action-set (workflow) non-interactively:

    anchor team-infra run backoffice --workflow=provision-jenkins-server-agents
  7. Use other playground commands and run different actions to check different use cases

    💡 Note
    This is a quick overview just to get a grasp of how simple it is to use anchor.
    To add anchor support to an existing or new git repository, please read the documentation.

Support

Anchor is an open source project that is currently self maintained in addition to my day job, you are welcome to show your appreciation by sending me cups of coffee using the the following link as it is a known fact that it is the fuel that drives software engineering ☕

Buy Me A Coffee


License

MIT