Skip to content

Commit

Permalink
change name
Browse files Browse the repository at this point in the history
  • Loading branch information
joelee2012 committed Nov 7, 2024
1 parent e9f2605 commit ea3fb7d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions jenkins.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ type JenkinsOpts struct {
type Jenkins struct {
*Item
client *http.Client
Header http.Header
Crumb *Crumb
crumb *Crumb
credentials *CredentialService
nodes *NodeService
queue *QueueService
views *ViewService
Header http.Header
Debug bool
}

Expand Down Expand Up @@ -150,8 +150,8 @@ func (j *Jenkins) Queue() *QueueService {
}

func (c *Jenkins) GetCrumb() (*Crumb, error) {
if c.Crumb != nil {
return c.Crumb, nil
if c.crumb != nil {
return c.crumb, nil
}
req, err := http.NewRequest("GET", c.URL+"crumbIssuer/api/json", nil)
if err != nil {
Expand All @@ -170,12 +170,12 @@ func (c *Jenkins) GetCrumb() (*Crumb, error) {
if err != nil {
return nil, err
}
if err := json.Unmarshal(body, &c.Crumb); err != nil {
if err := json.Unmarshal(body, &c.crumb); err != nil {
return nil, err
}
c.Header.Set(c.Crumb.RequestFields, c.Crumb.Value)
c.Header.Set(c.crumb.RequestFields, c.crumb.Value)
c.Header.Set("Cookie", resp.Header.Get("set-cookie"))
return c.Crumb, nil
return c.crumb, nil
}

func (c *Jenkins) doRequest(method, url string, body io.Reader) (*http.Response, error) {
Expand Down Expand Up @@ -347,8 +347,6 @@ func (c *Jenkins) ReloadJCasC() (*http.Response, error) {
// return resp.ToFile(name)
// }



func (c *Jenkins) ValidateJenkinsfile(content string) (string, error) {
v := url.Values{}
v.Add("jenkinsfile", content)
Expand Down

0 comments on commit ea3fb7d

Please sign in to comment.