digest check if available

feature/approvals_reset_on_digest_change
Karolis Rusenas 2018-06-20 00:06:52 +01:00
parent 2c80a7422b
commit 950e4e1bc8
2 changed files with 16 additions and 0 deletions

View File

@ -71,5 +71,13 @@ func (p *Provider) isApproved(event *types.Event, plan *UpdatePlan) (bool, error
return false, err return false, err
} }
if event.Repository.Digest != "" && event.Repository.Digest != existing.Digest {
err = p.approvalManager.Reset(existing)
if err != nil {
return false, fmt.Errorf("failed to reset approval after changed digest, error %s", err)
}
return false, nil
}
return existing.Status() == types.ApprovalStatusApproved, nil return existing.Status() == types.ApprovalStatusApproved, nil
} }

View File

@ -100,5 +100,13 @@ func (p *Provider) isApproved(event *types.Event, plan *UpdatePlan) (bool, error
return false, err return false, err
} }
if event.Repository.Digest != "" && event.Repository.Digest != existing.Digest {
err = p.approvalManager.Reset(existing)
if err != nil {
return false, fmt.Errorf("failed to reset approval after changed digest, error %s", err)
}
return false, nil
}
return existing.Status() == types.ApprovalStatusApproved, nil return existing.Status() == types.ApprovalStatusApproved, nil
} }