buildpack

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: AGPL-3.0 Imports: 20 Imported by: 1

README

Introduction

Buildpack is created in order to build up an independent and persistent environment for building and publishing application by using standard containers.

Buildpack executes your build as a series of build steps, where each build step is run in a Docker container. A build step can do anything that can be done from a container irrespective of the environment. To perform your tasks, you can either use the supported build steps provided by Buildpack or write your own build steps.

Install

For install it from source, following these steps:

$ git clone git@github.com:locngoxuan/buildpack.git

$ make dev && sudo make install

$ mkdir -p /etc/buildpack
$ mkdir -p /etc/buildpack/plugins
$ mkdir -p /etc/buildpack/plugins/builder
$ mkdir -p /etc/buildpack/plugins/publisher

Or download release then install:

$ wget 'https://github.com/locngoxuan/buildpack/releases/download/2.0.0/buildpack-2.0.0-1.el7.x86_64.rpm'

$ rpm -iUvh buildpack-2.0.0-1.el7.x86_64.rpm

Usage

  • Structure

At the beginning, buildpack loads structure of project from Buildpackfile. After understanding how many modules are there and which one is executed, it walk through them one by one for executing the build. If there are any module with same id, they will be executed in parallel.

For each module, Buildpackfile.build and Buildpackfile.publish are needed. They include information of builder and publisher tool that will be used for that module.

# mvn example
application/
├── module1/
├── src
├── pom.xml
├── Buildpackfile.build
├── Buildpackfile.publish
└── Buildpackfile

# mvn with parent pom example
application/
├── module1/
│   ├── src
│   ├── pom.xml
│   ├── Buildpackfile.build
│   └── Buildpackfile.publish
├── pom.xml
├── Buildpackfile.build
├── Buildpackfile.publish
└── Buildpackfile

# mix project mvn and nodejs
application/
├── module1/
│   ├── src
│   ├── pom.xml
│   ├── Buildpackfile.build
│   └── Buildpackfile.publish
├── module2/
│   ├── src
│   ├── index.js
│   ├── package.json
│   ├── Buildpackfile.build
│   └── Buildpackfile.publish
├── pom.xml
├── Buildpackfile.build
├── Buildpackfile.publish
└── Buildpackfile
  • Command
Usage: buildpack COMMAND [OPTIONS]
COMMAND:
  clean         Clean build folder		
  build         Run build and publish to repository
  version       Show version of buildpack
  help          Show usage

Examples:
  buildpack clean
  buildpack version
  buildpack build --dev-mode
  buildpack build --release
  buildpack build --path --skip-progress

Options:
  -config string
    	specific path to config file
  -dev-mode
    	enable local mode to disable container build
  -increase-version
    	force to increase version after build
  -log-dir string
    	log directory
  -module string
    	list of module
  -no-backward
    	if true, then major version will be increased
  -no-git-tag
    	skip tagging source code
  -patch
    	build for patching
  -release
    	build for releasing
  -share-data string
    	sharing directory
  -skip-clean
    	skip clean everything after build complete
  -skip-container
    	skip container build
  -skip-progress
    	use text plain instead of progress ui
  -skip-publish
    	skip publish build to repository
  -verbose
    	show more detail in console
  -version string
    	version number

Documentation

Index

Constants

View Source
const (
	BuildPackOutputDir = ".buildpack"
)
View Source
const (
	ConfigFileName = "Buildpackfile"
)

Variables

View Source
var Version = "2.0.0"

Functions

func CommandWithoutConfig

func CommandWithoutConfig(cmd string) bool

Types

type Arguments

type Arguments struct {
	Command         string
	Version         string
	Module          string
	ConfigFile      string
	ShareData       string
	LogDir          string
	BuildRelease    bool
	BuildPath       bool
	Verbose         bool
	DevMode         bool
	IncreaseVersion bool
	SkipOption
}

func ReadArguments

func ReadArguments() (arg Arguments, err error)

type BuildConfig

type BuildConfig struct {
	Version string         `yaml:"version,omitempty"`
	Git     *GitConfig     `yaml:"git,omitempty"`
	Docker  *DockerConfig  `yaml:"docker,omitempty"`
	Repos   []RepoConfig   `yaml:"repositories,omitempty"`
	Modules []ModuleConfig `yaml:"modules,omitempty"`
}

func ReadConfig

func ReadConfig(configFile string) (c BuildConfig, err error)

type BuildPack

type BuildPack struct {
	WorkDir string
	Arguments
	BuildConfig
}

func CreateBuildPack

func CreateBuildPack(arg Arguments, config BuildConfig) (bp BuildPack, err error)

func (*BuildPack) Exist

func (bp *BuildPack) Exist(ctx context.Context)

func (BuildPack) GetConfigFile

func (bp BuildPack) GetConfigFile() string

func (BuildPack) GetVersion

func (bp BuildPack) GetVersion() string

func (BuildPack) IsSkipClean

func (bp BuildPack) IsSkipClean() bool

func (BuildPack) IsSkipContainer

func (bp BuildPack) IsSkipContainer() bool

func (BuildPack) IsSkipGit

func (bp BuildPack) IsSkipGit() bool

func (BuildPack) IsSkipGitBraching

func (bp BuildPack) IsSkipGitBraching() bool

func (BuildPack) IsSkipPublish

func (bp BuildPack) IsSkipPublish() bool

func (*BuildPack) Run

func (bp *BuildPack) Run(ctx context.Context) error

type DockerConfig

type DockerConfig struct {
	Hosts []string `yaml:"hosts,omitempty"`
}

type GitConfig

type GitConfig struct {
	Username    string `yaml:"name,omitempty"`
	AccessToken string `yaml:"token,omitempty"`
	Email       string `yaml:"email,omitempty"`
}

type Module

type Module struct {
	Id   int
	Name string
	Path string
}

type ModuleConfig

type ModuleConfig struct {
	Id   int    `yaml:"id,omitempty"`
	Name string `yaml:"name,omitempty"`
	Path string `yaml:"path,omitempty"`
}

type Progress

type Progress struct {
	Pool  *pb.Pool
	Wait  *sync.WaitGroup
	Steps []string

	ProgressFunc
	Trackers []*Tracker
	// contains filtered or unexported fields
}

type ProgressFunc

type ProgressFunc func(t *Tracker, steps []string)

type RepoChannelConfig

type RepoChannelConfig struct {
	NoAuth   bool   `yaml:"no_auth,omitempty"`
	Address  string `yaml:"address,omitempty"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
}

type RepoConfig

type RepoConfig struct {
	Name     string             `yaml:"name,omitempty"`
	Stable   *RepoChannelConfig `yaml:"stable,omitempty"`
	Unstable *RepoChannelConfig `yaml:"unstable,omitempty"`
}

type Result

type Result struct {
	Result      string
	Message     string
	TimeElapsed time.Duration
	LogFile     string
}

type RunModuleOption

type RunModuleOption struct {
	Module
	*Tracker
	*Progress
	// contains filtered or unexported fields
}

type SkipOption

type SkipOption struct {
	SkipContainer   bool
	SkipPublish     bool
	SkipClean       bool
	SkipProgressBar bool

	NoGitTag   bool
	NoBackward bool
}

type SortedById

type SortedById []Module

func (SortedById) Len

func (a SortedById) Len() int

func (SortedById) Less

func (a SortedById) Less(i, j int) bool

func (SortedById) Swap

func (a SortedById) Swap(i, j int)

type Tracker

type Tracker struct {
	Name   string
	Signal chan int
	Bar    *pb.ProgressBar

	Result
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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