cmd

package
v0.0.0-...-58f43b1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0 Imports: 43 Imported by: 2

Documentation

Overview

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 IBM Corporation and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const APIVersionV1 = "v1"
View Source
const ConfigFile = ".appsody-config.yaml"
View Source
const LatestVersionURL = "https://github.com/appsody/appsody/releases/latest"

Variables

View Source
var CONTROLLERVERSION string
View Source
var VERSION string

Functions

func AddLocalFileRepo

func AddLocalFileRepo(repoName string, repoFilePath string, config *RootCommandConfig) (string, error)

func ApplyTemplating

func ApplyTemplating(stackPath string, templateMetadata interface{}) error

ApplyTemplating - walks through the copied folder directory and applies a template using the previously created templateMetada to all files in the target directory

func ArgsToString

func ArgsToString(args []string) string

Converts an array of command arguments to a string of arguments properly escaped and quoted for copying and running in sh, bash, or zsh

func BuildahBuild

func BuildahBuild(config *RootCommandConfig, args []string, logger appsodylogger) error

func CheckPrereqs

func CheckPrereqs(config *RootCommandConfig) error

CheckPrereqs checks the prerequisites to run the CLI

func CheckStackRequirements

func CheckStackRequirements(log *LoggingConfig, requirementArray map[string]string, buildah bool) error

Compares the minimum requirements of a stack against the user to determine whether they can use the stack or not.

func CheckValidSemver

func CheckValidSemver(version string) error

func ConvertLabelToKubeFormat

func ConvertLabelToKubeFormat(key string) (string, error)

func ConvertToValidProjectName

func ConvertToValidProjectName(projectDir string) (string, error)

ConvertToValidProjectName takes an existing string or directory path and returns a name that conforms to isValidContainerName rules

func CopyDir

func CopyDir(log *LoggingConfig, fromDir string, toDir string) error

CopyDir Copies folder from source destination to target destination

func CopyFile

func CopyFile(log *LoggingConfig, source string, dest string) error

CopyFile uses OS commands to copy a file from a source to a destination

func CreateLabelPairs

func CreateLabelPairs(labels map[string]string) []string

func CreateTemplateMap

func CreateTemplateMap(labels map[string]string, stackYaml StackYaml, imageNamespace string, imageRegistry string) (map[string]interface{}, error)

CreateTemplateMap - uses the git labels, stack.yaml, stackID and imageNamespace to create a map with all the necessary data needed for the template

func DockerBuild

func DockerBuild(config *RootCommandConfig, args []string, logger appsodylogger) error

func DockerRunAndListen

func DockerRunAndListen(config *RootCommandConfig, args []string, logger appsodylogger, interactive bool) (*exec.Cmd, error)

DockerRunAndListen runs a Docker command with arguments in args This function does NOT override the image registry (uses args as is)

func DockerRunBashCmd

func DockerRunBashCmd(options []string, image string, bashCmd string, config *RootCommandConfig) (string, error)

DockerRunBashCmd issues a shell command in a docker image, overriding its entrypoint Assume this is only used for Stack images

func Execute

func Execute(version string, controllerVersion string)

func ExecuteE

func ExecuteE(version string, controllerVersion string, projectDir string, outWriter, errWriter io.Writer, args []string) error

func Exists

func Exists(path string) (bool, error)

Checks whether an inode (it does not bother about file or folder) exists or not.

func ExtractDockerEnvFile

func ExtractDockerEnvFile(envFileName string) (map[string]string, error)

ExtractDockerEnvFile returns a map with the env vars specified in docker env file

func ExtractDockerEnvVars

func ExtractDockerEnvVars(dockerOptions string) (map[string]string, error)

ExtractDockerEnvVars returns a map with the env vars specified in docker options

func GenDeploymentYaml

func GenDeploymentYaml(log *LoggingConfig, appName string, imageName string, controllerImageName string, ports []string, pdir string, dockerMounts []string, dockerEnvVars map[string]string, depsMount string, mode string, dryrun bool) (fileName string, err error)

GenDeploymentYaml generates a simple yaml for a plaing K8S deployment

func GenRouteYaml

