Documentation ¶
Index ¶
- Variables
- func Generate(fs afero.Afero, gitOpsFolder string, outputFolder string, ...) error
- func GenerateOverlays(fs afero.Afero, gitOpsFolder string, outputFolder string, ...) error
- func UpdateExistingKustomize(fs afero.Afero, outputFolder string) error
- type CommandType
- type DeleteFolderError
- type Gen
- func (s Gen) CloneGenerateAndPush(outputPath string, remote string, options gitopsv1alpha1.GeneratorOptions, ...) error
- func (s Gen) CloneRepo(outputPath string, remote string, componentName string, branch string) error
- func (s Gen) CommitAndPush(outputPath string, repoPathOverride string, remote string, ...) error
- func (s Gen) GenerateAndPush(outputPath string, remote string, options gitopsv1alpha1.GeneratorOptions, ...) error
- func (s Gen) GenerateOverlaysAndPush(outputPath string, clone bool, remote string, ...) error
- func (s Gen) GetCommitIDFromRepo(fs afero.Afero, repoPath string) (string, error)
- func (s Gen) GitRemoveComponent(outputPath string, remote string, componentName string, branch string, ...) error
- type Generator
- type GitAddFilesError
- type GitAddFilesToRemoteError
- type GitBranchError
- type GitCmd
- type GitCmdError
- type GitCreateRepoError
- type GitGenResourcesAndOverlaysError
- type GitLsRemoteError
- type GitOpsRepoGenError
- type GitOpsRepoGenUserError
- type GitPullError
Constants ¶
This section is empty.
Variables ¶
var CreatedBy = "application-service"
Functions ¶
func Generate ¶
func Generate(fs afero.Afero, gitOpsFolder string, outputFolder string, component gitopsv1alpha1.GeneratorOptions) error
Generate takes in a given Component CR and spits out a deployment, service, and route file to disk
func GenerateOverlays ¶
func GenerateOverlays(fs afero.Afero, gitOpsFolder string, outputFolder string, options gitopsv1alpha1.GeneratorOptions, imageName, namespace string, componentGeneratedResources map[string][]string) error
GenerateOverlays generates the overlays director in an existing GitOps structure
Types ¶
type CommandType ¶
type CommandType string
const ( GitCommand CommandType = "git" RmCommand CommandType = "rm" )
type DeleteFolderError ¶
type DeleteFolderError struct {
// contains filtered or unexported fields
}
DeleteFolderError is used to construct a custom error if component removal fails
func (*DeleteFolderError) Error ¶
func (e *DeleteFolderError) Error() string
type Gen ¶
func NewGitopsGenWithLogger ¶
func (Gen) CloneGenerateAndPush ¶
func (s Gen) CloneGenerateAndPush(outputPath string, remote string, options gitopsv1alpha1.GeneratorOptions, appFs afero.Afero, branch string, context string, doPush bool) error
CloneGenerateAndPush takes in the following args and generates the gitops resources for a given component 1. outputPath: Where to output the gitops resources to 2. remote: A string of the form https://$token@<domain>/<org>/<repo>, where <domain> is either github.com or gitlab.com and $token is optional. Corresponds to the component's gitops repository 3. options: Options for resource generation 4. The filesystem object used to create (either ioutils.NewFilesystem() or ioutils.NewMemoryFilesystem()) 5. The branch to push to 6. The path within the repository to generate the resources in 7. The gitops config containing the build bundle; Adapted from https://github.com/redhat-developer/kam/blob/master/pkg/pipelines/utils.go#L79
func (Gen) CloneRepo ¶
CloneRepo clones the repo, and switches to the branch 1. outputPath: Where to output the gitops resources to 2. remote: A string of the form https://$token@<domain>/<org>/<repo>, where <domain> is either github.com or gitlab.com and $token is optional. Corresponds to the component's gitops repository 3. componentName: The component name corresponding to a single Component in an Application. eg. component.Name 4. The branch to push to switch to
func (Gen) CommitAndPush ¶
func (s Gen) CommitAndPush(outputPath string, repoPathOverride string, remote string, componentName string, branch string, commitMessage string) error
CommitAndPush pushes any new changes to the GitOps repo. The folder should already be cloned in the target output folder. 1. outputPath: Where the gitops resources are 2. repoPathOverride: The default path is the componentName. Use this to override the default folder. 3. remote: A string of the form https://$token@github.com/<org>/<repo>. Corresponds to the component's gitops repository 4. componentName: The component name corresponding to a single Component in an Application in AS. eg. component.Name 5. The branch to push to 6. The path within the repository to generate the resources in
func (Gen) GenerateAndPush ¶
func (s Gen) GenerateAndPush(outputPath string, remote string, options gitopsv1alpha1.GeneratorOptions, appFs afero.Afero, branch string, doPush bool, createdBy string) error
GenerateAndPush generates a new gitops folder with one component, and optionally pushes to Git. Note: this does not clone an existing gitops repo. 1. outputPath: Where the gitops resources are 2. remote: A string of the form https://$token@github.com/<org>/<repo>. Corresponds to the component's gitops repository 3. options: Options for resource generation 4. The filesystem object used to create (either ioutils.NewFilesystem() or ioutils.NewMemoryFilesystem()) 5. The branch to push to 6. Optionally push to the GitOps repository or not. Default is not to push. 7. createdBy: Use a unique name to identify that clients are generating the GitOps repository. Default is "application-service" and should be overwritten.
func (Gen) GenerateOverlaysAndPush ¶
func (s Gen) GenerateOverlaysAndPush(outputPath string, clone bool, remote string, options gitopsv1alpha1.GeneratorOptions, applicationName, environmentName, imageName, namespace string, appFs afero.Afero, branch string, context string, doPush bool, componentGeneratedResources map[string][]string) error
GenerateOverlaysAndPush generates the overlays kustomize from App Env Snapshot Binding Spec 1. outputPath: Where to output the gitops resources to 2. clone: Optionally clone the repository first 3. remote: A string of the form https://$token@github.com/<org>/<repo>. Corresponds to the component's gitops repository 4. options: Options for resource generation 5. applicationName: The name of the application 6. environmentName: The name of the environment 7. imageName: The image name of the source 8 namespace: The namespace of the component. This is used in as the namespace of the deployment yaml. 9. The filesystem object used to create (either ioutils.NewFilesystem() or ioutils.NewMemoryFilesystem()) 10. The branch to push to 11. The path within the repository to generate the resources in 12. Push the changes to the repository or not. 13. The gitops config containing the build bundle;
func (Gen) GetCommitIDFromRepo ¶
GetCommitIDFromRepo returns the commit ID for the given repository
func (Gen) GitRemoveComponent ¶
func (s Gen) GitRemoveComponent(outputPath string, remote string, componentName string, branch string, context string) error
GitRemoveComponent clones the repo, removes the component, and pushes the changes back to the repository. It takes in the following args and updates the gitops resources by removing the given component 1. outputPath: Where to output the gitops resources to 2. remote: A string of the form https://$token@<domain>/<org>/<repo>, where <domain> is either github.com or gitlab.com and $token is optional. Corresponds to the component's gitops repository 3. componentName: The component name corresponding to a single Component in an Application. eg. component.Name 4. The branch to push to 5. The path within the repository to generate the resources in
type Generator ¶
type Generator interface { CloneGenerateAndPush(outputPath string, remote string, options gitopsv1alpha1.GeneratorOptions, appFs afero.Afero, branch string, context string, doPush bool) error CommitAndPush(outputPath string, repoPathOverride string, remote string, componentName string, branch string, commitMessage string) error GenerateAndPush(outputPath string, remote string, options gitopsv1alpha1.GeneratorOptions, appFs afero.Afero, branch string, doPush bool, createdBy string) error GenerateOverlaysAndPush(outputPath string, clone bool, remote string, options gitopsv1alpha1.GeneratorOptions, applicationName, environmentName, imageName, namespace string, appFs afero.Afero, branch string, context string, doPush bool, componentGeneratedResources map[string][]string) error GitRemoveComponent(outputPath string, remote string, componentName string, branch string, context string) error CloneRepo(outputPath string, remote string, componentName string, branch string) error GetCommitIDFromRepo(fs afero.Afero, repoPath string) (string, error) }
type GitAddFilesError ¶
type GitAddFilesError struct {
// contains filtered or unexported fields
}
func (*GitAddFilesError) Error ¶
func (e *GitAddFilesError) Error() string
type GitAddFilesToRemoteError ¶
type GitAddFilesToRemoteError struct {
// contains filtered or unexported fields
}
GitAddFilesToRemoteError is used to construct a custom error if adding files to remote repo fails
func (*GitAddFilesToRemoteError) Error ¶
func (e *GitAddFilesToRemoteError) Error() string
type GitBranchError ¶
type GitBranchError struct {
// contains filtered or unexported fields
}
GitBranchError is used to construct custom errors related to git branch failures Used by the following command types: switchBranch, checkoutBranch
func (*GitBranchError) Error ¶
func (e *GitBranchError) Error() string
type GitCmdError ¶
type GitCmdError struct {
// contains filtered or unexported fields
}
func (*GitCmdError) Error ¶
func (e *GitCmdError) Error() string
type GitCreateRepoError ¶
type GitCreateRepoError struct {
// contains filtered or unexported fields
}
GitCreateRepoError is used to construct a custom error if repo creation fails
func (*GitCreateRepoError) Error ¶
func (e *GitCreateRepoError) Error() string
type GitGenResourcesAndOverlaysError ¶
type GitGenResourcesAndOverlaysError struct {
// contains filtered or unexported fields
}
func (*GitGenResourcesAndOverlaysError) Error ¶
func (e *GitGenResourcesAndOverlaysError) Error() string
type GitLsRemoteError ¶
type GitLsRemoteError struct {
// contains filtered or unexported fields
}
GitLsRemoteError is used to construct custom errors related to git ls-remote failures
func (*GitLsRemoteError) Error ¶
func (e *GitLsRemoteError) Error() string
type GitOpsRepoGenError ¶
type GitOpsRepoGenError struct {
// contains filtered or unexported fields
}
func (*GitOpsRepoGenError) Error ¶
func (e *GitOpsRepoGenError) Error() string
type GitOpsRepoGenUserError ¶
type GitOpsRepoGenUserError struct {
// contains filtered or unexported fields
}
func (*GitOpsRepoGenUserError) Error ¶
func (e *GitOpsRepoGenUserError) Error() string
type GitPullError ¶
type GitPullError struct {
// contains filtered or unexported fields
}
GitPullError is used to construct custom errors related to git pull failures
func (*GitPullError) Error ¶
func (e *GitPullError) Error() string