build

package
v0.0.0-...-60de6dc Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalCommand

func EvalCommand(name string, args ...string) []byte

EvalCommand executes the given command, waits till it finishes and returns the text that it writes to the standard output. If the execution of the command fails it returns nil.

func FindRegexpGroups

func FindRegexpGroups(line string, re *regexp.Regexp) map[string]string

FindRegexGroups checks if line matches the re regular expression. If it does match, then it returns a map containing the names of the groups as the keys and the text that matches each group as the values. If it doesn't match, then it returns nil.

func ProcessTemplate

func ProcessTemplate(project *Project, in string, out string) error

ProcessTemplate loads the input file, processes it as a template, and writes the result to the output file.

func ProcessTemplates

func ProcessTemplates(project *Project, inDir string, outDir string) error

ProcessTemplates scans all the files in the input directory, processes them as templates, and writes the result to the output directory.

func RunCommand

func RunCommand(name string, args ...string) error

RunCommand executes the given command and waits till it finishes. The standard output and standard error of the command are redirected to the standard output and standard error of the calling program.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context contains the objects passed to templates when they are evaluated.

type Dockerfile

type Dockerfile struct {
	// contains filtered or unexported fields
}

Dockerfile conatins the information extracted from o docker file.

func NewDockerfile

func NewDockerfile() *Dockerfile

NewDockerfile creates a new empty docker file.

func (*Dockerfile) From

func (d *Dockerfile) From() string

From finds the first FROM instruction within a Dockerfile. If that instruction exists then it returns its arguments. If it doesn't exist then it returns an empty string.

func (*Dockerfile) Instruction

func (d *Dockerfile) Instruction(name string) *DockerfileInstruction

Instruction finds the first instruction within the given Dockerfile that haves the given name. If there is no such instruction then it returns nil.

func (*Dockerfile) Load

func (d *Dockerfile) Load(path string) *Dockerfile

Load loads a docker file and builds a list of structures containing the instruction names and arguments.

type DockerfileInstruction

type DockerfileInstruction struct {
	// The name of the instruction.
	Name string

	// The arguments of the instruction.
	Args string
}

Instruction represents each of the instructions that form an Dockerfile.

type Image

type Image struct {
	// contains filtered or unexported fields
}

Image contains the description of an image, as well as methods to build it.

func NewImage

func NewImage(project *Project, name string) *Image

NewImage creates a new empty image with the given name and belonging to the given project.

func (*Image) Build

func (i *Image) Build() error

Build builds the given image.

func (*Image) Directory

func (i *Image) Directory() string

Directory returns the absolute path of the directory that contains the source files of the image.

func (*Image) Dockerfile

func (i *Image) Dockerfile() *Dockerfile

Dockerfile returns the object that describes the Dockerfile used by the image.

func (*Image) Load

func (i *Image) Load() error

Load loads the details of the image, including the content of the Dockerfile, if it exists.

func (*Image) Name

func (i *Image) Name() string

Name returns the name of the image.

func (*Image) Parent

func (i *Image) Parent() *Image

Parent returns the parent image.

func (*Image) Push

func (i *Image) Push() error

Push pushes the image to the docker registry.

func (*Image) Remove

func (i *Image) Remove() error

Remove removes the image from the local docker storage.

func (*Image) Save

func (i *Image) Save() error

Saves the image to a tar file.

func (*Image) String

func (i *Image) String() string

String returns a string representation of the image.

func (*Image) Tag

func (i *Image) Tag() string

Tag returns the tag of the image.

func (*Image) WorkingDirectory

func (i *Image) WorkingDirectory() string

WorkingDirectory returns the absolute path of the work directory for the image.

type Project

type Project struct {
	// contains filtered or unexported fields
}

Project contains the project configuration.

func LoadProject

func LoadProject(path string) (project *Project, err error)

LoadProject loads a project from the given path. If the path is empty then it will load the project from the 'project.conf' file inside the current working directory.

func (*Project) Close

func (p *Project) Close() error

Close releases all the resources used by the project, including the temporary directory used to store the results of processsing templates. Once the project is closed it can no longer be used.

func (*Project) Directory

func (p *Project) Directory() string

Directory returns the the absolute path of the root directory of the project.

func (*Project) Images

func (p *Project) Images() *ProjectImages

Images returns the information about the images that are part of the project.

func (*Project) Manifests

func (p *Project) Manifests() *ProjectManifests

Manifests returns the information about he OpenShift manifests that are part of the project.

func (*Project) Version

func (p *Project) Version() string

Version returns the version of the project.

func (*Project) WorkingDirectory

func (p *Project) WorkingDirectory() string

WorkingDirectory returns the absolute path of the working directory of the project.

type ProjectImages

type ProjectImages struct {
	// contains filtered or unexported fields
}

ProjectImages contains the information about the images that are part of the project.

func (*ProjectImages) Directory

func (pi *ProjectImages) Directory() string

Directory returns the absolute path of the directory containing the source files of the image specifications.

func (*ProjectImages) Index

func (pi *ProjectImages) Index() map[string]*Image

Index returns a map containing the images that are part of the project, indexed by name.

func (*ProjectImages) List

func (pi *ProjectImages) List() []*Image

List returns a slice containing the images that are part of the project, sorted in the right build order.

func (*ProjectImages) Prefix

func (pi *ProjectImages) Prefix() string

Prefix returns the prefix that should be used to tag the images of the project.

func (*ProjectImages) Registry

func (pi *ProjectImages) Registry() string

Registry returns the address of the Docker registry where images should be pushed to.

func (*ProjectImages) WorkingDirectory

func (pi *ProjectImages) WorkingDirectory() string

WorkingDirectory returns the absolute path of the working directory for the images of the project.

type ProjectManifests

type ProjectManifests struct {
	// contains filtered or unexported fields
}

ProjectManifests contains the information about the manifests that are part of the project.

func (*ProjectManifests) Directory

func (pm *ProjectManifests) Directory() string

Directory returns the absolute path of the directory containing the source files of the OpenShift manifests.

func (*ProjectManifests) WorkingDirectory

func (pm *ProjectManifests) WorkingDirectory() string

WorkingDirectory returns the absolute path of the working directory for the OpenShift manifests of the project.

Jump to

Keyboard shortcuts

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