func GenRouteYaml(log *LoggingConfig, appName string, pdir string, port int, dryrun bool) (fileName string, err error)

GenRouteYaml returns the file name of a generated K8S Service yaml

func GenServiceYaml

func GenServiceYaml(log *LoggingConfig, appName string, ports []string, pdir string, dryrun bool) (fileName string, err error)

GenServiceYaml returns the file name of a generated K8S Service yaml

func GenerateID

func GenerateID(log *LoggingConfig) string

create unique project id for .appsody-config.yaml

func GenerateVolumeName

func GenerateVolumeName(config *RootCommandConfig) string

create unique name for APPSODY_DEPS volumes

func GetDepVolumeArgs

func GetDepVolumeArgs(config *RootCommandConfig) ([]string, error)

get APPSODY_DEPS environment variable and split it into and array

func GetDeprecated

func GetDeprecated(config *RootCommandConfig) error

func GetEnvVar

func GetEnvVar(searchEnvVar string, config *RootCommandConfig) (string, error)

GetEnvVar obtains a Stack environment variable from the Stack image

func GetIDFromConfig

func GetIDFromConfig(config *RootCommandConfig) (string, error)

get project id from .appsody-config.yaml and create project entry if id does not exist

func GetLabelsForStackImage

func GetLabelsForStackImage(stackID string, buildImage string, stackYaml StackYaml, config *RootCommandConfig) (map[string]string, error)

GetLabelsForStackImage - Gets labels associated with the stack image

func GetUpdateString

func GetUpdateString(osName string, version string, latest string) string

GetUpdateString Returns a format string to advise the user how to upgrade

func ImagePush

func ImagePush(log *LoggingConfig, imageToPush string, buildah bool, dryrun bool) error

ImagePush pushes a docker image to a docker registry (assumes that the user has done docker login)

func InArray

func InArray(haystack []string, needle string) bool

InArray returns true if an element is in an array, and false otherwise

func InitConfig

func InitConfig(config *RootCommandConfig) error

func IsEmptyDir

func IsEmptyDir(name string) bool

func IsValidApplicationName

func IsValidApplicationName(name string) (bool, error)

func IsValidKubernetesLabelValue

func IsValidKubernetesLabelValue(value string) (bool, error)

func IsValidProjectName

func IsValidProjectName(name string) (bool, error)

func KubeApply

func KubeApply(log *LoggingConfig, fileToApply string, namespace string, dryrun bool) error

KubeApply issues kubectl apply -f <filename>

func KubeDelete

func KubeDelete(log *LoggingConfig, fileToApply string, namespace string, dryrun bool) error

KubeDelete issues kubectl delete -f <filename>

func KubeGet

func KubeGet(log *LoggingConfig, args []string, namespace string, dryrun bool) (string, error)

KubeGet issues kubectl get <arg>

func KubeGetClusterURL

func KubeGetClusterURL(log *LoggingConfig, service string, namespace string, dryrun bool) (url string, err error)

KubeGetClusterURL kubectl get svc <service> -o jsonpath=http://{.spec.clusterIP}:{.spec.ports[0].port} and prints the return URL

func KubeGetDeploymentURL

func KubeGetDeploymentURL(log *LoggingConfig, serviceName string, service map[string]interface{}, namespace string, dryrun bool) (url string, err error)

KubeGetDeploymentURL searches for an exposed hostname and port for the deployed service

func KubeGetKnativeURL

func KubeGetKnativeURL(log *LoggingConfig, service string, namespace string, dryrun bool) (url string, err error)

KubeGetKnativeURL issues kubectl get rt <service> -o jsonpath="{.status.url}" and prints the return URL

func KubeGetNodePortURL

func KubeGetNodePortURL(log *LoggingConfig, service string, namespace string, dryrun bool) (url string, err error)

KubeGetNodePortURL kubectl get svc <service> -o jsonpath=http://{.status.loadBalancer.ingress[0].hostname}:{.spec.ports[0].nodePort} and prints the return URL

func KubeGetNodePortURLIBMCloud

func KubeGetNodePortURLIBMCloud(log *LoggingConfig, service string, namespace string, dryrun bool) (url string, err error)

