Skip to content

Commit

Permalink
Added commit-id to deploying component, deploy component list to the …
Browse files Browse the repository at this point in the history
…pipeline job
  • Loading branch information
satr committed Jan 16, 2024
1 parent 38f320d commit c1f9cc9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/deployments/models/component_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ func (b *componentBuilder) BuildComponent() (*Component, error) {
Notifications: b.notifications,
ExternalDNS: b.externalDNS,
HorizontalScalingSummary: b.hpa,
CommitID: variables[defaults.RadixCommitHashEnvironmentVariable],
}, b.buildError()
}

Expand Down
5 changes: 5 additions & 0 deletions api/deployments/models/component_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ type Component struct {
// required: false
ExternalDNS []ExternalDNS `json:"externalDNS,omitempty"`

// Commit ID for the component. In can be different from the Commit ID, defined for entire deployment
//
// required: false
CommitID string `json:",inline"`

AuxiliaryResource `json:",inline"`
}

Expand Down
15 changes: 13 additions & 2 deletions api/jobs/models/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ type Job struct {
// items:
// "$ref": "#/definitions/ComponentSummary"
Components []*deploymentModels.ComponentSummary `json:"components,omitempty"`

// ComponentsToDeploy List of components to deploy
// OPTIONAL If specified, only these components are deployed
//
// example: component1,component2
ComponentsToDeploy []string `json:"componentsToDeploy,omitempty"`
}

// GetJobFromRadixJob Gets job from a radix job
Expand Down Expand Up @@ -161,6 +167,7 @@ func GetJobFromRadixJob(job *radixv1.RadixJob, jobDeployments []*deploymentModel
case radixv1.Deploy:
jobModel.ImageTagNames = job.Spec.Deploy.ImageTagNames
jobModel.CommitID = job.Spec.Deploy.CommitID
jobModel.ComponentsToDeploy = job.Spec.Deploy.Components
case radixv1.Promote:
jobModel.PromotedFromDeployment = job.Spec.Promote.DeploymentName
jobModel.PromotedFromEnvironment = job.Spec.Promote.FromEnvironment
Expand All @@ -181,8 +188,12 @@ func GetJobStepsFromRadixJob(job *radixv1.RadixJob) []Step {
PodName: jobStep.PodName,
Components: jobStep.Components,
}
if jobStep.Started != nil {step.Started = &jobStep.Started.Time}
if jobStep.Ended != nil {step.Ended = &jobStep.Ended.Time}
if jobStep.Started != nil {
step.Started = &jobStep.Started.Time
}
if jobStep.Ended != nil {
step.Ended = &jobStep.Ended.Time
}

steps = append(steps, step)
}
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
require (
github.com/equinor/radix-common v1.8.0
github.com/equinor/radix-job-scheduler v1.8.5
github.com/equinor/radix-operator v1.49.0
github.com/equinor/radix-operator v1.49.1-0.20240116123121-b7148c5ca4dd
github.com/evanphx/json-patch/v5 v5.7.0
github.com/go-swagger/go-swagger v0.30.5
github.com/golang-jwt/jwt/v4 v4.5.0
Expand Down Expand Up @@ -83,6 +83,7 @@ require (
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/statsd_exporter v0.22.7 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ github.com/equinor/radix-job-scheduler v1.8.5 h1:ahw6FkFpPV167B1/w7/aQKpVMmU5Vc7
github.com/equinor/radix-job-scheduler v1.8.5/go.mod h1:rNIQU1eCInLV8Yl+5SRITOUU52QwYioYrIGQcsDc3kg=
github.com/equinor/radix-operator v1.49.0 h1:yNdb0zocBw7GdWybAGUm2lWmk6I+xeeCjvrN8xjVTyA=
github.com/equinor/radix-operator v1.49.0/go.mod h1:i8A6V/g1OM+Zk2lAASZaoX+lHdJIZYYZHA586SHB2p8=
github.com/equinor/radix-operator v1.49.1-0.20240116123121-b7148c5ca4dd h1:0WsH5+0vu9k1AFV8Whux2VrtawqjA1tKWseEo1D7siQ=
github.com/equinor/radix-operator v1.49.1-0.20240116123121-b7148c5ca4dd/go.mod h1:i8A6V/g1OM+Zk2lAASZaoX+lHdJIZYYZHA586SHB2p8=
github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI=
github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.7.0 h1:nJqP7uwL84RJInrohHfW0Fx3awjbm8qZeFv0nW9SYGc=
Expand Down Expand Up @@ -332,6 +334,8 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/prometheus/statsd_exporter v0.22.7 h1:7Pji/i2GuhK6Lu7DHrtTkFmNBCudCPT1pX2CziuyQR0=
github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
Expand Down
13 changes: 13 additions & 0 deletions swaggerui/html/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5495,6 +5495,10 @@
"image"
],
"properties": {
"CommitID": {
"description": "Commit ID for the component. In can be different from the Commit ID, defined for entire deployment",
"type": "string"
},
"externalDNS": {
"description": "Array of external DNS configurations",
"type": "array",
Expand Down Expand Up @@ -6280,6 +6284,15 @@
},
"x-go-name": "Components"
},
"componentsToDeploy": {
"description": "ComponentsToDeploy List of components to deploy\nOPTIONAL If specified, only these components are deployed",
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ComponentsToDeploy",
"example": "component1,component2"
},
"created": {
"description": "Created timestamp",
"type": "string",
Expand Down

0 comments on commit c1f9cc9

Please sign in to comment.