Skip to content

Remove calling ExpirePipelineCacheWorker from BuildFinishedWorker

Furkan Ayhan requested to merge 322848-remove-calling-pipeline-cache into master

What does this MR do?

After !54937 (merged), ExpireJobCacheWorker started calling ExpirePipelineCacheWorker, so we decided to create an issue(#322848 (closed)) to remove the redundant call from BuildFinishedWorker.

Screenshots (strongly suggested)

I made some loggings to confirm:

diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 3d8e9f4c126..76ad9cdce51 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -311,6 +311,8 @@ def with_preloads
         build.run_after_commit do
           build.run_status_commit_hooks!

+          ap "Build after_transition: #{build.name} #{build.status}"
+
           BuildFinishedWorker.perform_async(id)
         end
       end
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index e989129209a..45d9592fd88 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -174,6 +174,8 @@ class CommitStatus < ApplicationRecord
       next if commit_status.processed?
       next unless commit_status.project

+      ap "CommitStatus after_transition: #{commit_status.name} #{commit_status.status}"
+
       commit_status.run_after_commit do
         PipelineProcessWorker.perform_async(pipeline_id)
         ExpireJobCacheWorker.perform_async(id)
2021-04-19_12:46:00.15692 rails-background-jobs : "CommitStatus after_transition: build pending"
2021-04-19_12:46:05.93798 rails-web             : "CommitStatus after_transition: build running"
2021-04-19_12:46:11.69952 rails-web             : "CommitStatus after_transition: build success"
2021-04-19_12:46:12.06008 rails-web             : "Build after_transition: build success"
2021-04-19_12:46:13.09864 rails-background-jobs : "CommitStatus after_transition: test pending"
2021-04-19_12:46:13.60807 rails-web             : "CommitStatus after_transition: test running"
2021-04-19_12:46:16.87725 rails-web             : "CommitStatus after_transition: test success"
2021-04-19_12:46:16.89855 rails-web             : "Build after_transition: test success"
2021-04-19_12:46:17.70674 rails-background-jobs : "CommitStatus after_transition: post_test pending"
2021-04-19_12:46:18.09188 rails-web             : "CommitStatus after_transition: post_test running"
2021-04-19_12:46:21.25245 rails-web             : "CommitStatus after_transition: post_test success"
2021-04-19_12:46:21.26512 rails-web             : "Build after_transition: post_test success"
2021-04-19_12:46:22.03768 rails-background-jobs : "CommitStatus after_transition: deploy pending"
2021-04-19_12:46:22.42859 rails-web             : "CommitStatus after_transition: deploy running"
2021-04-19_12:46:25.30106 rails-web             : "CommitStatus after_transition: deploy success"
2021-04-19_12:46:25.31157 rails-web             : "Build after_transition: deploy success"

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

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:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Merge request reports

Loading