All Projects β†’ myntra β†’ Pipeline

myntra / Pipeline

Licence: mit
Pipeline is a package to build multi-staged concurrent workflows with a centralized logging output.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Pipeline

Nevergreen
🐀 A build monitor with attitude
Stars: ✭ 170 (-60.74%)
Mutual labels:  ci, jenkins, ci-cd
Jenkins Pipeline Library
wcm.io Jenkins Pipeline Library for CI/CD
Stars: ✭ 134 (-69.05%)
Mutual labels:  pipeline, jenkins, ci-cd
Jenkins Workflow
contains handy groovy workflow-libs scripts
Stars: ✭ 41 (-90.53%)
Mutual labels:  pipeline, workflow, jenkins
Pypyr
pypyr task-runner cli & api for automation pipelines. Automate anything by combining commands, different scripts in different languages & applications into one pipeline process.
Stars: ✭ 173 (-60.05%)
Mutual labels:  pipeline, ci, ci-cd
Ccmenu
CCMenu is a Mac application to monitor continuous integration servers.
Stars: ✭ 306 (-29.33%)
Mutual labels:  ci, jenkins, ci-cd
flow-platform-x
Continuous Integration Platform
Stars: ✭ 21 (-95.15%)
Mutual labels:  pipeline, ci, ci-cd
solutions-terraform-jenkins-gitops
Demonstrates the use of Jenkins and Terraform to manage Infrastructure as Code using GitOps practices
Stars: ✭ 49 (-88.68%)
Mutual labels:  jenkins, ci-cd
CIAnalyzer
A tool collecting multi CI services build data and export it for creating self-hosting build dashboard.
Stars: ✭ 52 (-87.99%)
Mutual labels:  jenkins, ci
DNAscan
DNAscan is a fast and efficient bioinformatics pipeline that allows for the analysis of DNA Next Generation sequencing data, requiring very little computational effort and memory usage.
Stars: ✭ 36 (-91.69%)
Mutual labels:  workflow, pipeline
cli-property-manager
Use this Property Manager CLI to automate Akamai property changes and deployments across many environments.
Stars: ✭ 22 (-94.92%)
Mutual labels:  workflow, pipeline
jt tools
Ruby on Rails Continuous Deployment Ecosystem to maintain Healthy Stable Development
Stars: ✭ 13 (-97%)
Mutual labels:  ci, ci-cd
pipeline-as-code-with-jenkins
Pipeline as Code with Jenkins
Stars: ✭ 56 (-87.07%)
Mutual labels:  jenkins, pipeline
Nvwa Io
Nvwa-io is a open source DevOps CI/CD auto-build and auto-deploy system(ε₯³ε¨² - 开源 DevOps CI/CD θ‡ͺεŠ¨ζž„ε»Ίε’Œθ‡ͺεŠ¨ιƒ¨η½²η³»η»Ÿ). http://nvwa-io.com
Stars: ✭ 283 (-34.64%)
Mutual labels:  ci, jenkins
check-in
Checks your test results metadata into github, commit-bound. Acts as a bot. You'll need a GitHub App to use it.
Stars: ✭ 18 (-95.84%)
Mutual labels:  ci, ci-cd
tip
GitHub Action to keep a 'tip' pre-release always up-to-date
Stars: ✭ 18 (-95.84%)
Mutual labels:  workflow, ci
ci-notice
😱 Notify you when CI fails.
Stars: ✭ 25 (-94.23%)
Mutual labels:  workflow, ci
bistro
A library to build and execute typed scientific workflows
Stars: ✭ 43 (-90.07%)
Mutual labels:  workflow, pipeline
Android-CICD
This repo demonstrates how to work on CI/CD for Mobile Apps πŸ“± using Github Actions πŸ’Š + Firebase Distribution πŸŽ‰
Stars: ✭ 37 (-91.45%)
Mutual labels:  ci, ci-cd
Rnaseq
RNA sequencing analysis pipeline using STAR, RSEM, HISAT2 or Salmon with gene/isoform counts and extensive quality control.
Stars: ✭ 305 (-29.56%)
Mutual labels:  pipeline, workflow
Devops Guide
DevOps Guide - Development to Production all configurations with basic notes to debug efficiently.
Stars: ✭ 4,119 (+851.27%)
Mutual labels:  jenkins, ci-cd

