plasmactlbump

package module
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

README

plasmactl-bump

Update the version of components that were updated in last commit

Excluded files
  • README.md
  • README.svg

Documentation

Overview

Package plasmactlbump implements a launchr plugin with bump functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDiffFiles added in v1.2.0

func GetDiffFiles(dirA, dirB string) ([]string, error)

GetDiffFiles takes two directory paths as inputs and returns a slice of updated file paths and an error. It compares the files in the two directories (excluding subdirectories specified in the excludeSubDirs variable) and checks if they are equal. If a file is modified, its path is added to the updated slice.

func PromptError

func PromptError(err error)

PromptError prints an error.

Types

type ArtifactStorage added in v1.2.0

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

ArtifactStorage represents a storage for artifacts.

func (*ArtifactStorage) PrepareComparisonArtifact added in v1.2.0

func (s *ArtifactStorage) PrepareComparisonArtifact(comparisonDir string) error

PrepareComparisonArtifact prepares the artifact for comparison by downloading and extracting it into the specified directory.

type BumpAction

type BumpAction interface {
	launchr.Service
	Bump(last bool) error
}

BumpAction is a launchr.Service providing bumper functionality.

type BumperRepo

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

BumperRepo encapsulates Git-related operations for bumping versions in a Git repository.

func (*BumperRepo) Commit

func (r *BumperRepo) Commit() error

Commit stores the current changes to the Git repository with the default commit message and author.

func (*BumperRepo) GetComparisonCommit added in v1.7.0

func (r *BumperRepo) GetComparisonCommit(from plumbing.Hash, searchMessage string) (*plumbing.Hash, error)

GetComparisonCommit returns the commit that contains the specified search message.

func (*BumperRepo) GetLastCommitShortHash

func (r *BumperRepo) GetLastCommitShortHash() (string, error)

GetLastCommitShortHash gets the short hash of the latest commit in the Git repository.

func (*BumperRepo) GetRepoName added in v1.2.0

func (r *BumperRepo) GetRepoName() (string, error)

GetRepoName retrieves the name of the remote repository. It looks for the remote named "origin" and extracts the repository name from the remote's URL. It returns the repository name as a string and an error if the remote is not found or the repository name cannot be extracted.

func (*BumperRepo) IsOwnCommit

func (r *BumperRepo) IsOwnCommit() bool

IsOwnCommit checks if the latest commit in the Git repository was made by the bumper.

type Inventory added in v1.2.0

type Inventory struct {
	ResourcesCrawler *ResourcesCrawler
	// contains filtered or unexported fields
}

Inventory represents the inventory used in the application to search and collect resources and variable resources.

func NewInventory added in v1.2.0

func NewInventory(vaultpass, sourceDir, comparisonDir string) (*Inventory, error)

NewInventory creates a new instance of Inventory with the provided vault password. It then calls the Init method of the Inventory to build the resources graph and returns the initialized Inventory or any error that occurred during initialization.

func (*Inventory) GetChangedResources added in v1.2.0

func (i *Inventory) GetChangedResources(modifiedFiles []string) *OrderedResourceMap

GetChangedResources returns an OrderedResourceMap containing the resources that have been modified, based on the provided list of modified files. It iterates over the modified files, builds a resource from each file path, and adds it to the result map if it is not already present.

func (*Inventory) GetChangedVarsResources added in v1.2.0

func (i *Inventory) GetChangedVarsResources(modifiedFiles []string) (*OrderedResourceMap, map[string]map[string]bool, error)

GetChangedVarsResources returns the resources and variable maps associated with the changed variables in the modified files. It takes a slice of modified file paths as input. It returns the resources as an OrderedResourceMap and the variable maps as a map[string]map[string]bool. If there are no changed variables, it returns nil for both the resources and variable maps.

func (*Inventory) GetDependenciesMap added in v1.4.0

func (i *Inventory) GetDependenciesMap() map[string]map[string]bool

GetDependenciesMap returns the map, which represents the dependencies between resources in the Inventory. The map is of type `map[string]map[string]bool`, where the keys are the resource names and the values are maps of dependent resource names.

func (*Inventory) GetRequiredMap added in v1.2.0

func (i *Inventory) GetRequiredMap() map[string]map[string]bool

GetRequiredMap returns the required map, which represents the dependencies between resources in the Inventory. The map is of type `map[string]map[string]bool`, where the keys are the resource names and the values are maps of dependent resource names.

func (*Inventory) GetResourcesOrder added in v1.2.0

func (i *Inventory) GetResourcesOrder() []string

GetResourcesOrder returns the order of resources in the inventory. It returns a slice of strings representing the order of the resources.

func (*Inventory) Init added in v1.2.0

func (i *Inventory) Init() error

Init initializes the Inventory by building the resources graph. It returns an error if there was an issue while building the graph.

type OrderedResourceMap added in v1.2.0

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

OrderedResourceMap represents a map of resources with ordered keys

type OrderedResourceMap struct {
  keys []string
  dict map[string]*Resource
}

The `keys` field is a slice of strings that represents the order of the keys in the map. The `dict` field is a map where the key is a string and the value is a pointer to a Resource object.

func NewOrderedResourceMap added in v1.2.0

func NewOrderedResourceMap() *OrderedResourceMap

NewOrderedResourceMap returns a new instance of OrderedResourceMap with an empty dictionary.

func (*OrderedResourceMap) Get added in v1.2.0

func (orm *OrderedResourceMap) Get(key string) (*Resource, bool)

Get a value from the OrderedResourceMap.

func (*OrderedResourceMap) Len added in v1.2.0

func (orm *OrderedResourceMap) Len() int

