trigr

package module
v0.0.0-...-8d81e62 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 3 Imported by: 0

README

=====
trigr
=====

.. image:: https://c1.staticflickr.com/1/246/449673647_4d9a1b900e.jpg


Who needs another automation server?
------------------------------------

TLDR: What if there was a automation server that was distributed? Moving from central source control from csv / svn to git / mecurial.

Waiting for remote build fails suck! It would be nice to use the extra resources sitting on the average developer machine to automatically compile, test and package applications while sitting in a meeting or at lunch. Trigr is mainly an event dispatch system. File changes, commits ect. The goal is to be able to run code based on a set of events. The curated DSL and API should make build and deploy scripting easier. If the built in extensions / DSL is used it should work the same on a local development machine as a remote build server.

Add automation project
----------------------

When first starting the server there is not configuration. This will produce a message. However it is easy to add a project with a simple curl command. 
.. code-bloack:: bash

   curl "http://localhost:8080/project/new?id=trigr&path=/my_home/lhj/my_codes_path/trigr"

To save the project in the configuration file add a persist flag to the end of the url.

.. code-bloack:: bash

   curl "http://localhost:8080/project/new?id=trigr&path=/my_home/lhj/my_code_paths/trigr&persist=true"

To watch the output of the automation use the trigr command line tool.

.. code-bloack:: bash
   ./build/darwin/trigr trigr -tlog
  
   connecting to ws://localhost:8080/ws/trigr
   51935-10-13 23:07:02 -0800 PST ➜ running: go test -cover
   2019-12-19 07:03:20 -0800 PST ➜ PASS
   coverage: 13.1% of statements
   ok      github.com/lateefj/trigr/cmd/trigd      0.611s

This will continue to stream changes to standard out.


Features (TODO)
---------------

* Decentralized: able to run on a development system (laptop) or build server
* Automated Configuration: getting software packaged for use is often a Rube Goldberg process that is only made worse by user interfaces 
* Modern Interface: a web ui not for configuration but for monitoring builds 


Development Process
-------------------

trigr assumes a development process that is a series of connected pipelines configuration, prepare, build, package and deploy. 

* configuration

  * code checkout
  * dependencies
* prepare

  * code generation
* build

  * compile
  * obscure (javascript)
* package

  * tar, compression 
  * encryption
  * distribution
  * docker
* deploy


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Name    string   `json:"name"`
	Project *Project `json:"branch"`
}

Branch

type Build

type Build struct {
	Id     string  `json:"id"`
	Commit *Commit `json:"commit"`
}

Build

type Commit

type Commit struct {
	Hash   string  `json:"hash"`
	Branch *Branch `json:"branch"`
}

Commit

type LocalSource

type LocalSource struct {
	Type SourceType `json:"type"`
	Path string     `json:"path"`
}

type Log

type Log struct {
	Timestamp int64  `json:"timestamp"`
	Text      string `json:"text"`
}

func NewLog

func NewLog(text string) *Log

func (*Log) Marshal

func (l *Log) Marshal() ([]byte, error)

type Pipeline

type Pipeline struct {
	Configuration map[string]Process
	Prepare       map[string]Process
	Build         map[string]Process
	Package       map[string]Process
	Deploy        map[string]Process
	Running       []Process
}

Pipeline represents the entire development process

func NewPipeline

func NewPipeline() *Pipeline

type Process

type Process struct {
	Name string
}

Process represents a step in the entire pipeline

type Project

type Project struct {
	Id           string        `json:"id"`                      // Project name
	LocalSource  *LocalSource  `json:"local_source,omitempty"`  // Local source project configuration
	RemoteSource *RemoteSource `json:"remote_source,omitempty"` // Remote source project configuration
	Triggers     chan *Trigger `json:"-"`
	Logs         chan *Log     `json:"-"` // Stream of output
}

Project

func NewProject

func NewProject(id string) *Project

func (*Project) AssignLocalSource

func (p *Project) AssignLocalSource(t SourceType, path string)

func (*Project) AssignRemoteSource

func (p *Project) AssignRemoteSource(t SourceType, url string)

type RemoteSource

type RemoteSource struct {
	Type SourceType `json:"type"`
	Url  string     `json:"url"`
}

type Source

type Source struct {
}

type SourceType

type SourceType int
const (
	LogBufferSize = 10

	Directory SourceType = 1 << iota
	Git
	Mercurial
)

type Trigger

type Trigger struct {
	Timestamp int64                  `json:"timestamp"` // Timestamp
	Type      string                 `json:"type"`      // Type of trigger event
	Data      map[string]interface{} `json:"data"`      // Additional data associated
	Logs      chan *Log              `json:"-"`
	Context   context.Context        `json:"-"`
}

func NewTrigger

func NewTrigger(t string, data map[string]interface{}) *Trigger

func (*Trigger) Marshal

func (t *Trigger) Marshal() ([]byte, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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