Pipeline

A package to build multi-staged concurrent workflows with a centralized logging output.


The package could be used to define and execute CI/CD tasks(either sequential or concurrent). A tool with similar goals would be Jenkins Pipeline. However, compared to Jenkins Pipeline, this package has fewer constructs since the logic is specified in code, as opposed to a Jenkinsfile.

It's tiny by design and is valuable when used as a glue rather than a container.

go get

$ go get gopkg.in/myntra/pipeline.v1

Concepts

The package has three building blocks to create workflows : Pipeline, Stage and Step . A pipeline is a collection of stages and a stage is a collection of steps. A stage can have either concurrent or sequential steps, while stages are always sequential.

Pipeline

The step block is where the actual work is done. Stage and pipeline act as flow governors.

The Step Interface

Step is the unit of work which can be concurrently or sequentially staged with other steps. To do that, we need to implement the Step interface.

type Step interface {
	Out
	Exec(*Request) *Result
	Cancel() error
}

To satisfy the interface we need to embed pipeline.StepContext and implement Exec(*Request)*Result, Cancel()error methods in the target type. For e.g:

type work struct {
	pipeline.StepContext
}

func (w work) Exec(request *pipeline.Request) *pipeline.Result {
	return &pipeline.Result{}
}

func (w work) Cancel() error {
	return nil
}

The pipeline.StepContext type provides a Status method which can be used to log to the out channel. The current step receives a Request value passed on by the previous step. Internally data(Request.Data and Request.KeyVal) is copied from the previous step's Result.

Usage

The api NewStage(name string, concurrent bool, disableStrictMode bool) is used to stage work either sequentially or concurrently. In terms of the pipeline package, a unit of work is an interface: Step.

The following example shows a sequential stage. For a more complex example, please see: examples/advanced.go

package main

import (
	"fmt"
	"time"

	"github.com/myntra/pipeline"
)

type work struct {
	pipeline.StepContext
	id int
}

func (w work) Exec(request *pipeline.Request) *pipeline.Result {
	w.Status(fmt.Sprintf("%+v", request))

	duration := time.Duration(1000 * w.id)
	time.Sleep(time.Millisecond * duration)
	msg := fmt.Sprintf("work %d", w.id)

	return &pipeline.Result{
		Error:  nil,
		Data:   struct{msg string}{msg:msg},
		KeyVal: map[string]interface{}{"msg": msg},
	}
}

func (w work) Cancel() error {
	w.Status("cancel step")
	return nil
}

func readPipeline(pipe *pipeline.Pipeline) {
	out, err := pipe.Out()
	if err != nil {
		return
	}

	progress, err := pipe.GetProgressPercent()
	if err != nil {
		return
	}

	for {
		select {
		case line := <-out:
			fmt.Println(line)
		case p := <-progress:
			fmt.Println("percent done: ", p)
		}
	}
}

func main() {
	// create a new pipeline
	workpipe := pipeline.NewProgress("myProgressworkpipe", 1000, time.Second*3)
	// func NewStage(name string, concurrent bool, disableStrictMode bool) *Stage
	// To execute steps concurrently, set concurrent=true.
	stage := pipeline.NewStage("mypworkstage", false, false)

	// a unit of work
	step1 := &work{id: 1}
	// another unit of work
	step2 := &work{id: 2}

	// add the steps to the stage. Since concurrent is set false above. The steps will be
	// executed one after the other.
	stage.AddStep(step1)
	stage.AddStep(step2)

	// add the stage to the pipe.
	workpipe.AddStage(stage)

	go readPipeline(workpipe)

	result := workpipe.Run()
	if result.Error != nil {
		fmt.Println(result.Error)
	}

	fmt.Println("timeTaken:", workpipe.GetDuration())
}

Check examples directory for more.

Logging and Progress

  • pipeline.Out() : Get all statuses/logs.
  • pipeline.Progress : Get progress in percentage.

Output of the above example:

Example Output

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].