cfapppush

package module
v0.0.0-...-10da5ee Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCM_TYPE_GITHUB = "github"
	SCM_TYPE_GITLAB = "gitlab"
)

Variables

This section is empty.

Functions

func EnvForDir

func EnvForDir(dir string, base []string) []string

func GetVCS

func GetVCS() *vcsCmd

Currently only git is supported

func Init

func Init(portalProxy api.PortalProxy) (api.StratosPlugin, error)

Init creates a new CFAppPush

func MergeEnvLists

func MergeEnvLists(in, out []string) []string

Types

type Applications

type Applications struct {
	Applications []RawManifestApplication `yaml:"applications"`
}

type CFAppPush

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

CFAppPush is a plugin to allow applications to be pushed to Cloud Foundry from Stratos

func (*CFAppPush) AddAdminGroupRoutes

func (cfAppPush *CFAppPush) AddAdminGroupRoutes(echoGroup *echo.Group)

AddAdminGroupRoutes adds the admin routes for this plugin to the Echo server

func (*CFAppPush) AddSessionGroupRoutes

func (cfAppPush *CFAppPush) AddSessionGroupRoutes(echoGroup *echo.Group)

AddSessionGroupRoutes adds the session routes for this plugin to the Echo server

func (*CFAppPush) GetEndpointPlugin

func (cfAppPush *CFAppPush) GetEndpointPlugin() (api.EndpointPlugin, error)

GetEndpointPlugin gets the endpoint plugin for this plugin

func (*CFAppPush) GetMiddlewarePlugin

func (cfAppPush *CFAppPush) GetMiddlewarePlugin() (api.MiddlewarePlugin, error)

GetMiddlewarePlugin gets the middleware plugin for this plugin

func (*CFAppPush) GetRoutePlugin

func (cfAppPush *CFAppPush) GetRoutePlugin() (api.RoutePlugin, error)

GetRoutePlugin gets the route plugin for this plugin

func (*CFAppPush) Init

func (cfAppPush *CFAppPush) Init() error

Init performs plugin initialization

func (*CFAppPush) SendEvent

func (cfAppPush *CFAppPush) SendEvent(clientWebSocket *websocket.Conn, event MessageType, data string)

SendEvent sends a message over the web socket

type CFPush

type CFPush interface {
	Init(appDir string, manifestPath string, overrides CFPushAppOverrides) error
	Run(DeployAppMessageSender, *websocket.Conn) error
}

CFPush Interface

func Constructor

func Constructor(config *CFPushAppConfig, portalProxy api.PortalProxy) CFPush

Constructor returns a CFPush based on the supplied config

type CFPushApp

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

CFPushApp abstracts the push functionality form the CLI library

func (*CFPushApp) Init

func (c *CFPushApp) Init(appDir string, manifestPath string, overrides CFPushAppOverrides) error

Init initializes the push operation with the specified application directory and manifest path

func (*CFPushApp) Run

func (c *CFPushApp) Run(msgSender DeployAppMessageSender, clientWebsocket *websocket.Conn) error

Run performs the actual push

type CFPushAppConfig

type CFPushAppConfig struct {
	AuthorizationEndpoint  string
	CFClient               string
	CFClientSecret         string
	APIEndpointURL         string
	DopplerLoggingEndpoint string
	SkipSSLValidation      bool
	CACert                 string
	AuthToken              string
	OrgGUID                string
	OrgName                string
	SpaceGUID              string
	SpaceName              string
	OutputWriter           io.Writer
	DialTimeout            string
	EndpointID             string
	UserID                 string
}

CFPushAppConfig is the configuration used

type CFPushAppOverrides

type CFPushAppOverrides struct {
	Name            string `json:"name"`
	Buildpack       string `json:"buildpack"`
	StartCmd        string `json:"startCmd"`
	HealthCheckType string `json:"healthCheckType"`
	Stack           string `json:"stack"`
	Time            *int   `json:"time"`
	Instances       *int   `json:"instances"`
	DiskQuota       string `json:"diskQuota"`
	MemQuota        string `json:"memQuota"`
	DoNotStart      bool   `json:"doNotStart"`
	NoRoute         bool   `json:"noRoute"`
	RandomRoute     bool   `json:"randomRoute"`
	Host            string `json:"host"`
	Domain          string `json:"domain"`
	Path            string `json:"path"`
	DockerImage     string `json:"dockerImage"`
	DockerUsername  string `json:"dockerUsername"`
}

CFPushAppOverrides represents the document that can be sent from the client with the app overrrides for the push

type CloneDetails

type CloneDetails struct {
	Url       string
	LoggerUrl string
	Branch    string
	Commit    string
	SkipSSL   bool
}

type DeployAppMessageSender

type DeployAppMessageSender interface {
	SendEvent(clientWebSocket *websocket.Conn, event MessageType, data string)
}

DeployAppMessageSender is the interface for sending a message over a web socket

type DeploySource

type DeploySource struct {
	SourceType string `json:"type"`
	Timestamp  int64  `json:"timestamp"`
}

type DockerImageSourceInfo

type DockerImageSourceInfo struct {
	DeploySource
	ApplicationName string `json:"applicationName"`
	DockerImage     string `json:"dockerImage"`
	DockerUsername  string `json:"dockerUsername"`
}

DockerImageSourceInfo - Structure used to provide metadata about the docker source

type ErrorType

type ErrorType int

ErrorType default error returned