KubeGetNodePortURLIBMCloud issues several kubectl commands and prints the concatenated URL

func KubeGetRouteURL

func KubeGetRouteURL(log *LoggingConfig, service string, namespace string, dryrun bool) (url string, err error)

KubeGetRouteURL issues kubectl get svc <service> -o jsonpath=http://{.status.loadBalancer.ingress[0].hostname}:{.spec.ports[0].nodePort} and prints the return URL

func MoveDir

func MoveDir(log *LoggingConfig, fromDir string, toDir string) error

MoveDir moves a directory to another directory, even if they are on different partitions

func NormalizeImageName

func NormalizeImageName(imageName string) (string, error)

NormalizeImageName is a temporary fix for buildah workaround #676

func OverrideStackRegistry

func OverrideStackRegistry(override string, imageName string) (string, error)

OverrideStackRegistry allows you to change the image registry URL

func RemoveIfExists

func RemoveIfExists(path string) error

RemoveIfExists - Checks if inode exists and removes it if it does

func RunAppsodyCmdExec

func RunAppsodyCmdExec(args []string, workingDir string, rootConfig *RootCommandConfig) (string, error)

RunAppsodyCmdExec runs the appsody CLI with the given args in a new process The stdout and stderr are captured, printed, and returned args will be passed to the appsody command workingDir will be the directory the command runs in

func RunBuildahCommandAndListen

func RunBuildahCommandAndListen(config *RootCommandConfig, args []string, logger appsodylogger, interactive bool) (*exec.Cmd, error)

func RunCommandAndListen

func RunCommandAndListen(config *RootCommandConfig, commandValue string, args []string, logger appsodylogger, interactive bool) (*exec.Cmd, error)

func RunDockerCmdExec

func RunDockerCmdExec(args []string, log *LoggingConfig) (string, error)

RunDockerCmdExec runs the docker command with the given args in a new process The stdout and stderr are captured, printed, and returned args will be passed to the docker command workingDir will be the directory the command runs in

func RunDockerCommandAndListen

func RunDockerCommandAndListen(config *RootCommandConfig, args []string, logger appsodylogger, interactive bool) (*exec.Cmd, error)

func RunDockerCommandAndWait

func RunDockerCommandAndWait(config *RootCommandConfig, args []string, logger appsodylogger) error

func RunDockerInspect

func RunDockerInspect(log *LoggingConfig, imageName string) (string, error)

RunDockerInspect -TODO - this function should be removed. No one uses it, except the test. We are using inspectImage

func RunDockerVolumeList

func RunDockerVolumeList(log *LoggingConfig, volName string) (string, error)

RunDockerVolumeList lists all the volumes containing a certain string

func RunGit

func RunGit(log *LoggingConfig, workDir string, kargs []string, dryrun bool) (string, error)

RunGit runs a generic git

func RunGitBranchContains

func RunGitBranchContains(log *LoggingConfig, commitSHA string, workDir string, lineSeparator string, dryrun bool) ([]string, error)

func RunGitConfigLocalRemoteOriginURL

func RunGitConfigLocalRemoteOriginURL(log *LoggingConfig, workDir string, upstream string, dryrun bool) (string, error)

RunGitConfigLocalRemoteOriginURL

func RunGitRemote

func RunGitRemote(log *LoggingConfig, workDir string, lineSeparator string, dryrun bool) ([]string, error)

func RunGitVersion

func RunGitVersion(log *LoggingConfig, workDir string, dryrun bool) (string, error)

RunGitVersion

func RunKube

func RunKube(log *LoggingConfig, kargs []string, dryrun bool) (string, error)

RunKube runs a generic kubectl command

func RunKubeCommandAndListen

func RunKubeCommandAndListen(config *RootCommandConfig, args []string, logger appsodylogger, interactive bool) (*exec.Cmd, error)

func RunKubeDelete

func RunKubeDelete(log *LoggingConfig, args []string, dryrun bool) (string, error)

RunKubeDelete issues kubectl delete <args>

func RunKubeExec

func RunKubeExec(log *LoggingConfig, args []string, dryrun bool) (string, error)

