Skip to content

Commit

Permalink
Wrap source with double quotes (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham149 authored Sep 2, 2021
1 parent 4796071 commit 9f2209a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:3.6 as alpine
FROM alpine:3.12 as alpine
RUN apk add -U --no-cache ca-certificates

FROM alpine:3.6
FROM alpine:3.12
ENV GODEBUG netdns=go

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
Expand Down
12 changes: 6 additions & 6 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ func Exec(ctx context.Context, args Args) error {
return fmt.Errorf("url needs to be set")
}

cmdArgs := []string{"jfrog", "rt", "u", fmt.Sprintf("--url=%s", args.URL)}
cmdArgs := []string{"jfrog", "rt", "u", fmt.Sprintf("--url %s", args.URL)}
if args.Retries != 0 {
cmdArgs = append(cmdArgs, fmt.Sprintf("--retries=%d", args.Retries))
}

// Set authentication params
if args.Username != "" && args.Password != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--user $PLUGIN_USERNAME"))
cmdArgs = append(cmdArgs, fmt.Sprintf("--password $PLUGIN_PASSWORD"))
cmdArgs = append(cmdArgs, "--user $PLUGIN_USERNAME")
cmdArgs = append(cmdArgs, "--password $PLUGIN_PASSWORD")
} else if args.APIKey != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--apikey $PLUGIN_API_KEY"))
cmdArgs = append(cmdArgs, "--apikey $PLUGIN_API_KEY")
} else if args.AccessToken != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--access-token $PLUGIN_ACCESS_TOKEN"))
cmdArgs = append(cmdArgs, "--access-token $PLUGIN_ACCESS_TOKEN")
} else {
return fmt.Errorf("either username/password, api key or access token needs to be set")
}
Expand All @@ -60,7 +60,7 @@ func Exec(ctx context.Context, args Args) error {
if args.Target == "" {
return fmt.Errorf("target path needs to be set")
}
cmdArgs = append(cmdArgs, args.Source, args.Target)
cmdArgs = append(cmdArgs, fmt.Sprintf("\"%s\"", args.Source), args.Target)
cmdStr := strings.Join(cmdArgs[:], " ")

cmd := exec.Command("sh", "-c", cmdStr)
Expand Down

0 comments on commit 9f2209a

Please sign in to comment.