Skip to content

Commit

Permalink
Revert "Use Update() instead of UpdateStatus()"
Browse files Browse the repository at this point in the history
This reverts commit 6ec5070.

Signed-off-by: Steve Kuznetsov <[email protected]>
  • Loading branch information
stevekuznetsov committed Feb 5, 2019
1 parent 2370d20 commit a1bc15a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions prow/cluster/plank_rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ rules:
- create
- list
- update
- apiGroups:
- prow.k8s.io
resources:
- prowjobs/status
verbs:
- update
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
Expand Down
2 changes: 2 additions & 0 deletions prow/cluster/prowjob_customresourcedefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ spec:
singular: prowjob
plural: prowjobs
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
2 changes: 2 additions & 0 deletions prow/cluster/starter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ spec:
singular: prowjob
plural: prowjobs
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
8 changes: 4 additions & 4 deletions prow/jenkins/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
type prowJobClient interface {
Create(*prowapi.ProwJob) (*prowapi.ProwJob, error)
List(opts metav1.ListOptions) (*prowapi.ProwJobList, error)
Update(*prowapi.ProwJob) (*prowapi.ProwJob, error)
UpdateStatus(*prowapi.ProwJob) (*prowapi.ProwJob, error)
}

type jenkinsClient interface {
Expand Down Expand Up @@ -298,7 +298,7 @@ func (c *Controller) terminateDupes(pjs []prowapi.ProwJob, jbs map[string]Build)
c.log.WithFields(pjutil.ProwJobFields(&toCancel)).
WithField("from", prevState).
WithField("to", toCancel.Status.State).Info("Transitioning states.")
npj, err := c.prowJobClient.Update(&toCancel)
npj, err := c.prowJobClient.UpdateStatus(&toCancel)
if err != nil {
return err
}
Expand Down Expand Up @@ -395,7 +395,7 @@ func (c *Controller) syncPendingJob(pj prowapi.ProwJob, reports chan<- prowapi.P
WithField("from", prevState).
WithField("to", pj.Status.State).Info("Transitioning states.")
}
_, err := c.prowJobClient.Update(&pj)
_, err := c.prowJobClient.UpdateStatus(&pj)
return err
}

Expand Down Expand Up @@ -437,7 +437,7 @@ func (c *Controller) syncTriggeredJob(pj prowapi.ProwJob, reports chan<- prowapi
WithField("from", prevState).
WithField("to", pj.Status.State).Info("Transitioning states.")
}
_, err := c.prowJobClient.Update(&pj)
_, err := c.prowJobClient.UpdateStatus(&pj)
return err
}

Expand Down
10 changes: 5 additions & 5 deletions prow/plank/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const (

type prowJobClient interface {
Create(*prowapi.ProwJob) (*prowapi.ProwJob, error)
Update(*prowapi.ProwJob) (*prowapi.ProwJob, error)
UpdateStatus(*prowapi.ProwJob) (*prowapi.ProwJob, error)
Get(name string, options metav1.GetOptions) (*prowapi.ProwJob, error)
List(opts metav1.ListOptions) (*prowapi.ProwJobList, error)
}
Expand Down Expand Up @@ -160,7 +160,7 @@ func (c *Controller) setPreviousReportState(pj prowapi.ProwJob) error {
latestPJ.Status.PrevReportStates = map[string]prowapi.ProwJobState{}
}
latestPJ.Status.PrevReportStates[reporter.GithubReporterName] = latestPJ.Status.State
_, err = c.prowJobClient.Update(latestPJ)
_, err = c.prowJobClient.UpdateStatus(latestPJ)
return err
}

Expand Down Expand Up @@ -294,7 +294,7 @@ func (c *Controller) terminateDupes(pjs []prowapi.ProwJob, pm map[string]coreapi
c.log.WithFields(pjutil.ProwJobFields(&toCancel)).
WithField("from", prevState).
WithField("to", toCancel.Status.State).Info("Transitioning states.")
npj, err := c.prowJobClient.Update(&toCancel)
npj, err := c.prowJobClient.UpdateStatus(&toCancel)
if err != nil {
return err
}
Expand Down Expand Up @@ -429,7 +429,7 @@ func (c *Controller) syncPendingJob(pj prowapi.ProwJob, pm map[string]coreapi.Po
WithField("from", prevState).
WithField("to", pj.Status.State).Info("Transitioning states.")
}
_, err := c.prowJobClient.Update(&pj)
_, err := c.prowJobClient.UpdateStatus(&pj)
return err
}

Expand Down Expand Up @@ -479,7 +479,7 @@ func (c *Controller) syncTriggeredJob(pj prowapi.ProwJob, pm map[string]coreapi.
WithField("from", prevState).
WithField("to", pj.Status.State).Info("Transitioning states.")
}
_, err := c.prowJobClient.Update(&pj)
_, err := c.prowJobClient.UpdateStatus(&pj)
return err
}

Expand Down

0 comments on commit a1bc15a

Please sign in to comment.