RunKubeExec issues kubectl exec <arg>

func RunKubeGet

func RunKubeGet(log *LoggingConfig, args []string, dryrun bool) (string, error)

RunKubeGet issues kubectl get <arg>

func SaveIDToConfig

func SaveIDToConfig(ID string, config *RootCommandConfig) error

save project id to .appsody-config.yaml

func SeparateOutput

func SeparateOutput(cmd *exec.Cmd) (string, error)

func SplitBuildOptions

func SplitBuildOptions(options string) []string

func StringAfter

func StringAfter(value string, searchValue string) string

func StringBefore

func StringBefore(value string, searchValue string) string

func StringBetween

func StringBetween(value string, pre string, post string) string

func Targz

func Targz(log *LoggingConfig, source, target, filename string) error

tar and zip a directory into .tar.gz

func TestBuild

func TestBuild(log *LoggingConfig, stack string, template string, projectDir string, rootConfig *RootCommandConfig) error

Simple test for appsody build command. A future enhancement would be to verify the image that gets built.

func TestInit

func TestInit(log *LoggingConfig, stack string, template string, projectDir string, rootConfig *RootCommandConfig) error

Simple test for appsody init command

func TestRun

func TestRun(log *LoggingConfig, stack string, template string, projectDir string, rootConfig *RootCommandConfig) error

Simple test for appsody run command. A future enhancement would be to verify the image that gets built.

func TestTest

func TestTest(log *LoggingConfig, stack string, template string, projectDir string, rootConfig *RootCommandConfig) error

Simple test for appsody build command. A future enhancement would be to verify the image that gets built.

func UserHomeDir

func UserHomeDir(log *LoggingConfig) string

UserHomeDir returns the current user's home directory or '.'

func ValidateHostNameAndPort

func ValidateHostNameAndPort(hostNameAndPort string) (bool, error)

ValidateHostNameAndPort validates that hostNameAndPort conform to the DNS naming conventions

Types

type CommitInfo

type CommitInfo struct {
	SHA     string
	Date    string
	URL     string
	Message string

	Pushed bool
	// contains filtered or unexported fields
}

func RunGitGetLastCommit

func RunGitGetLastCommit(config *RootCommandConfig) (CommitInfo, error)

RunGitLog issues git log

type DeploymentManifest

type DeploymentManifest struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   map[string]interface{} `json:"spec,omitempty"`
	Status interface{}            `json:"status,omitempty"`
}

type GitInfo

type GitInfo struct {
	Branch    string
	Upstream  string
	RemoteURL string

	ChangesMade bool
	Commit      CommitInfo
}

func GetGitInfo

func GetGitInfo(config *RootCommandConfig) (GitInfo, error)

RunGitFindBranch issues git status

type IndexJSONStack

type IndexJSONStack struct {
	DisplayName  string `json:"displayName"`
	Description  string `json:"description"`
	Language     string `json:"language"`
	ProjectType  string `json:"projectType"`
	ProjectStyle string `json:"projectStyle"`
	Location     string `json:"location"`
	Links        Link   `json:"links"`
	Deprecated   string `json:"deprecated,omitempty"`
}

struct to convert yaml to json files

type IndexOutputFormat

type IndexOutputFormat struct {
	APIVersion   string                   `yaml:"apiVersion" json:"apiVersion"`
	Generated    time.Time                `yaml:"generated" json:"generated"`
	Repositories []RepositoryOutputFormat `yaml:"repositories" json:"repositories"`
}

Type for outputting stacks of a repository in JSON and YAML

type IndexYaml

type IndexYaml struct {
	APIVersion string                     `yaml:"apiVersion"`
	Generated  time.Time                  `yaml:"generated,omitempty"`
	Projects   map[string]ProjectVersions `yaml:"projects,omitempty"`
	Stacks     []IndexYamlStack
}

type IndexYamlStack

