Skip to content

Commit

Permalink
☸️ Add updatedBy field for stable components
Browse files Browse the repository at this point in the history
  • Loading branch information
Pohfy123 committed Mar 17, 2020
1 parent 55c83fb commit 0e9f10f
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/v1beta1/stablecomponent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ type StableComponentSpec struct {

// Version represents Docker image tag version
Version string `json:"version"`

// UpdatedBy represents a person who updated the StableComponent
// +optional
UpdatedBy string `json:"updatedBy,omitempty"`
}

// StableComponentStatus defines the observed state of StableComponent
Expand Down
4 changes: 4 additions & 0 deletions config/crds/env.samsahai.io_activepromotionhistories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ spec:
repository:
description: Repository represents Docker image repository
type: string
updatedBy:
description: UpdatedBy represents a person who updated
the StableComponent
type: string
version:
description: Version represents Docker image tag version
type: string
Expand Down
4 changes: 4 additions & 0 deletions config/crds/env.samsahai.io_activepromotions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ spec:
repository:
description: Repository represents Docker image repository
type: string
updatedBy:
description: UpdatedBy represents a person who updated the
StableComponent
type: string
version:
description: Version represents Docker image tag version
type: string
Expand Down
4 changes: 4 additions & 0 deletions config/crds/env.samsahai.io_queuehistories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ spec:
repository:
description: Repository represents Docker image repository
type: string
updatedBy:
description: UpdatedBy represents a person who updated the
StableComponent
type: string
version:
description: Version represents Docker image tag version
type: string
Expand Down
3 changes: 3 additions & 0 deletions config/crds/env.samsahai.io_stablecomponents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
repository:
description: Repository represents Docker image repository
type: string
updatedBy:
description: UpdatedBy represents a person who updated the StableComponent
type: string
version:
description: Version represents Docker image tag version
type: string
Expand Down
8 changes: 8 additions & 0 deletions config/crds/env.samsahai.io_teams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ spec:
repository:
description: Repository represents Docker image repository
type: string
updatedBy:
description: UpdatedBy represents a person who updated the
StableComponent
type: string
version:
description: Version represents Docker image tag version
type: string
Expand Down Expand Up @@ -331,6 +335,10 @@ spec:
repository:
description: Repository represents Docker image repository
type: string
updatedBy:
description: UpdatedBy represents a person who updated the
StableComponent
type: string
version:
description: Version represents Docker image tag version
type: string
Expand Down
6 changes: 5 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2020-02-19 11:50:34.39559 +0700 +07 m=+0.152828257
// 2020-02-26 14:04:47.50141 +0700 +07 m=+0.159661108

package docs

Expand Down Expand Up @@ -1528,6 +1528,10 @@ var doc = `{
"description": "Repository represents Docker image repository",
"type": "string"
},
"updatedBy": {
"description": "UpdatedBy represents a person who updated the StableComponent\n+optional",
"type": "string"
},
"version": {
"description": "Version represents Docker image tag version",
"type": "string"
Expand Down
4 changes: 4 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,10 @@
"description": "Repository represents Docker image repository",
"type": "string"
},
"updatedBy": {
"description": "UpdatedBy represents a person who updated the StableComponent\n+optional",
"type": "string"
},
"version": {
"description": "Version represents Docker image tag version",
"type": "string"
Expand Down
5 changes: 5 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@ definitions:
repository:
description: Repository represents Docker image repository
type: string
updatedBy:
description: |-
UpdatedBy represents a person who updated the StableComponent
+optional
type: string
version:
description: Version represents Docker image tag version
type: string
Expand Down
4 changes: 4 additions & 0 deletions internal/staging/collect_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ func (c *controller) deleteQueueHistoryOutOfRange(ctx context.Context, namespace

// setStableComponent creates or updates StableComponent to match with Queue
func (c *controller) setStableComponent(queue *s2hv1beta1.Queue) (err error) {
const updatedBy = "samsahai"

stableComp := &s2hv1beta1.StableComponent{}
err = c.client.Get(
context.TODO(),
Expand All @@ -204,6 +206,7 @@ func (c *controller) setStableComponent(queue *s2hv1beta1.Queue) (err error) {
Name: queue.Spec.Name,
Version: queue.Spec.Version,
Repository: queue.Spec.Repository,
UpdatedBy: updatedBy,
},
Status: s2hv1beta1.StableComponentStatus{
CreatedAt: &now,
Expand Down Expand Up @@ -231,6 +234,7 @@ func (c *controller) setStableComponent(queue *s2hv1beta1.Queue) (err error) {

stableComp.Spec.Repository = queue.Spec.Repository
stableComp.Spec.Version = queue.Spec.Version
stableComp.Spec.UpdatedBy = updatedBy

err = c.client.Update(context.TODO(), stableComp)
if err != nil {
Expand Down

0 comments on commit 0e9f10f

Please sign in to comment.