Skip to content

Commit 91ef00c

Browse files
feat: added build job search by commit hash (#115)
Co-authored-by: raphaelcoeffic <[email protected]>
1 parent aa0104f commit 91ef00c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

artifactory/build_jobs_repository.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ func jobQueryClause(query *JobQuery) func(db *gorm.DB) *gorm.DB {
118118
refs := strings.Split(query.Release, ",")
119119
db = db.Where("commit_ref IN(?)", refs)
120120
}
121+
if query.Sha != "" {
122+
shas := strings.Split(query.Sha, ",")
123+
db = db.Where("commit_hash IN(?)", shas)
124+
}
125+
if query.NotSha != "" {
126+
shas := strings.Split(query.NotSha, ",")
127+
db = db.Where("commit_hash NOT IN(?)", shas)
128+
}
121129
return db
122130
}
123131
}

artifactory/job_query.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ type JobQuery struct {
99
Status string `form:"status"`
1010
Release string `form:"release"`
1111
Target string `form:"target"`
12+
Sha string `form:"sha"`
13+
NotSha string `form:"not-sha"`
1214
}
1315

1416
func (q *JobQuery) Validate() error {

0 commit comments

Comments
 (0)