Documentation ¶
Index ¶
- Constants
- Variables
- func RemoteTags(repositoryURL string) (semver.Collection, error)
- type BlockSource
- type GitSource
- func (gs *GitSource) FindLatestTagForConstraint(constraint *semver.Constraints) *semver.Version
- func (gs *GitSource) HCLSafeSourceURL() string
- func (gs *GitSource) IsVersion(version *semver.Version) bool
- func (gs *GitSource) LocalVersionString() string
- func (gs *GitSource) SetSourceVersion(version *semver.Version)
- func (gs *GitSource) UpdateRemoteTags() error
- func (gs *GitSource) WouldForceDowngrade(version *semver.Version) bool
- type HclParser
Constants ¶
const TerraformBlockType string = "module"
TerraformBlockType denotes the parent block type for a source ref in a terraform file
const TerragruntBlockType string = "terraform"
TerragruntBlockType denotes the parent block type for a source ref in a terragrunt file
Variables ¶
var SourceCache sourceCache
SourceCache is a global cache of repo URL's and available remote versions, used to reduce network calls to find verisons.
Functions ¶
func RemoteTags ¶
func RemoteTags(repositoryURL string) (semver.Collection, error)
RemoteTags returns a colelction of SemVer tags, if the tags are not in SemVer format and Error is returned.
Types ¶
type BlockSource ¶
type BlockSource struct { Name string // contains filtered or unexported fields }
BlockSource contains the name of a given module containing a source ref,in the case of terraform this is file path + module name, in the case of terragrunt it's the filepath only. This also contains the raw URL extracted from that block.
type GitSource ¶
type GitSource struct { LatestRemoteVersion *semver.Version RemoteVersions semver.Collection LocalVersionIsMain bool BlockIndex int SourceURL *url.URL RemoteURL *url.URL Prefixes []string // contains filtered or unexported fields }
GitSource holds the metadata about a given git source, such as it's verion, available remote versions, and whether it is locally versioned.
func (*GitSource) FindLatestTagForConstraint ¶
func (gs *GitSource) FindLatestTagForConstraint(constraint *semver.Constraints) *semver.Version
FindLatestTagForConstraint finds the latest tag in RemoteVersions matching the given constraint.
func (*GitSource) HCLSafeSourceURL ¶
HCLSafeSourceURL retruns a url in string form matching the original HCL source (with prefixes attached)
func (*GitSource) IsVersion ¶
IsVersion returns true if the source version is the same as the supplied version
func (*GitSource) LocalVersionString ¶
LocalVersionString returns either `HEAD` (in the case of no local version being set) or it returns the current local version.
func (*GitSource) SetSourceVersion ¶
SetSourceVersion updates the git source in memory to change the given sources' version to the version specified.
func (*GitSource) UpdateRemoteTags ¶
UpdateRemoteTags requests a list of git tags from the source origin, and sets them against this GitSource object.
type HclParser ¶
type HclParser struct {
// contains filtered or unexported fields
}
HclParser presides over a given HCL formatted file and can be used to both read and udpate it.
func NewHclParser ¶
NewHclParser reads in a given HCL file and instansiates a new instance of HclParser
func (*HclParser) FindGitSources ¶
FindGitSources searches the current HCL for blocks which contain a `source` attribute, and then extracts the version references from it. Optionally, it may also retrieve information about the versions of the module available remotely.
func (*HclParser) UpdateBlockSource ¶
UpdateBlockSource udpates the block source in the HCL, in memory, to match the source contained in the GitSource