Len returns the length of the OrderedResourceMap.

func (*OrderedResourceMap) OrderBy added in v1.2.0

func (orm *OrderedResourceMap) OrderBy(orderList []string)

OrderBy updates the order of keys in the OrderedResourceMap based on the orderList. It removes any keys in orderList that are not present in the OrderedResourceMap. The keys are reordered in the OrderedResourceMap according to the order of appearance in orderList. The order of keys not present in orderList remains unchanged.

func (*OrderedResourceMap) OrderedKeys added in v1.2.0

func (orm *OrderedResourceMap) OrderedKeys() []string

OrderedKeys returns the ordered keys from the OrderedResourceMap.

func (*OrderedResourceMap) Set added in v1.2.0

func (orm *OrderedResourceMap) Set(key string, value *Resource)

Set a value in the OrderedResourceMap.

type Plugin

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

Plugin is launchr plugin providing bump action.

func (*Plugin) CobraAddCommands

func (p *Plugin) CobraAddCommands(rootCmd *cobra.Command) error

CobraAddCommands implements launchr.CobraPlugin interface to provide bump functionality.

func (*Plugin) OnAppInit

func (p *Plugin) OnAppInit(app launchr.App) error

OnAppInit implements launchr.Plugin interface.

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() launchr.PluginInfo

PluginInfo implements launchr.Plugin interface.

type Resource

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

Resource represents a platform resource

func BuildResourceFromPath added in v1.4.0

func BuildResourceFromPath(path, pathPrefix string) *Resource

BuildResourceFromPath builds a new instance of Resource from the given path.

func (*Resource) GetName

func (r *Resource) GetName() string

GetName returns a resource name

func (*Resource) GetVersion

func (r *Resource) GetVersion() (string, error)

GetVersion retrieves the version of the resource from the plasma.yaml

func (*Resource) UpdateVersion

func (r *Resource) UpdateVersion(version string) error

UpdateVersion updates the version of the resource in the plasma.yaml file

type ResourcesCrawler added in v1.2.0

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

ResourcesCrawler is a type that represents a crawler for resources in a given directory.

func NewResourcesCrawler added in v1.2.0

func NewResourcesCrawler(directory string) *ResourcesCrawler

NewResourcesCrawler creates a new instance of ResourcesCrawler with initialized taskSources and templateSources maps.

func (*ResourcesCrawler) FindDefaultFiles added in v1.6.0

func (cr *ResourcesCrawler) FindDefaultFiles(platform string) []string

FindDefaultFiles returns a slice of file paths that match certain criteria for defaults on a specific platform.

func (*ResourcesCrawler) FindGroupVarsFiles added in v1.2.0

func (cr *ResourcesCrawler) FindGroupVarsFiles(platform string) []string

FindGroupVarsFiles returns a slice of file paths that match certain criteria for group vars on a specific platform.

func (*ResourcesCrawler) FindTaskFiles added in v1.2.0

func (cr *ResourcesCrawler) FindTaskFiles(platform string) []string

FindTaskFiles returns a slice of file paths that match certain criteria for tasks on a specific platform.

func (*ResourcesCrawler) FindTemplateFiles added in v1.2.0

func (cr *ResourcesCrawler) FindTemplateFiles(platform string) []string

FindTemplateFiles returns a slice of file paths that match certain criteria for templates on a specific platform.

func (*ResourcesCrawler) SearchVariableResources added in v1.2.0

func (cr *ResourcesCrawler) SearchVariableResources(platform string, names map[string]*Variable, resources map[string]map[string]bool) error

SearchVariableResources searches for variable resources on a specific platform using the provided names and resources map. If the platform is rootPlatform, an empty string is used as the search platform. It retrieves task and template files for the platform if they are not already stored in the taskSources and templateSources maps of the ResourcesCrawler. It scans each file and checks if the variables in the names map are present in the resources map for that file. If a variable is missing, it adds it to the toIterate slice. It then scans each line of the file and checks if it contains any of the variables in the toIterate slice. If a variable is found, it adds it to the foundList map. After scanning all the files, it updates the resources map with the variables found in each file.

func (*ResourcesCrawler) SearchVariablesInGroupFiles added in v1.2.0

func (cr *ResourcesCrawler) SearchVariablesInGroupFiles(name string, files []string) ([]*Variable, error)

SearchVariablesInGroupFiles searches for variables in a group of files that match the specified name. It takes a name string and a slice of files. It returns a slice of Variable pointers that contain information about each found variable. The function iterates over each file in the files slice, read it and if the string representation of the value contains the specified name, it creates a Variable object and appends it to the variables slice. Finally, it returns the variables slice. Example usage:

crawler := &ResourcesCrawler{}
files := crawler.FindGroupVarsFiles("platform")
variables := crawler.SearchVariablesInGroupFiles("variable", files)

type SyncAction added in v1.2.0

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

SyncAction is a type representing a resources version synchronization action.

func (*SyncAction) Execute added in v1.2.0

func (s *SyncAction) Execute(username, password, override, vaultpass string) error

Execute executes the sync action by following these steps: - Calls the prepareArtifact method to prepare the comparison artifact. - Calls the GetDiffFiles function to get the modified files. - Prints the modified files. - Calls the propagate method to propagate resources' versions. - Returns any error that occurs during the execution of the sync action.

type Variable added in v1.2.0

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

Variable represents a variable used in the application. It contains information about the variable filepath, platform, name, hash, and whether it is from a vault or not.

Directories

Path Synopsis
cmd
launchr
Package executes Launchr application.
Package executes Launchr application.

Jump to

Keyboard shortcuts

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