Skip to content

Commit

Permalink
Log info messages to stdout as opposed to stderr
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Franssen <[email protected]>
  • Loading branch information
marcofranssen committed Feb 9, 2022
1 parent 0428b4d commit 49f3611
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pkg/cosign/git/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro
return fmt.Errorf("%s", bodyBytes)
}

fmt.Fprintln(os.Stderr, "Password written to COSIGN_PASSWORD github actions secret")
fmt.Fprintln(os.Stdout, "Password written to COSIGN_PASSWORD github actions secret")

privateKeySecretEnv := &github.EncryptedSecret{
Name: "COSIGN_PRIVATE_KEY",
Expand All @@ -108,7 +108,7 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro
return fmt.Errorf("%s", bodyBytes)
}

fmt.Fprintln(os.Stderr, "Private key written to COSIGN_PRIVATE_KEY github actions secret")
fmt.Fprintln(os.Stdout, "Private key written to COSIGN_PRIVATE_KEY github actions secret")

publicKeySecretEnv := &github.EncryptedSecret{
Name: "COSIGN_PUBLIC_KEY",
Expand All @@ -126,12 +126,12 @@ func (g *Gh) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro
return fmt.Errorf("%s", bodyBytes)
}

fmt.Fprintln(os.Stderr, "Public key written to COSIGN_PUBLIC_KEY github actions secret")
fmt.Fprintln(os.Stdout, "Public key written to COSIGN_PUBLIC_KEY github actions secret")

if err := os.WriteFile("cosign.pub", keys.PublicBytes, 0o600); err != nil {
return err
}
fmt.Fprintln(os.Stderr, "Public key also written to cosign.pub")
fmt.Fprintln(os.Stdout, "Public key also written to cosign.pub")

return nil
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/cosign/git/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (g *Gl) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro
return errors.Errorf("%s", bodyBytes)
}

fmt.Fprintln(os.Stderr, "Password written to \"COSIGN_PASSWORD\" variable")
fmt.Fprintln(os.Stdout, "Password written to \"COSIGN_PASSWORD\" variable")

_, privateKeyResp, err := client.ProjectVariables.CreateVariable(ref, &gitlab.CreateProjectVariableOptions{
Key: gitlab.String("COSIGN_PRIVATE_KEY"),
Expand All @@ -96,7 +96,7 @@ func (g *Gl) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro
return errors.Errorf("%s", bodyBytes)
}

fmt.Fprintln(os.Stderr, "Private key written to \"COSIGN_PRIVATE_KEY\" variable")
fmt.Fprintln(os.Stdout, "Private key written to \"COSIGN_PRIVATE_KEY\" variable")

_, publicKeyResp, err := client.ProjectVariables.CreateVariable(ref, &gitlab.CreateProjectVariableOptions{
Key: gitlab.String("COSIGN_PUBLIC_KEY"),
Expand All @@ -114,12 +114,12 @@ func (g *Gl) PutSecret(ctx context.Context, ref string, pf cosign.PassFunc) erro
return errors.Errorf("%s", bodyBytes)
}

fmt.Fprintln(os.Stderr, "Public key written to \"COSIGN_PUBLIC_KEY\" variable")
fmt.Fprintln(os.Stdout, "Public key written to \"COSIGN_PUBLIC_KEY\" variable")

if err := os.WriteFile("cosign.pub", keys.PublicBytes, 0o600); err != nil {
return err
}
fmt.Fprintln(os.Stderr, "Public key also written to cosign.pub")
fmt.Fprintln(os.Stdout, "Public key also written to cosign.pub")

return nil
}
Expand Down

0 comments on commit 49f3611

Please sign in to comment.