summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile2
-rw-r--r--ext/git/writer.go12
2 files changed, 11 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile
index e294a17..fa0d501 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,7 +14,7 @@ FROM alpine:3.19
RUN apk update && \
apk upgrade && \
- apk add ca-certificates git openssh-client aws-cli tini && \
+ apk add ca-certificates git openssh-client aws-cli tini gpg && \
rm -rf /var/cache/apk/*
RUN mkdir -p /usr/local/bin
diff --git a/ext/git/writer.go b/ext/git/writer.go
index 94535ae..9178865 100644
--- a/ext/git/writer.go
+++ b/ext/git/writer.go
@@ -32,13 +32,21 @@ func (m *nativeGitClient) Commit(pathSpec string, opts *CommitOptions) error {
defaultCommitMsg := "Update parameters"
// Git configuration
config := "gpg.format=" + opts.SigningMethod
- args := []string{"-c", config, "commit"}
+ args := []string{}
+ // -c is a global option and needs to be passed before the actual git sub
+ // command (commit).
+ if opts.SigningMethod != "" {
+ args = append(args, "-c", config)
+ }
+ args = append(args, "commit")
if pathSpec == "" || pathSpec == "*" {
args = append(args, "-a")
}
// Commit fails with a space between -S flag and path to SSH key
// -S/user/test/.ssh/signingKey or -SAAAAAAAA...
- args = append(args, fmt.Sprintf("-S%s", opts.SigningKey))
+ if opts.SigningKey != "" {
+ args = append(args, fmt.Sprintf("-S%s", opts.SigningKey))
+ }
if opts.SignOff {
args = append(args, "-s")
}