Skip to content

Commit

Permalink
windows: Don't log crypto/x509: system root pool warning
Browse files Browse the repository at this point in the history
On Windows runners, the error message is always displayed for a job:

```
crypto/x509: system root pool is not available on Windows"
```

Since `x509.SystemCertPool` doesn't work on Windows, don't log a
warning.

References:

1. golang/go#16736
2. golang/go#18609

Closes https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3035
  • Loading branch information
stanhu committed Dec 1, 2020
1 parent 279f16d commit 747bab4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion network/client.go
Expand Up @@ -15,6 +15,7 @@ import (
"net/url"
"os"
"path/filepath"
"runtime"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -120,8 +121,9 @@ func (n *client) addTLSCA(tlsConfig *tls.Config) {
return
}

// SystemCertPool doesn't work on Windows: https://github.com/golang/go/issues/16736
pool, err := x509.SystemCertPool()
if err != nil {
if err != nil && runtime.GOOS != "windows" {
logrus.Warningln("Failed to load system CertPool:", err)
}
if pool == nil {
Expand Down

0 comments on commit 747bab4

Please sign in to comment.