ergo

package module
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

README

ergo

Test Status Coverage Status

Ergo (έργο), greek name for work, is a list of utilities for the daily release workflow.

Installation

$ curl -L https://github.com/beatlabs/ergo/releases/download/v0.7.0/ergo-0.7.0-darwin-amd64 --output ergo && chmod +x ergo && mv ergo /usr/local/bin/ergo

Usage

Usage:
  ergo [flags]
  ergo [command]

Available Commands:
  deploy      Deploy base branch to target branches
  draft       Create a draft release [github]
  help        Help about any command
  status      the status of branches compared to base branch
  tag         Create a tag on branch
  version     the version of ergo

Flags:
      --base string       Base branch for the comparison.
      --branches string   Comma separated list of branches
  -h, --help              help for ergo
      --owner string
      --path string       Location to store or retrieve from the repo (default ".")
      --repo string

CLI commands

Status

Getting the status of remote repo branches compared to a base branch.

ergo status \
--owner dbaltas \
--repo ergo \
--base master \
--branches stable,testsuite/baseNew,testsuite/base,testsuite/featureA,testsuite/featureB,testsuite/featureC

ergo sample output

Draft

Create a draft release having description of the commit diff. It will try to increment the last found tag version.

ergo draft \
--owner dbaltas \
--repo ergo \
--base master \
--branches release-gr,release-it
Deploy

Push the release tag into the release branches (and update the release body accordingly). You need to have published the draft release first.

ergo deploy \
--owner dbaltas \
--repo ergo \
--releaseInterval 15m \
--branches release-pe,release-mx,release-co,release-cl,release-gr
Deploy with custom intervals

If you don't want a linear release interval, for example you want more time between the first and second deployment, you can specify multiple release intervals.

ergo deploy \
--owner dbaltas \
--repo ergo \
--releaseInterval 15m,5m,5m,5m \
--branches release-pe,release-mx,release-co,release-cl,release-gr

Each release will add the next interval, and starts reading the list from the beginning in case releaseInterval list is shorter than the number of branches.

Branch      Start Time
release-pe  12:59 CEST
release-mx  13:14 CEST
release-co  13:19 CEST
release-cl  13:24 CEST
release-gr  13:29 CEST
Deployment? [y/N]:

Github Access

To communicate with github you will need a personal access token added on the configuration file as access-token on github

Configuration

Configuration is read from $HOME/.ergo.yaml

You have to use this in order to:

  • Add your github access token
  • Provide ergo with defaults. In the CLI commands you may skip some of the parameters in case that there are defaults values set.
  • Information about the draft release body and what will change at the time of the release.

Sample config file

Release Ergo

In order to release a new version of Ergo, execute the following steps:

  1. Create a new release and publish it
  2. Execute
make release
  1. Edit the created release and add the content of the dist folder
  2. Point the README download URL to the latest version

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI interface {
	PrintTable(header []string, values [][]string)
	PrintColorizedLine(title, content string, level MessageLevel)
	PrintLine(content ...interface{})
	Confirmation(actionText, cancellationMessage, successMessage string) (bool, error)
	Input() (string, error)
}

CLI describes the command line interface actions.

type Commit

type Commit struct {
	Message string
}

Commit describes the commit entity.

type Deploy

type Deploy interface {
	Do(ctx context.Context, releaseIntervalInput, releaseOffsetInput string, allowForcePush bool) error
}

Deploy describes the deploy process.

type Draft

type Draft interface {
	Create(ctx context.Context, releaseName, tagName string, skipConfirm bool) error
}

Draft describes the draft process.

type Host

type Host interface {
	CreateDraftRelease(ctx context.Context, name, tagName, releaseBody, targetBranch string) error
	LastRelease(ctx context.Context) (*Release, error)
	EditRelease(ctx context.Context, release *Release) (*Release, error)
	PublishRelease(ctx context.Context, releaseID int64) error
	CompareBranch(ctx context.Context, baseBranch, branch string) (*StatusReport, error)
	DiffCommits(ctx context.Context, releaseBranches []string, baseBranch string) ([]*StatusReport, error)
	CreateTag(ctx context.Context, versionName, sha, m string) (*Tag, error)
	UpdateBranchFromTag(ctx context.Context, tag, toBranch string, force bool) error
	GetRef(ctx context.Context, branch string) (*Reference, error)
	GetRefFromTag(ctx context.Context, tag string) (*Reference, error)
	GetRepoName() string
}

Host interface describes the host's actions.

type MessageLevel

type MessageLevel string

MessageLevel defines the level of output message.

type Reference

type Reference struct {
	SHA string
	Ref string
}

Reference describes the reference entity.

type Release

type Release struct {
	ID         int64
	Body       string
	TagName    string
	ReleaseURL string
	Draft      bool
}

Release struct contains all the fields which describe the release entity.

type StatusReport

type StatusReport struct {
	Branch     string
	BaseBranch string
	Ahead      []*Commit
	Behind     []*Commit
}

StatusReport struct is responsible to keep the information about current status.

type Tag

type Tag struct {
	Name string
}

Tag describes the tag entity.

type Time added in v0.7.1

type Time interface {
	Sleep(duration time.Duration)
	Now() time.Time
}

Time describes actions around time and waiting.

type Version

type Version struct {
	Name string
	SHA  string
}

Version describe the version entity.

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL