scripts

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ScriptURLHandler is the name of the script URL handler
	ScriptURLHandler = "script URL handler"

	// ImageURLHandler is the name of the image URL handler
	ImageURLHandler = "image URL handler"

	// SourceHandler is the name of the source script handler
	SourceHandler = "source handler"
)

Variables

This section is empty.

Functions

func ConvertEnvironment

func ConvertEnvironment(env []Environment) (result []string)

ConvertEnvironment converts the []Environment to "key=val" strings

func ConvertEnvironmentToDocker

func ConvertEnvironmentToDocker(env []Environment) (result string)

ConvertEnvironmentToDocker converts the []Environment into Dockerfile format

func NewHTTPReader

func NewHTTPReader(proxyConfig *api.ProxyConfig) schemeReader

NewHTTPReader creates an instance of the HttpURLReader

Types

type DefaultScriptSourceManager added in v1.1.2

type DefaultScriptSourceManager struct {
	Image      string
	ScriptsURL string
	// contains filtered or unexported fields
}

DefaultScriptSourceManager manages the default script lookup and installation for source-to-image.

func (*DefaultScriptSourceManager) Add added in v1.1.2

Add registers a new script source handler.

func (*DefaultScriptSourceManager) InstallOptional added in v1.1.2

func (i *DefaultScriptSourceManager) InstallOptional(scripts []string, dstDir string) []api.InstallResult

InstallOptional downloads and installs a set of scripts into dstDir, the result is a map of scripts with detailed information about each of the scripts install process

func (*DefaultScriptSourceManager) InstallRequired added in v1.1.2

func (i *DefaultScriptSourceManager) InstallRequired(scripts []string, dstDir string) ([]api.InstallResult, error)

InstallRequired Downloads and installs required scripts into dstDir, the result is a map of scripts with detailed information about each of the scripts install process with error if installing some of them failed

type Downloader

type Downloader interface {
	Download(url *url.URL, target string) (*api.SourceInfo, error)
}

Downloader downloads the specified URL to the target file location

func NewDownloader

func NewDownloader(proxyConfig *api.ProxyConfig) Downloader

NewDownloader creates an instance of the default Downloader implementation

type Environment

type Environment struct {
	Name  string
	Value string
}

Environment represents a single environment variable definition

func GetEnvironment

func GetEnvironment(config *api.Config) ([]Environment, error)

GetEnvironment gets the .s2i/environment file located in the sources and parse it into []environment

type FileURLReader

type FileURLReader struct{}

FileURLReader opens a specified file and returns its stream

func (*FileURLReader) Read

func (*FileURLReader) Read(url *url.URL) (io.ReadCloser, error)

Read produces an io.Reader from a file URL

type HttpURLReader

type HttpURLReader struct {
	Get func(url string) (*http.Response, error)
}

HttpURLReader retrieves a response from a given http(s) URL

func (*HttpURLReader) Read

func (h *HttpURLReader) Read(url *url.URL) (io.ReadCloser, error)

Read produces an io.Reader from an http(s) URL.

type ImageReader

type ImageReader struct{}

ImageReader just returns information the URL is from inside the image

func (*ImageReader) Read

func (*ImageReader) Read(url *url.URL) (io.ReadCloser, error)

Read throws Not implemented error

type Installer

type Installer interface {
	InstallRequired(scripts []string, dstDir string) ([]api.InstallResult, error)
	InstallOptional(scripts []string, dstDir string) []api.InstallResult
}

Installer interface is responsible for installing scripts needed to run the build.

func NewInstaller

func NewInstaller(image string, scriptsURL string, proxyConfig *api.ProxyConfig, docker docker.Docker, auth dockerClient.AuthConfiguration) Installer

NewInstaller returns a new instance of the default Installer implementation

type ScriptHandler added in v1.1.2

type ScriptHandler interface {
	Get(script string) *api.InstallResult
	Install(*api.InstallResult) error
	SetDestinationDir(string)
	String() string
}

ScriptHandler provides an interface for various scripts source handlers.

type ScriptSourceManager added in v1.1.2

type ScriptSourceManager interface {
	Add(ScriptHandler)
	SetDownloader(Downloader)
	Installer
}

ScriptSourceManager manages various script handlers.

type SourceScriptHandler added in v1.1.2

type SourceScriptHandler struct {
	DestinationDir string
	// contains filtered or unexported fields
}

SourceScriptHandler handles the case when the scripts are contained in the source code directory.

func (*SourceScriptHandler) Get added in v1.1.2

func (s *SourceScriptHandler) Get(script string) *api.InstallResult

Get verifies if the script is present in the source directory and get the installation result.

func (*SourceScriptHandler) Install added in v1.1.2

func (s *SourceScriptHandler) Install(r *api.InstallResult) error

Install copies the script into upload directory and fix its permissions.

func (*SourceScriptHandler) SetDestinationDir added in v1.1.2

func (s *SourceScriptHandler) SetDestinationDir(baseDir string)

SetDestinationDir sets the directory where the scripts should be uploaded. In case of SourceScriptHandler this is a source directory root.

func (*SourceScriptHandler) String added in v1.1.2

func (s *SourceScriptHandler) String() string

String implements the String() function.

type URLScriptHandler added in v1.1.6

type URLScriptHandler struct {
	URL            string
	DestinationDir string
	// contains filtered or unexported fields
}

URLScriptHandler handles script download using URL.

func (*URLScriptHandler) Get added in v1.1.6

func (s *URLScriptHandler) Get(script string) *api.InstallResult

Get parses the provided URL and the script name.

func (*URLScriptHandler) Install added in v1.1.6

func (s *URLScriptHandler) Install(r *api.InstallResult) error

Install downloads the script and fix its permissions.

func (*URLScriptHandler) SetDestinationDir added in v1.1.6

func (s *URLScriptHandler) SetDestinationDir(baseDir string)

SetDestinationDir sets the destination where the scripts should be downloaded.

func (*URLScriptHandler) String added in v1.1.6

func (s *URLScriptHandler) String() string

String implements the String() function.

Jump to

Keyboard shortcuts

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