type IndexYamlStack struct {
	ID              string `yaml:"id"`
	Name            string `yaml:"name"`
	Version         string `yaml:"version"`
	Description     string `yaml:"description"`
	License         string `yaml:"license"`
	Language        string `yaml:"language"`
	Maintainers     []Maintainer
	DefaultTemplate string `yaml:"default-template"`
	SourceURL       string `yaml:"src"`
	Templates       []IndexYamlStackTemplate
	Requirements    StackRequirement `yaml:"requirements,omitempty"`
	Image           string           `yaml:"image"`
	Deprecated      string           `yaml:"deprecated,omitempty"`
}

type IndexYamlStackTemplate

type IndexYamlStackTemplate struct {
	ID        string `yaml:"id"`
	URL       string `yaml:"url"`
	IsDefault bool   `yaml:"default,omitempty" json:"default,omitempty"`
}
type Link struct {
	Self string `json:"self"`
}

type LoggingConfig

type LoggingConfig struct {
	// define the logging levels
	Info       appsodylogger
	Warning    appsodylogger
	Error      appsodylogger
	Debug      appsodylogger
	Container  appsodylogger
	InitScript appsodylogger
	DockerLog  appsodylogger
	BuildahLog appsodylogger
}

func (*LoggingConfig) InitLogging

func (config *LoggingConfig) InitLogging(outWriter, errWriter io.Writer)

InitLogging initializes the logging configuration for a given RootCommandConfig. The initialization of klog is global and will only be performed once.

type Maintainer

type Maintainer struct {
	Name     string `yaml:"name"`
	Email    string `yaml:"email"`
	GithubID string `yaml:"github-id" mapstructure:"github-id"`
}

type NotAnAppsodyProject

type NotAnAppsodyProject string

func (NotAnAppsodyProject) Error

func (e NotAnAppsodyProject) Error() string

type OwnerReference

type OwnerReference struct {
	APIVersion         string `yaml:"apiVersion"`
	Kind               string `yaml:"kind"`
	BlockOwnerDeletion bool   `yaml:"blockOwnerDeletion"`
	Controller         bool   `yaml:"controller"`
	Name               string `yaml:"name"`
	UID                string `yaml:"uid"`
}

type ProjectConfig

type ProjectConfig struct {
	Stack           string
	ProjectName     string `mapstructure:"project-name"`
	ApplicationName string `mapstructure:"application-name"`
	Version         string
	Description     string
	License         string
	Maintainers     []Maintainer
}

type ProjectEntry

type ProjectEntry struct {
	ID      string    `yaml:"id"`
	Path    string    `yaml:"path"`
	Volumes []*Volume `yaml:"volumes,omitempty"`
}

type ProjectFile

type ProjectFile struct {
	Projects []*ProjectEntry `yaml:"projects"`
}

func NewProjectFile

func NewProjectFile() *ProjectFile

func (*ProjectFile) Add

func (p *ProjectFile) Add(projectEntry ...*ProjectEntry)

add a new project entry to the project.yaml file

func (*ProjectFile) AddDepsVolumesToProjectEntry

func (p *ProjectFile) AddDepsVolumesToProjectEntry(depsEnvVars []string, volumeMaps []string, rootConfig *RootCommandConfig) ([]string, error)

create docker volume names for every path in APPSODY_DEPS and put it in project.yaml

func (*ProjectFile) AddNewProject

func (p *ProjectFile) AddNewProject(ID string, config *RootCommandConfig) error

add new project entry to ~/.appsody/project.yaml

func (*ProjectFile) EnsureProjectIDAndEntryExists

func (p *ProjectFile) EnsureProjectIDAndEntryExists(rootConfig *RootCommandConfig) (*ProjectEntry, string, error)

func (*ProjectFile) GetProject

func (p *ProjectFile) GetProject(id string) *ProjectEntry

get project from project.yaml with given id

func (*ProjectFile) GetProjects

func (p *ProjectFile) GetProjects(fileLocation string) (*ProjectFile, error)

get all project entries from project.yaml

func (*ProjectFile) HasID

func (p *ProjectFile) HasID(id string) bool

check if project.yaml file had a project with given id

func (*ProjectFile) Remove

func (p *ProjectFile) Remove(id string)

func (*ProjectFile) WriteFile

func (p *ProjectFile) WriteFile(path string) error

write to the project.yaml file

