Documentation
¶
Index ¶
- Variables
- func ExtractPinComment(text string) string
- func FormatActionPin(originalRef, pinnedRef string)
- func FormatActionPinMessage(originalRef, pinnedRef string)
- func FormatAlreadyPinnedActionsMessage(pinnedActions []string)
- func FormatAlreadyPinnedDockerMessage(fileType string, pinnedImages []string, serviceNames []string)
- func FormatAlreadyPinnedMessage(fileType string, count int)
- func FormatDockerPin(fileType, serviceName, originalImage, pinnedImage string)
- func LogWarning(format string, args ...interface{})
- func ParseImageNameAndTag(image string) (name, tag string)
- func PinImage(rc *regclient.RegClient, image string, config ProcessorConfig) (string, error)
- func ProcessActions(rc *regclient.RegClient, path string, config ProcessorConfig) error
- func ProcessCompose(rc *regclient.RegClient, path string, config ProcessorConfig) error
- func ProcessDockerfile(rc *regclient.RegClient, path string, config ProcessorConfig) error
- func ProcessFileGeneric(path string, config ProcessorConfig, processor FileProcessor) error
- func UpdateCommentWithPin(text, originalRef string) string
- type ComposeFile
- type DefaultGitHubResolver
- type FileProcessor
- type GitHubRef
- type GitHubResolver
- type ImagePinner
- type ProcessorConfig
- type StaticGitHubResolver
Constants ¶
This section is empty.
Variables ¶
var ( // PinCommentPattern matches pin directive comments like "# pin@v5" PinCommentPattern = regexp.MustCompile(`#\s*pin@([^\s]+)`) )
Common regex patterns used across processors
Functions ¶
func ExtractPinComment ¶
ExtractPinComment extracts pin directive from comment like "# pin@v5" This is now generic and can be used by any processor
func FormatActionPin ¶
func FormatActionPin(originalRef, pinnedRef string)
FormatActionPin formats a GitHub Action pin message with granular coloring
func FormatActionPinMessage ¶
func FormatActionPinMessage(originalRef, pinnedRef string)
FormatActionPinMessage formats a pin message for GitHub Actions
func FormatAlreadyPinnedActionsMessage ¶
func FormatAlreadyPinnedActionsMessage(pinnedActions []string)
FormatAlreadyPinnedActionsMessage formats a detailed message showing already pinned actions
func FormatAlreadyPinnedDockerMessage ¶
func FormatAlreadyPinnedDockerMessage(fileType string, pinnedImages []string, serviceNames []string)
FormatAlreadyPinnedDockerMessage formats a detailed message showing already pinned Docker images
func FormatAlreadyPinnedMessage ¶
FormatAlreadyPinnedMessage formats a message when all references are already pinned
func FormatDockerPin ¶
func FormatDockerPin(fileType, serviceName, originalImage, pinnedImage string)
FormatDockerPin formats a Docker image pin message with granular coloring
func LogWarning ¶
func LogWarning(format string, args ...interface{})
LogWarning provides consistent warning message formatting
func ParseImageNameAndTag ¶ added in v0.0.2
ParseImageNameAndTag splits an image reference into name and tag
func PinImage ¶
PinImage resolves an image tag to its immutable digest using regclient Returns clean tag@digest format for better Docker compatibility
func ProcessActions ¶
func ProcessActions(rc *regclient.RegClient, path string, config ProcessorConfig) error
ProcessActions updates GitHub Actions workflow files to pin action references to commit SHAs
func ProcessCompose ¶
func ProcessCompose(rc *regclient.RegClient, path string, config ProcessorConfig) error
ProcessCompose updates image tags in a Compose file
func ProcessDockerfile ¶
func ProcessDockerfile(rc *regclient.RegClient, path string, config ProcessorConfig) error
ProcessDockerfile updates FROM lines in a Dockerfile
func ProcessFileGeneric ¶
func ProcessFileGeneric(path string, config ProcessorConfig, processor FileProcessor) error
ProcessFileGeneric provides a common pattern for file processing operations
func UpdateCommentWithPin ¶
UpdateCommentWithPin adds or updates a pin comment in text
Types ¶
type ComposeFile ¶
type ComposeFile map[string]interface{}
ComposeFile is a flexible representation of a docker-compose YAML that preserves all fields
type DefaultGitHubResolver ¶
type DefaultGitHubResolver struct{}
DefaultGitHubResolver implements GitHubResolver using the GitHub CLI
func (*DefaultGitHubResolver) ResolveActionToSHA ¶
func (r *DefaultGitHubResolver) ResolveActionToSHA(ref *GitHubRef) (string, error)
ResolveActionToSHA resolves a GitHub action tag/ref to a commit SHA using GitHub CLI's REST client
type FileProcessor ¶
type FileProcessor func(data []byte, config ProcessorConfig) ([]byte, bool, error)
FileProcessor represents a generic file processing function
type GitHubResolver ¶
GitHubResolver interface for resolving GitHub action references
type ImagePinner ¶ added in v0.1.0
type ImagePinner func(rc *regclient.RegClient, image string, config ProcessorConfig) (string, error)
ImagePinner resolves an image reference to a pinned digest reference.
type ProcessorConfig ¶
type ProcessorConfig struct {
DryRun bool
Algorithm string
NoColor bool
Pervasive bool
ExpandRegistry bool
ForceMode string // "docker", "actions", or "" for auto-detection
Quiet bool // suppress informational messages when no changes are needed
Platform string // platform-specific manifest digest (e.g., linux/amd64, linux/arm/v7)
GitHubResolver GitHubResolver // resolver for GitHub API calls (injected for testing)
ImagePinner ImagePinner // resolver for Docker image pins (injected for testing)
}
ProcessorConfig holds configuration for the processor
type StaticGitHubResolver ¶ added in v0.1.0
StaticGitHubResolver resolves action refs from an in-memory mapping.
func NewStaticGitHubResolverFromFile ¶ added in v0.1.0
func NewStaticGitHubResolverFromFile(path string) (StaticGitHubResolver, error)
NewStaticGitHubResolverFromFile loads a JSON object mapping "owner/repo@ref" to a 40-character SHA.
func (StaticGitHubResolver) ResolveActionToSHA ¶ added in v0.1.0
func (r StaticGitHubResolver) ResolveActionToSHA(ref *GitHubRef) (string, error)
ResolveActionToSHA resolves a GitHub action tag/ref to a commit SHA from a static map.