When a Release is created, determine if it is a Release, an Upcoming Release or a Historical Release. Passing the released_at
field to the API is the deciding factor.
The existing after_commit
hook on Release will be removed, and instead the CreateEvidenceWorker
call will be made in the API controller, after the Release object is successfully created.
after_commit :create_evidence!, on: :create, unless: :importing?
https://gitlab.com/gitlab-org/gitlab/blob/master/lib/api/releases.rb#L68-70
Current Release
If the released_at
field is not passed, it is defaulted to the current timestamp and the Evidence is created. The CreateEvidenceWorker
will be scheduled as perform_async
.
Upcoming Release
If a future released_at
timestamp is provided via the API, the CreateEvidenceWorker
will be scheduled for the future timestamp using the Sidekiq Scheduled Jobs feature, noting that it may not run exactly at the provided released_at
timestamp.
Historical Release
If the released_at
timestamp is provided and is in the past, an Evidence object will not be provided for this release.
Upcoming Releases are indicated as such, until the released_at
date passes. This is already implemented and not added by this MR.
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
@gitlab-com/gl-security/appsec
Part of #38103 (closed)