builder

package
v0.0.0-...-81c0a96 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBuildContext

func CreateBuildContext(step ManifestStep) (io.ReadCloser, error)

CreateBuildContext will create the Docker build context from the current directory, based on the manifest configuration.

func CreatePushRegistryAuth

func CreatePushRegistryAuth(manifest Manifest, imageName string) (string, error)

CreatePushRegistryAuth will create the auth registry string required by the push image configuration.

func Display

func Display(manifest Manifest, title string)

func FirebasePathFromUrl

func FirebasePathFromUrl(urlString string) string

func GetArtifactObjectName

func GetArtifactObjectName(artifact Artifact) string

func GetBuildDirectory

func GetBuildDirectory(step ManifestStep) string

func GetLocalArtifactTarget

func GetLocalArtifactTarget(step ManifestStep, artifact Artifact) string

func ImageNameForDisplay

func ImageNameForDisplay(step ManifestStep) string

func ReadDockerResponse

func ReadDockerResponse(responseBody io.ReadCloser, output io.Writer) error

ReadDockerResponse will read a display to the UI the responses coming from the docker daemon.

Types

type ArchiveSourceConfiguration

type ArchiveSourceConfiguration struct {
	Url     string            `json:"url"`
	Headers map[string]string `json:"headers"`
}

type Artifact

type Artifact struct {
	Name       string `json:"name"`
	Identifier string `json:"identifier"`
	Path       string `json:"path"`
	Persistent bool   `json:"persistent"`
}

Artifact is something that will be shared across steps or builds

type ArtifactManager

type ArtifactManager interface {
	ReadTo(artifact Artifact, destination string) error
	WriteFrom(artifact Artifact, reader io.ReadCloser) error
	Remove(artifact Artifact) error
}

type ArtifactsConfiguration

type ArtifactsConfiguration struct {
	BucketName     string                      `json:"bucket_name"`
	ServiceAccount ServiceAccountConfiguration `json:"service_account"`
}

type BuildRunner

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

BuildRunner is a step runner

func NewBuildRunner

func NewBuildRunner(stepRunner StepRunner) BuildRunner

func (BuildRunner) Run

func (r BuildRunner) Run(manifest Manifest) error

type CredentialsAwareImageBuilder

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

func (*CredentialsAwareImageBuilder) Build

func (nib *CredentialsAwareImageBuilder) Build(buildContext io.Reader, options types.ImageBuildOptions, output io.Writer) error

type DockerImageBuilder

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

DockerImageBuilder is an implementation of ImageBuilder using the docker client

func (*DockerImageBuilder) Build

func (dib *DockerImageBuilder) Build(buildContext io.Reader, options types.ImageBuildOptions, output io.Writer) error

type DockerImagePush

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

DockerImagePush is an implementation of ImagePusher using the docker client

func (*DockerImagePush) Push

func (dip *DockerImagePush) Push(imageName string, authConfig string, output io.Writer) error

type DockerStepRunner

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

DockerStepRunner is a step runner based on the docker client

func NewDockerStepRunner

func NewDockerStepRunner(client *client.Client, artifactManager ArtifactManager) (*DockerStepRunner, error)

DockerStepRunner creates an instance of DockerStepRunner

func (DockerStepRunner) BuildImage

func (sr DockerStepRunner) BuildImage(manifest Manifest, step ManifestStep, output io.Writer) (string, error)

func (*DockerStepRunner) Check

func (sr *DockerStepRunner) Check() error

func (*DockerStepRunner) CleanUpReadArtifacts

func (sr *DockerStepRunner) CleanUpReadArtifacts(step ManifestStep) error

func (*DockerStepRunner) CleanUpWroteArtifacts

func (sr *DockerStepRunner) CleanUpWroteArtifacts(step ManifestStep) error

func (DockerStepRunner) PushImage

func (sr DockerStepRunner) PushImage(manifest Manifest, step ManifestStep, output io.Writer) error

func (DockerStepRunner) ReadArtifact

func (sr DockerStepRunner) ReadArtifact(step ManifestStep, artifact Artifact) error

func (DockerStepRunner) WriteArtifact

func (sr DockerStepRunner) WriteArtifact(step ManifestStep, builtImage string, artifact Artifact) error

type FirebaseLoggedStepRunner

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

func NewFirebaseLoggedStepRunner

func NewFirebaseLoggedStepRunner(stepRunner StepRunner, loggingConfiguration FirebaseLoggingConfiguration) (*FirebaseLoggedStepRunner, error)

func (FirebaseLoggedStepRunner) BuildImage

func (r FirebaseLoggedStepRunner) BuildImage(manifest Manifest, step ManifestStep, output io.Writer) (string, error)

func (FirebaseLoggedStepRunner) Check

func (r FirebaseLoggedStepRunner) Check() error

func (FirebaseLoggedStepRunner) CleanUpReadArtifacts

func (r FirebaseLoggedStepRunner) CleanUpReadArtifacts(step ManifestStep) error

func (FirebaseLoggedStepRunner) CleanUpWroteArtifacts

func (r FirebaseLoggedStepRunner) CleanUpWroteArtifacts(step ManifestStep) error

func (FirebaseLoggedStepRunner) PushImage

func (r FirebaseLoggedStepRunner) PushImage(manifest Manifest, step ManifestStep, output io.Writer) error

func (FirebaseLoggedStepRunner) ReadArtifact

func (r FirebaseLoggedStepRunner) ReadArtifact(step ManifestStep, artifact Artifact) error

func (FirebaseLoggedStepRunner) WriteArtifact

func (r FirebaseLoggedStepRunner) WriteArtifact(step ManifestStep, builtImage string, artifact Artifact) error

type FirebaseLoggingConfiguration

type FirebaseLoggingConfiguration struct {
	DatabaseUrl    string                      `json:"database_url"`
	ServiceAccount ServiceAccountConfiguration `json:"service_account"`
	ParentLog      string                      `json:"parent_log"`
}

type FirebaseRawChildrenWriter

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

func NewFirebaseRawChildrenWriter

func NewFirebaseRawChildrenWriter(firebaseClient *firego.Firebase) FirebaseRawChildrenWriter

func (FirebaseRawChildrenWriter) Write

func (w FirebaseRawChildrenWriter) Write(p []byte) (n int, err error)

type GoogleCloudStorageArtifactManager

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

func NewGoogleCloudStorageArtifactManager

func NewGoogleCloudStorageArtifactManager(storageClient *storage.Client, bucketName string) GoogleCloudStorageArtifactManager

func (GoogleCloudStorageArtifactManager) ReadTo

func (m GoogleCloudStorageArtifactManager) ReadTo(artifact Artifact, destination string) error

func (GoogleCloudStorageArtifactManager) Remove

func (GoogleCloudStorageArtifactManager) WriteFrom

func (m GoogleCloudStorageArtifactManager) WriteFrom(artifact Artifact, reader io.ReadCloser) error

type ImageBuilder

type ImageBuilder interface {
	Build(buildContext io.Reader, options types.ImageBuildOptions, output io.Writer) error
}

Image builder will build the image

type ImagePusher

type ImagePusher interface {
	Push(imageName string, authConfig string, output io.Writer) error
}

ImagePusher allow to push the image

type Manifest

type Manifest struct {
	AuthConfigs map[string]types.AuthConfig `json:"auth_configs"`
	LogBoundary string                      `json:"log_boundary"`
	Steps       []ManifestStep              `json:"steps"`

	ArtifactsConfiguration       ArtifactsConfiguration       `json:"artifacts_configuration"`
	FirebaseLoggingConfiguration FirebaseLoggingConfiguration `json:"firebase_logging_configuration"`
	BuildCompleteEndpoint        string                       `json:"build_complete_endpoint"`
}

Manifest represents the manifest file used to configure the build

func ReadManifest

func ReadManifest(manifestFilePath string) (Manifest, error)

ReadManifest reads the manifest from a file

type ManifestStep

type ManifestStep struct {
	Number         int
	ImageName      string                     `json:"image_name"`
	DockerfilePath string                     `json:"docker_file_path"`
	BuildDirectory string                     `json:"build_directory"`
	BuildArgs      map[string]string          `json:"build_args"`
	WriteArtifacts []Artifact                 `json:"write_artifacts"`
	ReadArtifacts  []Artifact                 `json:"read_artifacts"`
	ArchiveSource  ArchiveSourceConfiguration `json:"archive_source"`
}

ManifestStep is a step in the manifest

type RetryImageBuilder

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

func (*RetryImageBuilder) Build

func (rib *RetryImageBuilder) Build(buildContext io.Reader, options types.ImageBuildOptions, output io.Writer) error

type RetryImagePusher

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

func (*RetryImagePusher) Push

func (rip *RetryImagePusher) Push(imageName string, authConfig string, output io.Writer) error

type ServiceAccountConfiguration

type ServiceAccountConfiguration struct {
	Type       string `json:"type"`
	Email      string `json:"client_email"`
	PrivateKey string `json:"private_key"`
	ProjectId  string `json:"project_id"`
}

type StepRunner

type StepRunner interface {
	ReadArtifact(step ManifestStep, artifact Artifact) error
	WriteArtifact(step ManifestStep, builtImage string, artifact Artifact) error
	BuildImage(manifest Manifest, step ManifestStep, output io.Writer) (string, error)
	PushImage(manifest Manifest, step ManifestStep, output io.Writer) error

	CleanUpWroteArtifacts(step ManifestStep) error
	CleanUpReadArtifacts(step ManifestStep) error

	Check() error
}

StepRunner is responsible of running a step

Jump to

Keyboard shortcuts

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