type ProjectVersions

type ProjectVersions []*IndexYamlStack

type RepoIndices

type RepoIndices map[string]*IndexYaml

RepoIndices maps repos to their RepoIndex (i.e. the projects in a repo)

type RepositoryEntry

type RepositoryEntry struct {
	Name      string `yaml:"name" json:"name"`
	URL       string `yaml:"url" json:"url"`
	IsDefault bool   `yaml:"default,omitempty" json:"default,omitempty"`
}

type RepositoryFile

type RepositoryFile struct {
	APIVersion   string             `yaml:"apiVersion" json:"apiVersion"`
	Generated    time.Time          `yaml:"generated" json:"generated"`
	Repositories []*RepositoryEntry `yaml:"repositories" json:"repositories"`
}

func NewRepoFile

func NewRepoFile() *RepositoryFile

func (*RepositoryFile) Add

func (r *RepositoryFile) Add(re ...*RepositoryEntry)

func (*RepositoryFile) GetDefaultRepoName

func (r *RepositoryFile) GetDefaultRepoName(rootConfig *RootCommandConfig) (string, error)

func (*RepositoryFile) GetIndices

func (r *RepositoryFile) GetIndices(log *LoggingConfig) (RepoIndices, error)

func (*RepositoryFile) GetRepo

func (r *RepositoryFile) GetRepo(name string) *RepositoryEntry

func (*RepositoryFile) Has

func (r *RepositoryFile) Has(name string) bool

func (*RepositoryFile) HasURL

func (r *RepositoryFile) HasURL(url string) bool

func (*RepositoryFile) Remove

func (r *RepositoryFile) Remove(name string, log *LoggingConfig)

func (*RepositoryFile) SetDefaultRepoName

func (r *RepositoryFile) SetDefaultRepoName(name string, defaultRepoName string, rootConfig *RootCommandConfig) (string, error)

func (*RepositoryFile) WriteFile

func (r *RepositoryFile) WriteFile(path string) error

type RepositoryOutputFormat

type RepositoryOutputFormat struct {
	Name   string  `yaml:"repositoryName" json:"repositoryName"`
	Stacks []Stack `yaml:"stacks" json:"stacks"`
}

type RootCommandConfig

type RootCommandConfig struct {
	*LoggingConfig

	CfgFile           string
	Dryrun            bool
	Verbose           bool
	CliConfig         *viper.Viper
	Buildah           bool
	ProjectConfig     *ProjectConfig
	ProjectDir        string
	UnsupportedRepos  []string
	StackRegistry     string
	StackRegistryInit string

	CachedEnvVars map[string]string
	// contains filtered or unexported fields
}

type Stack

type Stack struct {
	ID          string                   `yaml:"id,omitempty" json:"id,omitempty"`
	Version     string                   `yaml:"version" json:"version"`
	Description string                   `yaml:"description" json:"description"`
	Templates   []IndexYamlStackTemplate `yaml:"templates,omitempty" json:"templates,omitempty"`
	Deprecated  string                   `yaml:"deprecated,omitempty" json:"deprecated,omitempty"`
	// contains filtered or unexported fields
}

type StackContainer

type StackContainer struct {
	ID string
	// contains filtered or unexported fields
}

StackContainer is our internal representation of the attributes of stack based container

type StackRequirement

type StackRequirement struct {
	Docker  string `yaml:"docker-version,omitempty"`
	Appsody string `yaml:"appsody-version,omitempty"`
	Buildah string `yaml:"buildah-version,omitempty"`
}

type StackYaml

type StackYaml struct {
	Name            string `yaml:"name"`
	Version         string `yaml:"version"`
	Description     string `yaml:"description"`
	License         string `yaml:"license"`
	Language        string `yaml:"language"`
	Maintainers     []Maintainer
	DefaultTemplate string            `yaml:"default-template"`
	TemplatingData  map[string]string `yaml:"templating-data"`
	Requirements    StackRequirement  `yaml:"requirements,omitempty"`
	Deprecated      string            `yaml:"deprecated,omitempty"`
}

structs for parsing the yaml files

type Volume

type Volume struct {
	Name, Path string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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