const (
	// GeneralFailure thrown when initialisation fails
	GeneralFailure ErrorType = iota + 4000
	// FailedToPush thrown when push fails
	FailedToPush
)

type FolderSourceInfo

type FolderSourceInfo struct {
	DeploySource
	WaitAfterUpload bool     `json:"wait"`
	Files           int      `json:"files"`
	Folders         []string `json:"folders,omitempty"`
}

type GitSCMSourceInfo

type GitSCMSourceInfo struct {
	DeploySource
	Project      string `json:"project"`
	Branch       string `json:"branch"`
	URL          string `json:"url"`
	CommitHash   string `json:"commit"`
	SCM          string `json:"scm"`
	EndpointGUID string `json:"endpointGuid"` // credentials of which to use, e.g. of a private GitHub instance
	Username     string `json:"username"`     // GitLab username has to be supplied by the frontend
}

Structure used to provide metadata about the GitHub source

type GitUrlSourceInfo

type GitUrlSourceInfo struct {
	DeploySource
	Project    string `json:"project"` // Not sent from client
	Branch     string `json:"branch"`
	Url        string `json:"url"`
	CommitHash string `json:"commit"` // Not sent from client
}

Structure used to provide metadata about the Git Url source

type ManifestResponse

type ManifestResponse struct {
	Manifest string
}

type MessageType

type MessageType int
const (
	DATA MessageType = iota + 20000
	MANIFEST
	CLOSE_SUCCESS
	APP_GUID_NOTIFY
)

Success

const (
	CLOSE_PUSH_ERROR MessageType = iota + 40000
	CLOSE_NO_MANIFEST
	CLOSE_INVALID_MANIFEST
	CLOSE_FAILED_CLONE
	CLOSE_FAILED_NO_BRANCH
	CLOSE_FAILURE
	CLOSE_NO_SESSION
	CLOSE_NO_CNSI
	CLOSE_NO_CNSI_USERTOKEN
	CLOSE_ACK
)

Close - error cases

const (
	EVENT_CLONED MessageType = iota + 10000
	EVENT_FETCHED_MANIFEST
	EVENT_PUSH_STARTED
	EVENT_PUSH_COMPLETED
)

Events

const (
	SOURCE_REQUIRED MessageType = iota + 30000
	SOURCE_GITSCM
	SOURCE_FOLDER
	SOURCE_FILE
	SOURCE_FILE_DATA
	SOURCE_FILE_ACK
	SOURCE_GITURL
	SOURCE_WAIT_ACK
	SOURCE_DOCKER_IMG
)

Source exchange messages

const (
	OVERRIDES_REQUIRED MessageType = iota + 50000
	OVERRIDES_SUPPLIED
)

Application Overrides messages

type PushConnectionWrapper

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

PushConnectionWrapper can wrap a given connection allowing the wrapper to modify all requests going in and out of the given connection.

func (PushConnectionWrapper) Make

func (cw PushConnectionWrapper) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error

Make makes an HTTP request

func (PushConnectionWrapper) Wrap

Wrap an existing connection

type PushError

type PushError struct {
	Type ErrorType
	Err  error
	// contains filtered or unexported fields
}

PushError is the return error type from pushing

func (*PushError) Error

func (p *PushError) Error() string

type RawManifestApplication

type RawManifestApplication struct {
	Name                    string             `yaml:"name,omitempty"`
	Buildpack               string             `yaml:"buildpack,omitempty"`
	Buildpacks              []string           `yaml:"buildpacks,omitempty"`
	Command                 string             `yaml:"command,omitempty"`
	DeprecatedDomain        interface{}        `yaml:"domain,omitempty"`
	DeprecatedDomains       interface{}        `yaml:"domains,omitempty"`
	DeprecatedHost          interface{}        `yaml:"host,omitempty"`
	DeprecatedHosts         interface{}        `yaml:"hosts,omitempty"`
	DeprecatedNoHostname    interface{}        `yaml:"no-hostname,omitempty"`
	DiskQuota               string             `yaml:"disk_quota,omitempty"`
	Docker                  rawDockerInfo      `yaml:"docker,omitempty"`
	DropletPath             string             `yaml:"droplet-path,omitempty"`
	EnvironmentVariables    map[string]string  `yaml:"env,omitempty"`
	HealthCheckHTTPEndpoint string             `yaml:"health-check-http-endpoint,omitempty"`
	HealthCheckType         string             `yaml:"health-check-type,omitempty"`
	Instances               *int               `yaml:"instances,omitempty"`
	Memory                  string             `yaml:"memory,omitempty"`
	NoRoute                 bool               `yaml:"no-route,omitempty"`
	Path                    string             `yaml:"path,omitempty"`
	RandomRoute             bool               `yaml:"random-route,omitempty"`
	Routes                  []rawManifestRoute `yaml:"routes,omitempty"`
	Services                []string           `yaml:"services,omitempty"`
	StackName               string             `yaml:"stack,omitempty"`
	Timeout                 int                `yaml:"timeout,omitempty"`
}

Based on manifest.rawManifestApplicaiton

type SocketMessage

type SocketMessage struct {
	Message   string      `json:"message"`
	Timestamp int64       `json:"timestamp"`
	Type      MessageType `json:"type"`
}

type SocketWriter

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

func (*SocketWriter) Write

func (sw *SocketWriter) Write(data []byte) (int, error)

type StratosProject

type StratosProject struct {
	DeploySource    interface{} `json:"deploySource"`
	DeployOverrides interface{} `json:"deployOverrides"`
}

Jump to

Keyboard shortcuts

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