Skip to content

Commit

Permalink
feat: update pipeline url from single to list (#93)
Browse files Browse the repository at this point in the history
# Why:
- change pipeline url to pipeline urls because tekton has multiple
pipeline

Signed-off-by: lijie <[email protected]>
  • Loading branch information
lijie authored Mar 7, 2024
1 parent 6a29275 commit 5c021cf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions tibuild/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,12 @@ const docTemplate = `{
"pipelineViewURL": {
"type": "string"
},
"pipelineViewURLs": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"$ref": "#/definitions/service.BuildStatus"
},
Expand Down
6 changes: 6 additions & 0 deletions tibuild/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,12 @@
"pipelineViewURL": {
"type": "string"
},
"pipelineViewURLs": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"$ref": "#/definitions/service.BuildStatus"
},
Expand Down
4 changes: 4 additions & 0 deletions tibuild/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ definitions:
type: string
pipelineViewURL:
type: string
pipelineViewURLs:
items:
type: string
type: array
status:
$ref: '#/definitions/service.BuildStatus'
tektonStatus:
Expand Down
5 changes: 3 additions & 2 deletions tibuild/pkg/rest/service/dev_build_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ func (s DevbuildServer) sync(ctx context.Context, entity *DevBuild) (*DevBuild,
func (s DevbuildServer) inflate(entity *DevBuild) {
if entity.Status.PipelineBuildID != 0 {
entity.Status.PipelineViewURL = s.Jenkins.BuildURL(jobname, entity.Status.PipelineBuildID)
entity.Status.PipelineViewURLs = append(entity.Status.PipelineViewURLs, entity.Status.PipelineViewURL)
}
if entity.Status.BuildReport != nil {
for i, bin := range entity.Status.BuildReport.Binaries {
Expand All @@ -348,8 +349,8 @@ func (s DevbuildServer) inflate(entity *DevBuild) {
}
}
if tek := entity.Status.TektonStatus; tek != nil {
for i, p := range tek.Pipelines {
tek.Pipelines[i].URL = fmt.Sprintf("%s/%s", s.TektonViewURL, p.Name)
for _, p := range tek.Pipelines {
entity.Status.PipelineViewURLs = append(entity.Status.PipelineViewURLs, fmt.Sprintf("%s/%s", s.TektonViewURL, p.Name))
}
}
}
Expand Down
1 change: 1 addition & 0 deletions tibuild/pkg/rest/service/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ type DevBuildStatus struct {
Status BuildStatus `json:"status" gorm:"type:varchar(16)"`
PipelineBuildID int64 `json:"pipelineBuildID,omitempty"`
PipelineViewURL string `json:"pipelineViewURL,omitempty" gorm:"-"`
PipelineViewURLs []string `json:"pipelineViewURLs,omitempty" gorm:"-"`
ErrMsg string `json:"errMsg,omitempty" gorm:"type:varchar(256)"`
PipelineStartAt *time.Time `json:"pipelineStartAt,omitempty"`
PipelineEndAt *time.Time `json:"pipelineEndAt,omitempty"`
Expand Down

0 comments on commit 5c021cf

Please sign in to comment.