mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-07 19:22:08 +01:00
Read upstream job ID as ID when it isn't null
Read upstream job ID as ID when it isn't null to fix the job not found error Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
46dcf7b0cb
commit
0539f051a2
@ -49,13 +49,10 @@ func (h *HookHandler) Handle(ctx context.Context, sc *job.StatusChange) error {
|
|||||||
logger := log.GetLogger(ctx)
|
logger := log.GetLogger(ctx)
|
||||||
|
|
||||||
jobID := sc.JobID
|
jobID := sc.JobID
|
||||||
// when a "KindScheduled" job is scheduled by a periodical job, it's "JobID" field
|
// the "JobID" field of some kinds of jobs are set as "87bbdee19bed5ce09c48a149@1605104520" which contains "@".
|
||||||
// is set as "87bbdee19bed5ce09c48a149@1605104520" which contains "@". In this case,
|
// In this case, read the parent periodical job ID from "sc.Metadata.UpstreamJobID"
|
||||||
// read the parent periodical job ID from "sc.Metadata.UpstreamJobID"
|
if len(sc.Metadata.UpstreamJobID) > 0 {
|
||||||
if sc.Metadata.JobKind == job.KindScheduled {
|
jobID = sc.Metadata.UpstreamJobID
|
||||||
if len(sc.Metadata.UpstreamJobID) > 0 {
|
|
||||||
jobID = sc.Metadata.UpstreamJobID
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tasks, err := h.taskDAO.List(ctx, &q.Query{
|
tasks, err := h.taskDAO.List(ctx, &q.Query{
|
||||||
Keywords: map[string]interface{}{
|
Keywords: map[string]interface{}{
|
||||||
|
Loading…
Reference in New Issue
Block a user