1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Merge branch 'master' into fix-gerrit-documentation

This commit is contained in:
Chris Cummer 2018-07-18 11:34:35 -04:00 committed by GitHub
commit 5ad1035cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -39,6 +39,7 @@ jenkins:
refreshInterval: 300
url: "https://jenkins.domain.com/jenkins/view_url"
user: "username"
verifyServerCertificate: true
```
### Attributes
@ -61,3 +62,7 @@ Your Jenkins username. <br />
The url to your Jenkins project or view. <br />
Values: A valid URI.
`verifyServerCertificate` <br />
_Optional_ <br />
Determines whether or not the server's certificate chain and host name are verified. <br />
Values: `true`, `false`.

View File

@ -163,7 +163,8 @@ width="320" height="68" alt="jenkins screenshot" /></p>
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">300</span><span class="w">
</span><span class="w"> </span>url<span class="p">:</span><span class="w"> </span><span class="s2">&#34;https://jenkins.domain.com/jenkins/view_url&#34;</span><span class="w">
</span><span class="w"> </span>user<span class="p">:</span><span class="w"> </span><span class="s2">&#34;username&#34;</span></code></pre></div>
</span><span class="w"> </span>user<span class="p">:</span><span class="w"> </span><span class="s2">&#34;username&#34;</span><span class="w">
</span><span class="w"> </span>verifyServerCertificate<span class="p">:</span><span class="w"> </span><span class="kc">true</span></code></pre></div>
<h3 id="attributes">Attributes</h3>
<p><code>enabled</code> <br />
@ -184,6 +185,11 @@ Your Jenkins username. <br /></p>
The url to your Jenkins project or view. <br />
Values: A valid URI.</p>
<p><code>verifyServerCertificate</code> <br />
<em>Optional</em> <br />
Determines whether or not the server&rsquo;s certificate chain and host name are verified. <br />
Values: <code>true</code>, <code>false</code>.</p>
</div>
<div class="footer">

View File

@ -2,12 +2,15 @@ package jenkins
import (
"bytes"
"crypto/tls"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
"github.com/senorprogrammer/wtf/wtf"
)
func Create(jenkinsURL string, username string, apiKey string) (*View, error) {
@ -26,7 +29,13 @@ func Create(jenkinsURL string, username string, apiKey string) (*View, error) {
req, _ := http.NewRequest("GET", jenkinsAPIURL.String(), nil)
req.SetBasicAuth(username, apiKey)
httpClient := &http.Client{}
verifyServerCertificate := wtf.Config.UBool("wtf.mods.jenkins.verifyServerCertificate", true)
httpClient := &http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: !verifyServerCertificate,
},
},
}
resp, err := httpClient.Do(req)
if err != nil {