Skip to content

Commit

Permalink
cleanup: use better names for the credentials interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
waveywaves committed Jan 30, 2025
1 parent 9e090f3 commit 29b53ce
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/entrypoint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func main() {
// from secret volume mounts to /tekton/creds. This is done to support the expansion
// of a variable, $(credentials.path), that resolves to a single place with all the
// stored credentials.
builders := []credwriter.Builder{dockercreds.NewBuilder(), gitcreds.NewBuilder()}
builders := []credwriter.Writer{dockercreds.NewBuilder(), gitcreds.NewBuilder()}
for _, c := range builders {
if err := c.Write(pipeline.CredsDir); err != nil {
log.Printf("Error initializing credentials: %s", err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/credentials/dockercreds/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ type basicDockerBuilder struct{}

// NewBuilder returns a new builder for Docker credentials.
func NewBuilder() interface {
credmatcher.Builder
credwriter.Builder
credmatcher.Matcher
credwriter.Writer
} {
return &basicDockerBuilder{}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/credentials/gitcreds/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ type gitBuilder struct{}

// NewBuilder returns a new builder for Git credentials.
func NewBuilder() interface {
credmatcher.Builder
credwriter.Builder
credmatcher.Matcher
credwriter.Writer
} {
return &gitBuilder{}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/credentials/matcher/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
// It is mutable and exported for testing.
var VolumePath = "/tekton/creds-secrets"

// Builder is the interface for a credential initializer of any type.
type Builder interface {
// Matcher is the interface for a credential initializer of any type.
type Matcher interface {
// MatchingAnnotations extracts flags for the credential
// helper from the supplied secret and returns a slice (of
// length 0 or greater) of applicable domains.
Expand Down
4 changes: 2 additions & 2 deletions pkg/credentials/writer/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const (
// helper (aka "creds-init") can write to /tekton/creds.
var CredsInitCredentials = []string{".docker", ".gitconfig", ".git-credentials", ".ssh"}

// Builder is the interface for a credential initializer of any type.
type Builder interface {
// Writer is the interface for a credential initializer of any type.
type Writer interface {
// Write writes the credentials to the provided directory.
Write(folder string) error
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/pod/creds_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func credsInit(ctx context.Context, obj runtime.Object, serviceAccountName, name
}

builders := []interface {
credmatcher.Builder
credwriter.Builder
credmatcher.Matcher
credwriter.Writer
}{dockercreds.NewBuilder(), gitcreds.NewBuilder()}

var volumeMounts []corev1.VolumeMount
Expand Down

0 comments on commit 29b53ce

Please sign in to comment.