Skip to content

Some fixes for the patch_blog_post rake task

Reuben Pereira requested to merge rp/combined-patch-release-fixes into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Content

  • Create blog post MR at the end of release:patch_blog_post rake task.

  • Add security remote to Cves project.

    The Cves project does not have a security mirror, so the security remote will point to the canonical project.

    This is required so that Project::Cves.to_s does not fail. The to_s method returns the security_path when a security release is ongoing.

gitlab-com/gl-infra/delivery#19719 (closed)

Testing

Diff used for testing
diff --git a/lib/release_tools/patch_release/blog_merge_request.rb b/lib/release_tools/patch_release/blog_merge_request.rb
index 58de8953..d8d5ea2f 100644
--- a/lib/release_tools/patch_release/blog_merge_request.rb
+++ b/lib/release_tools/patch_release/blog_merge_request.rb
@@ -153,7 +153,12 @@ module ReleaseTools
       end
 
       def patch_issue
-        @patch_issue ||= Issue.new
+        @patch_issue ||=
+          if includes_security_content?
+            Security::TrackingIssue.new(Security::IssueCrawler.new.release_issue.to_h)
+          else
+            Issue.new
+          end
       end
 
       def release_managers
@@ -191,7 +196,8 @@ module ReleaseTools
       end
 
       def combined_blog_post?
-        Feature.enabled?(:combined_blog_post)
+        true
+        # Feature.enabled?(:combined_blog_post)
       end
 
       def includes_security_content?
diff --git a/lib/release_tools/security/tracking_issue.rb b/lib/release_tools/security/tracking_issue.rb
index 77d39065..53fc68d6 100644
--- a/lib/release_tools/security/tracking_issue.rb
+++ b/lib/release_tools/security/tracking_issue.rb
@@ -33,14 +33,15 @@ module ReleaseTools
       end
 
       def versions_title
-        versions = [
-          next_version,
-          ReleaseTools::Versions.next_versions.take(2)
-        ].flatten
-
-        versions.map! do |version|
-          version.sub(/\d+$/, 'x')
-        end.join(', ')
+        # versions = [
+        #   next_version,
+        #   ReleaseTools::Versions.next_versions.take(2)
+        # ].flatten
+        #
+        # versions.map! do |version|
+        #   version.sub(/\d+$/, 'x')
+        # end.join(', ')
+        '16.5.x, 16.4.x, 16.3.x'
       end
 
       # Regular Security Releases are performed in the next milestone of the
@@ -82,7 +83,7 @@ module ReleaseTools
       end
 
       def next_version
-        @next_version ||= ReleaseTools::Version.new(ReleaseTools::ProductMilestone.current.title)
+        @next_version ||= ReleaseTools::Version.new(ReleaseTools::ProductMilestone.next.title)
       end
     end
   end

I ran the rake task with the above local changes.

SECURITY=true RELEASE_BOT_PRODUCTION_TOKEN='token' RELEASE_BOT_VERSION_TOKEN='token' bundle exec rake 'release:patch_blog_post[]'

The following MR was created: https://gitlab.com/gitlab-org/security/www-gitlab-com/-/merge_requests/154

Author Check-list

  • Has documentation been updated?
Edited by Reuben Pereira

Merge request reports