Code Monkey home page Code Monkey logo

maestro's Introduction

Go Reference CI

Maestro

A developer utility.

Installing

Prebuilt binaries are available here on GitHub

Linux and Mac users can run

curl -fsSL https://maestro.eighty4.tech/install.sh | sh

With Go 1.22.1 or later, Maestro can be installed from source:

go install github.com/eighty4/maestro@latest

Syncing with maestro git

Keep your workspace in sync with the maestro git command. This command performs a git pull --ff-only in each repository found nested within two subdirectories deep from the current working directory.

maestro git

A maestro.yaml file allows repositories to be configured, enabling a maestro git command to also clone repositories not already present in the workspace. Eventually this feature could be used to enable an export/import workflow with a dev machine's workspaces before formatting or replacing hardware. Configuring a maestro.yaml example is in the tests.

Workspace APIs

maestro/git provides the APIs for syncing a multi-repository workspace. git.NewWorkspace scans a directory for git repositories and provides access to the Workspace.Sync operation. Syncing delegates to git.Clone and git.Pull for each git.Repository configured with the workspace whether it's present or absent on within the workspace dir.

The maestro/composable module has wrappers for exec.Cmd to be used for managing local development processes and performing process healthchecks with HTTP GET and shell commands. Previous iterations could configure Gradle tasks, npm scripts and shell commands from a .maestro file. Re-visiting the project with the opportunity to use new Go tooling and language features (workspaces and generics), I rewrote process management but have yet to reimplement configuring and managing a local development environment.

maestro's People

Contributors

eighty4 avatar

Stargazers

 avatar

Watchers

 avatar

maestro's Issues

Unhandled `git pull` connection errors

git pull errors with fatal: Could not read from remote repository. for a bunch of different connection errors, sometimes preceded with a line that specifies the cause of the error.

Https remotes will use this message:

fatal: unable to access 'https://github.com/eighty4/sse/': Could not resolve host: github.com

Workspace.Sync should report these errors correctly.

Ssh connectivity error:

ssh: connect to host github.com port 22: Undefined error: 0
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Ssh auth error with host:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Repository not found:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

`git.Pull` should use `--ff-only`

git.Pull currently handles error messages for both rebase and merge resolution strategies, handling a user's global and repository specific preferences. Conflict resolution isn't possible for a non-interactive interface so it makes more sense to use git pull --ff-only. --ff-only would simplify error handling (numerous different error messages would be uniformly replaced with "unable to fast forward"), side effect handling (from not entering a rebase) and reduce test scenarios.

Unhandled `git pull` error when tracked branch ref has been deleted on remote

maestro git has an unhandled error scenario when performing git pull on a repo tracking a delete branch on remote.

  1. git checkout -b branch-name
  2. git push -u origin branch-name
  3. delete branch from remote
  4. git pull
Your configuration specifies to merge with the ref 'refs/heads/branch-name'
from the remote, but no such ref was fetched.

Could also be reproduced by manually changing the branch.[branch-name].merge config entry pointing to a ref that does not exist:

  1. git clone [email protected]:eighty4/maestro
  2. git config branch.main.merge something-bogus

Maestro yaml file configures workspace repositories

Maestro should read a yaml config file from the program's cwd on startup and include any repo records at $.workspace.repositories with the call to git.NewWorkspace. Workspace.Sync should git clone repositories that are not present within the workspace or do a git pull for already cloned projects.

Repositories can be configured with their name, path and git url. Path must be an ancestor path of the program's cwd (../foo is not permitted).

workspace:
  repositories:
    - name: fomo
      path: fomo
      git:
        url: [email protected]:eighty4/fomo
    - name: picking
      path: picking
      git:
        url: [email protected]:eighty4/picking

Only git url is required. Name and path are optional and will use the default behavior of git clone, using the repository name for an omitted name or path. In this example the repository would be named fomo and would be cloned into ./fomo:

workspace:
  repositories:
    - git:
        url: [email protected]:eighty4/fomo

A repository's path can be any nested directory structure within the program's cwd. In this scenario, an omitted name will default to the path value. These repositories in this example will have names plaid/trousers and plaid/banking:

workspace:
  repositories:
    - path: plaid/trousers
      git:
        url: [email protected]:eighty4/trousers
    - path: plaid/banking
      git:
        url: [email protected]:eighty4/banking

Unhandled `git clone` errors

Workspace.Sync should catch and report these git clone errors.

Clone with a redirect to a not git url

git clone yahoo.com
Cloning into '/private/var/folders/r6/0hg_xym96qbgc8m049hxjrxr0000gn/T/maestro-test3436126983'...
fatal: unable to update url base from redirection:
  asked for: https://yahoo.com/info/refs?service=git-upload-pack
   redirect: https://www.yahoo.com/

Clone with not found response

git clone https://github.com/adgaljsdgalksjdgaslkdgj
Cloning into 'asdgsadgasdgasgasdg'...
remote: Not Found
fatal: repository 'https://github.com/asdgsadgasdgasgasdg/' not found

Clone with an http auth failure

git clone https://github.com/eighty4/asddgasjdgasdg
Cloning into 'asddgasjdgasdg'...
Username for 'https://github.com': asdf
Password for 'https://[email protected]':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/eighty4/asddgasjdgasdg/'

`maestro git` syncing would be more performant with libgit2

Maestro currently spawns a subprocess for each git clone and git pull operation. Linux and darwin performance holds up with subprocesses while Windows is drastically slower with this method.

The libgit2/git2go project provides go bindings for libgit2 and would greatly improve performance for syncing git repos.

While performance gains would be most noticable on Windows, it will probably be more difficult to build libgit2 and openssl on Windows vs Unix based platforms. One platform can be migrated at a time by substituting the subprocess implementations with the libgit2 binding-based implementations when building with go build for a specific platform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.