From de1f7725b0b7c48826a16f6d410395707db7a344 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 25 Aug 2021 11:54:49 +0200 Subject: [PATCH 01/79] Skip git submodules when not necessary --- lib/shipit/stack_commands.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/shipit/stack_commands.rb b/lib/shipit/stack_commands.rb index f5d479eca..7182fe0b9 100644 --- a/lib/shipit/stack_commands.rb +++ b/lib/shipit/stack_commands.rb @@ -48,12 +48,12 @@ def fetch_deployed_revision end def build_cacheable_deploy_spec - with_temporary_working_directory do |dir| + with_temporary_working_directory(recursive: false) do |dir| DeploySpec::FileSystem.new(dir, @stack.environment).cacheable end end - def with_temporary_working_directory(commit: nil) + def with_temporary_working_directory(commit: nil, recursive: true) commit ||= @stack.last_deployed_commit.presence || @stack.commits.reachable.last if !commit || !fetched?(commit).tap(&:run).success? @@ -64,10 +64,12 @@ def with_temporary_working_directory(commit: nil) end end + git_args = [] + git_args << '--recursive' if recursive Dir.mktmpdir do |dir| git( 'clone', @stack.git_path, @stack.repo_name, - '--recursive', '--origin', 'cache', + *git_args, '--origin', 'cache', chdir: dir ).run! From 7963319d699422d318134fd005375d31a663c2a7 Mon Sep 17 00:00:00 2001 From: stephsachrajda Date: Thu, 4 Aug 2022 18:10:33 -0600 Subject: [PATCH 02/79] make refresh actions match --- app/controllers/shipit/api/stacks_controller.rb | 2 ++ test/controllers/api/stacks_controller_test.rb | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/app/controllers/shipit/api/stacks_controller.rb b/app/controllers/shipit/api/stacks_controller.rb index 9d5b1ab14..112a4effb 100644 --- a/app/controllers/shipit/api/stacks_controller.rb +++ b/app/controllers/shipit/api/stacks_controller.rb @@ -62,6 +62,8 @@ def destroy end def refresh + RefreshStatusesJob.perform_later(stack_id: stack.id) + RefreshCheckRunsJob.perform_later(stack_id: stack.id) GithubSyncJob.perform_later(stack_id: stack.id) render_resource(stack, status: :accepted) end diff --git a/test/controllers/api/stacks_controller_test.rb b/test/controllers/api/stacks_controller_test.rb index 4148f5316..2159a0cdd 100644 --- a/test/controllers/api/stacks_controller_test.rb +++ b/test/controllers/api/stacks_controller_test.rb @@ -214,6 +214,15 @@ class StacksControllerTest < ActionController::TestCase end assert_response :accepted end + + test "#refresh queues a RefreshStatusesJob and RefreshCheckRunsJob" do + assert_enqueued_with(job: RefreshStatusesJob, args: [stack_id: @stack.id]) do + assert_enqueued_with(job: RefreshCheckRunsJob, args: [stack_id: @stack.id]) do + post :refresh, params: { id: @stack.to_param } + end + end + assert_response :accepted + end end end end From beee24a4f3f5aa93cdd6d14bbe122552927c7656 Mon Sep 17 00:00:00 2001 From: Ates Goral Date: Mon, 8 Aug 2022 23:16:59 -0400 Subject: [PATCH 03/79] Add --quiet switches to checkouts --- lib/shipit/stack_commands.rb | 9 ++++++++- lib/shipit/task_commands.rb | 9 ++++++++- test/unit/deploy_commands_test.rb | 6 +++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/shipit/stack_commands.rb b/lib/shipit/stack_commands.rb index 54dc04af9..d35420506 100644 --- a/lib/shipit/stack_commands.rb +++ b/lib/shipit/stack_commands.rb @@ -72,7 +72,14 @@ def with_temporary_working_directory(commit: nil) ).run! git_dir = File.join(dir, @stack.repo_name) - git('-c', 'advice.detachedHead=false', 'checkout', commit.sha, chdir: git_dir).run! if commit + git( + '-c', + 'advice.detachedHead=false', + 'checkout', + '--quiet', + commit.sha, + chdir: git_dir + ).run! if commit yield Pathname.new(git_dir) end end diff --git a/lib/shipit/task_commands.rb b/lib/shipit/task_commands.rb index 7cb54b7f4..67a41585c 100644 --- a/lib/shipit/task_commands.rb +++ b/lib/shipit/task_commands.rb @@ -47,7 +47,14 @@ def env end def checkout(commit) - git('-c', 'advice.detachedHead=false', 'checkout', commit.sha, chdir: @task.working_directory) + git( + '-c', + 'advice.detachedHead=false', + 'checkout', + '--quiet', + commit.sha, + chdir: @task.working_directory + ) end def clone diff --git a/test/unit/deploy_commands_test.rb b/test/unit/deploy_commands_test.rb index 48adabe91..626052a04 100644 --- a/test/unit/deploy_commands_test.rb +++ b/test/unit/deploy_commands_test.rb @@ -134,7 +134,11 @@ def setup test "#checkout checks out the deployed commit" do command = @commands.checkout(@deploy.until_commit) - assert_equal ['git', '-c', 'advice.detachedHead=false', 'checkout', @deploy.until_commit.sha], command.args + checkout_args = [ + 'git', '-c', 'advice.detachedHead=false', 'checkout', '--quiet', + @deploy.until_commit.sha, + ] + assert_equal checkout_args, command.args end test "#checkout checks out the deployed commit from the working directory" do From 7ec513dc7156e6e8ec9e2bc1aa548874e6b3f53c Mon Sep 17 00:00:00 2001 From: Ates Goral Date: Tue, 9 Aug 2022 17:11:17 -0400 Subject: [PATCH 04/79] Update CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61bbaf0c0..8ff860eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Unreleased +# 0.37.0 + +* Suppress progress output for git checkout (#1278) +* Make API refresh action match non-API refresh action for stacks (#1277) + # 0.36.1 * Fix compatibility with Rails 7.0.3.1 (YAML serialized fields). (#1273) From 4a3cf136be5516d5487af8c60abd5471ae3b52db Mon Sep 17 00:00:00 2001 From: Ates Goral Date: Tue, 9 Aug 2022 17:17:10 -0400 Subject: [PATCH 05/79] Bump version --- Gemfile.lock | 24 ++++++++++++------------ lib/shipit/version.rb | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 50b6deeed..b21c4287e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - shipit-engine (0.36.1) + shipit-engine (0.37.0) active_model_serializers (~> 0.9.3) ansi_stream (~> 0.0.6) autoprefixer-rails (~> 6.4.1) @@ -132,7 +132,7 @@ GEM digest (3.1.0) docile (1.4.0) equalizer (0.0.11) - erubi (1.10.0) + erubi (1.11.0) execjs (2.8.1) explicit-parameters (0.4.1) actionpack (>= 6.0) @@ -140,7 +140,7 @@ GEM virtus (~> 1.0) faker (2.20.0) i18n (>= 1.8.11, < 2) - faraday (1.10.0) + faraday (1.10.1) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -155,7 +155,7 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) - faraday-http-cache (2.4.0) + faraday-http-cache (2.4.1) faraday (>= 0.8) faraday-httpclient (1.0.1) faraday-multipart (1.0.4) @@ -196,7 +196,7 @@ GEM libv8-node (~> 16.10.0.0) minitest (5.16.2) mocha (1.13.0) - msgpack (1.5.3) + msgpack (1.5.4) multi_xml (0.6.0) multipart-post (2.2.3) mysql2 (0.5.3) @@ -215,11 +215,11 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.13.7-arm64-darwin) + nokogiri (1.13.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.13.7-x86_64-darwin) + nokogiri (1.13.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.13.7-x86_64-linux) + nokogiri (1.13.8-x86_64-linux) racc (~> 1.4) oauth2 (2.0.6) faraday (>= 0.17.3, < 3.0) @@ -240,7 +240,7 @@ GEM omniauth-oauth2 (1.7.3) oauth2 (>= 1.4, < 3) omniauth (>= 1.9, < 3) - paquito (0.6.1) + paquito (0.7.0) msgpack (>= 1.5.2) parallel (1.21.0) parser (3.1.1.0) @@ -352,12 +352,12 @@ GEM state_machines-activerecord (0.8.0) activerecord (>= 5.1) state_machines-activemodel (>= 0.8.0) - strscan (3.0.3) + strscan (3.0.4) thor (1.2.1) thread_safe (0.3.6) - tilt (2.0.10) + tilt (2.0.11) timeout (0.3.0) - tzinfo (2.0.4) + tzinfo (2.0.5) concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) validate_url (1.0.15) diff --git a/lib/shipit/version.rb b/lib/shipit/version.rb index c3d2009a2..2124dbe3c 100644 --- a/lib/shipit/version.rb +++ b/lib/shipit/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Shipit - VERSION = '0.36.1' + VERSION = '0.37.0' end From 63cf99d6c5970e52d771633629f7e7b328d7c60c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Aug 2022 18:49:50 +0000 Subject: [PATCH 06/79] Bump omniauth from 1.9.1 to 1.9.2 Bumps [omniauth](https://github.com/omniauth/omniauth) from 1.9.1 to 1.9.2. - [Release notes](https://github.com/omniauth/omniauth/releases) - [Commits](https://github.com/omniauth/omniauth/compare/v1.9.1...v1.9.2) --- updated-dependencies: - dependency-name: omniauth dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b21c4287e..a917dc229 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -231,7 +231,7 @@ GEM octokit (4.25.1) faraday (>= 1, < 3) sawyer (~> 0.9) - omniauth (1.9.1) + omniauth (1.9.2) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) omniauth-github (1.4.0) From 18ce1752f2c729b8ebf6ad35802747e82336632e Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 15 Sep 2022 12:07:43 +0200 Subject: [PATCH 07/79] Improve API tests We need to pass `as: :json` otherwise AC::TestCase will simulate www-form-encoded payloads, which don't support boolean and other rich JSON types. That bing said, this change still isn't quite representative of what happens in production, but it should be good enough. --- test/controllers/api/base_controller_test.rb | 2 +- test/controllers/api/ccmenu_controller_test.rb | 2 +- test/controllers/api/commits_controller_test.rb | 2 +- test/controllers/api/deploys_controller_test.rb | 2 +- test/controllers/api/hooks_controller_test.rb | 2 +- test/controllers/api/locks_controller_test.rb | 2 +- .../api/merge_requests_controller_test.rb | 2 +- test/controllers/api/outputs_controller_test.rb | 2 +- .../api/release_statuses_controller_test.rb | 2 +- test/controllers/api/rollback_controller_test.rb | 2 +- test/controllers/api/stacks_controller_test.rb | 2 +- test/controllers/api/tasks_controller_test.rb | 2 +- test/helpers/api_helper.rb | 13 +++++++++++++ 13 files changed, 25 insertions(+), 12 deletions(-) diff --git a/test/controllers/api/base_controller_test.rb b/test/controllers/api/base_controller_test.rb index a37d0211a..348514a46 100644 --- a/test/controllers/api/base_controller_test.rb +++ b/test/controllers/api/base_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class BaseControllerTest < ActionController::TestCase + class BaseControllerTest < ApiControllerTestCase test "authentication is required" do get :index assert_response :unauthorized diff --git a/test/controllers/api/ccmenu_controller_test.rb b/test/controllers/api/ccmenu_controller_test.rb index 76c695c72..ba3dbdf2a 100644 --- a/test/controllers/api/ccmenu_controller_test.rb +++ b/test/controllers/api/ccmenu_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class CCMenuControllerTest < ActionController::TestCase + class CCMenuControllerTest < ApiControllerTestCase setup do authenticate! @stack = shipit_stacks(:shipit) diff --git a/test/controllers/api/commits_controller_test.rb b/test/controllers/api/commits_controller_test.rb index 607deea37..793216eae 100644 --- a/test/controllers/api/commits_controller_test.rb +++ b/test/controllers/api/commits_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class CommitsControllerTest < ActionController::TestCase + class CommitsControllerTest < ApiControllerTestCase setup do @stack = shipit_stacks(:shipit) authenticate! diff --git a/test/controllers/api/deploys_controller_test.rb b/test/controllers/api/deploys_controller_test.rb index 770281582..dc89c73da 100644 --- a/test/controllers/api/deploys_controller_test.rb +++ b/test/controllers/api/deploys_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class DeploysControllerTest < ActionController::TestCase + class DeploysControllerTest < ApiControllerTestCase setup do authenticate! @user = shipit_users(:walrus) diff --git a/test/controllers/api/hooks_controller_test.rb b/test/controllers/api/hooks_controller_test.rb index 2d19780c8..a577f6a05 100644 --- a/test/controllers/api/hooks_controller_test.rb +++ b/test/controllers/api/hooks_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class HooksControllerTest < ActionController::TestCase + class HooksControllerTest < ApiControllerTestCase setup do authenticate! @stack = shipit_stacks(:shipit) diff --git a/test/controllers/api/locks_controller_test.rb b/test/controllers/api/locks_controller_test.rb index 3ba27867f..faf47aeb1 100644 --- a/test/controllers/api/locks_controller_test.rb +++ b/test/controllers/api/locks_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class LocksControllerTest < ActionController::TestCase + class LocksControllerTest < ApiControllerTestCase setup do authenticate! @stack = shipit_stacks(:shipit) diff --git a/test/controllers/api/merge_requests_controller_test.rb b/test/controllers/api/merge_requests_controller_test.rb index 59f7a8d59..7ed252cdd 100644 --- a/test/controllers/api/merge_requests_controller_test.rb +++ b/test/controllers/api/merge_requests_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class MergeRequestsControllerTest < ActionController::TestCase + class MergeRequestsControllerTest < ApiControllerTestCase setup do @stack = shipit_stacks(:shipit) @merge_request = shipit_merge_requests(:shipit_pending) diff --git a/test/controllers/api/outputs_controller_test.rb b/test/controllers/api/outputs_controller_test.rb index a4a730e40..a2c158e93 100644 --- a/test/controllers/api/outputs_controller_test.rb +++ b/test/controllers/api/outputs_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class OutputsControllerTest < ActionController::TestCase + class OutputsControllerTest < ApiControllerTestCase setup do @stack = shipit_stacks(:shipit) authenticate! diff --git a/test/controllers/api/release_statuses_controller_test.rb b/test/controllers/api/release_statuses_controller_test.rb index bccd076c0..7af530290 100644 --- a/test/controllers/api/release_statuses_controller_test.rb +++ b/test/controllers/api/release_statuses_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class ReleaseStatusesControllerTest < ActionController::TestCase + class ReleaseStatusesControllerTest < ApiControllerTestCase setup do authenticate! @stack = shipit_stacks(:shipit_canaries) diff --git a/test/controllers/api/rollback_controller_test.rb b/test/controllers/api/rollback_controller_test.rb index 60988db22..0f9af7be8 100644 --- a/test/controllers/api/rollback_controller_test.rb +++ b/test/controllers/api/rollback_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class RollbacksControllerTest < ActionController::TestCase + class RollbacksControllerTest < ApiControllerTestCase setup do authenticate! @user = shipit_users(:walrus) diff --git a/test/controllers/api/stacks_controller_test.rb b/test/controllers/api/stacks_controller_test.rb index 2159a0cdd..5509d8e29 100644 --- a/test/controllers/api/stacks_controller_test.rb +++ b/test/controllers/api/stacks_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class StacksControllerTest < ActionController::TestCase + class StacksControllerTest < ApiControllerTestCase setup do authenticate! @stack = shipit_stacks(:shipit) diff --git a/test/controllers/api/tasks_controller_test.rb b/test/controllers/api/tasks_controller_test.rb index 4c0701378..4649e413d 100644 --- a/test/controllers/api/tasks_controller_test.rb +++ b/test/controllers/api/tasks_controller_test.rb @@ -3,7 +3,7 @@ module Shipit module Api - class TasksControllerTest < ActionController::TestCase + class TasksControllerTest < ApiControllerTestCase setup do @stack = shipit_stacks(:shipit) @user = shipit_users(:walrus) diff --git a/test/helpers/api_helper.rb b/test/helpers/api_helper.rb index 909969dfa..45665a007 100644 --- a/test/helpers/api_helper.rb +++ b/test/helpers/api_helper.rb @@ -8,3 +8,16 @@ def authenticate!(client = @client || :spy) request.headers['Authorization'] = "Basic #{Base64.encode64(client.authentication_token)}" end end + +module Shipit + class ApiControllerTestCase < ActionController::TestCase + private + + def process(_action, **kwargs) + if kwargs[:method] != "GET" + kwargs[:as] ||= :json + end + super + end + end +end From 1ac6936e644b2a1bf5ba89d463411f30f1954fc9 Mon Sep 17 00:00:00 2001 From: Mikail Karimi Date: Tue, 13 Sep 2022 16:56:16 -0400 Subject: [PATCH 08/79] Add lock and archive functionality to the stack update API call Add more tests to guarantee right behiviour of API --- .../shipit/api/stacks_controller.rb | 26 +++++++++- .../controllers/api/stacks_controller_test.rb | 51 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/app/controllers/shipit/api/stacks_controller.rb b/app/controllers/shipit/api/stacks_controller.rb index 112a4effb..ffcec1215 100644 --- a/app/controllers/shipit/api/stacks_controller.rb +++ b/app/controllers/shipit/api/stacks_controller.rb @@ -46,9 +46,13 @@ def create accepts :ignore_ci, Boolean accepts :merge_queue_enabled, Boolean accepts :continuous_deployment, Boolean + accepts :archived, Boolean end def update - stack.update(params) + stack.update(update_params) + + update_archived + render_resource(stack) end @@ -78,6 +82,26 @@ def stack @stack ||= stacks.from_param!(params[:id]) end + def update_archived + if key?(:archived) + if params[:archived] + stack.archive!(nil) + elsif stack.archived? + stack.unarchive! + end + end + end + + def key?(key) + params.to_h.key?(key) + end + + def update_params + params.select do |key, _| + %i(environment branch deploy_url ignore_ci merge_queue_enabled continuous_deployment).include?(key) + end + end + def repository @repository ||= Repository.find_or_create_by(owner: repo_owner, name: repo_name) end diff --git a/test/controllers/api/stacks_controller_test.rb b/test/controllers/api/stacks_controller_test.rb index 5509d8e29..0586d221a 100644 --- a/test/controllers/api/stacks_controller_test.rb +++ b/test/controllers/api/stacks_controller_test.rb @@ -114,6 +114,57 @@ class StacksControllerTest < ApiControllerTestCase refute @stack.continuous_deployment end + test "#update does not perform archive when key is not provided" do + refute_predicate @stack, :archived? + refute_predicate @stack, :locked? + + patch :update, params: { id: @stack.to_param } + + @stack.reload + refute_predicate @stack, :archived? + refute_predicate @stack, :locked? + end + + test "#update does not perform unarchive when key is not provided" do + @stack.archive!(shipit_users(:walrus)) + assert_predicate @stack, :locked? + assert_predicate @stack, :archived? + + patch :update, params: { id: @stack.to_param } + + @stack.reload + assert_predicate @stack, :locked? + assert_predicate @stack, :archived? + end + + test "#update allows to archive the stack" do + refute_predicate @stack, :archived? + refute_predicate @stack, :locked? + + patch :update, params: { id: @stack.to_param, archived: true } + + @stack.reload + assert_predicate @stack, :locked? + assert_predicate @stack, :archived? + assert_instance_of AnonymousUser, @stack.lock_author + assert_equal "Archived", @stack.lock_reason + end + + test "#update allows to unarchive the stack" do + @stack.archive!(shipit_users(:walrus)) + assert_predicate @stack, :locked? + assert_predicate @stack, :archived? + + patch :update, params: { id: @stack.to_param, archived: false } + + @stack.reload + refute_predicate @stack, :archived? + refute_predicate @stack, :locked? + assert_nil @stack.locked_since + assert_nil @stack.lock_reason + assert_instance_of AnonymousUser, @stack.lock_author + end + test "#index returns a list of stacks" do stack = Stack.last get :index From 0f59d3abb5dfecf677afd50ea52a6ee11f4a861f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Dec 2022 21:52:18 +0000 Subject: [PATCH 09/79] Bump loofah from 2.18.0 to 2.19.1 Bumps [loofah](https://github.com/flavorjones/loofah) from 2.18.0 to 2.19.1. - [Release notes](https://github.com/flavorjones/loofah/releases) - [Changelog](https://github.com/flavorjones/loofah/blob/main/CHANGELOG.md) - [Commits](https://github.com/flavorjones/loofah/compare/v2.18.0...v2.19.1) --- updated-dependencies: - dependency-name: loofah dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b21c4287e..bd127d8ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -184,7 +184,7 @@ GEM libv8-node (16.10.0.0-x86_64-linux) lodash-rails (4.17.21) railties (>= 3.1) - loofah (2.18.0) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -215,11 +215,11 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.13.8-arm64-darwin) + nokogiri (1.13.10-arm64-darwin) racc (~> 1.4) - nokogiri (1.13.8-x86_64-darwin) + nokogiri (1.13.10-x86_64-darwin) racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) + nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) oauth2 (2.0.6) faraday (>= 0.17.3, < 3.0) @@ -253,7 +253,7 @@ GEM pubsubstub (0.2.2) rack redis (~> 4.0) - racc (1.6.0) + racc (1.6.1) rack (2.2.4) rack-test (2.0.2) rack (>= 1.3) From 16b5e9171ba578e0df7a5ccfb8df57b9391475f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Dec 2022 07:39:23 +0000 Subject: [PATCH 10/79] Bump rails-html-sanitizer from 1.4.3 to 1.4.4 Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.4.3 to 1.4.4. - [Release notes](https://github.com/rails/rails-html-sanitizer/releases) - [Changelog](https://github.com/rails/rails-html-sanitizer/blob/master/CHANGELOG.md) - [Commits](https://github.com/rails/rails-html-sanitizer/compare/v1.4.3...v1.4.4) --- updated-dependencies: - dependency-name: rails-html-sanitizer dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bd127d8ab..6a25b67fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -274,8 +274,8 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) rails-timeago (2.13.0) actionpack (>= 3.1) activesupport (>= 3.1) From 0a45d04df914779961eda947aae2b8befbe28679 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 19:15:34 +0000 Subject: [PATCH 11/79] Bump activerecord from 7.0.3.1 to 7.0.4.1 Bumps [activerecord](https://github.com/rails/rails) from 7.0.3.1 to 7.0.4.1. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.0.4.1/activerecord/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.0.3.1...v7.0.4.1) --- updated-dependencies: - dependency-name: activerecord dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 112 +++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fe1ad767f..861aa2379 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,47 +33,47 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) + actioncable (7.0.4.1) + actionpack (= 7.0.4.1) + activesupport (= 7.0.4.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionmailbox (7.0.4.1) + actionpack (= 7.0.4.1) + activejob (= 7.0.4.1) + activerecord (= 7.0.4.1) + activestorage (= 7.0.4.1) + activesupport (= 7.0.4.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.3.1) - actionpack (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionmailer (7.0.4.1) + actionpack (= 7.0.4.1) + actionview (= 7.0.4.1) + activejob (= 7.0.4.1) + activesupport (= 7.0.4.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.3.1) - actionview (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionpack (7.0.4.1) + actionview (= 7.0.4.1) + activesupport (= 7.0.4.1) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.3.1) - actionpack (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + actiontext (7.0.4.1) + actionpack (= 7.0.4.1) + activerecord (= 7.0.4.1) + activestorage (= 7.0.4.1) + activesupport (= 7.0.4.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.3.1) - activesupport (= 7.0.3.1) + actionview (7.0.4.1) + activesupport (= 7.0.4.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -81,22 +81,22 @@ GEM active_model_serializers (0.9.8) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.0.3.1) - activesupport (= 7.0.3.1) + activejob (7.0.4.1) + activesupport (= 7.0.4.1) globalid (>= 0.3.6) - activemodel (7.0.3.1) - activesupport (= 7.0.3.1) - activerecord (7.0.3.1) - activemodel (= 7.0.3.1) - activesupport (= 7.0.3.1) - activestorage (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activesupport (= 7.0.3.1) + activemodel (7.0.4.1) + activesupport (= 7.0.4.1) + activerecord (7.0.4.1) + activemodel (= 7.0.4.1) + activesupport (= 7.0.4.1) + activestorage (7.0.4.1) + actionpack (= 7.0.4.1) + activejob (= 7.0.4.1) + activerecord (= 7.0.4.1) + activesupport (= 7.0.4.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.3.1) + activesupport (7.0.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -171,10 +171,10 @@ GEM activesupport (>= 5.0) hashdiff (1.0.1) hashie (5.0.0) - i18n (1.11.0) + i18n (1.12.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - jquery-rails (4.5.0) + jquery-rails (4.5.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -194,7 +194,7 @@ GEM mini_mime (1.1.2) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.16.2) + minitest (5.17.0) mocha (1.13.0) msgpack (1.5.4) multi_xml (0.6.0) @@ -257,20 +257,20 @@ GEM rack (2.2.4) rack-test (2.0.2) rack (>= 1.3) - rails (7.0.3.1) - actioncable (= 7.0.3.1) - actionmailbox (= 7.0.3.1) - actionmailer (= 7.0.3.1) - actionpack (= 7.0.3.1) - actiontext (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activemodel (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + rails (7.0.4.1) + actioncable (= 7.0.4.1) + actionmailbox (= 7.0.4.1) + actionmailer (= 7.0.4.1) + actionpack (= 7.0.4.1) + actiontext (= 7.0.4.1) + actionview (= 7.0.4.1) + activejob (= 7.0.4.1) + activemodel (= 7.0.4.1) + activerecord (= 7.0.4.1) + activestorage (= 7.0.4.1) + activesupport (= 7.0.4.1) bundler (>= 1.15.0) - railties (= 7.0.3.1) + railties (= 7.0.4.1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -281,9 +281,9 @@ GEM activesupport (>= 3.1) rails_autolink (1.1.6) rails (> 3.1) - railties (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) + railties (7.0.4.1) + actionpack (= 7.0.4.1) + activesupport (= 7.0.4.1) method_source rake (>= 12.2) thor (~> 1.0) From ddf7fbd2d39c670b90f866ea20fbbb475dacdc37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 08:55:54 +0000 Subject: [PATCH 12/79] Bump rack from 2.2.4 to 2.2.6.2 Bumps [rack](https://github.com/rack/rack) from 2.2.4 to 2.2.6.2. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/2.2.4...v2.2.6.2) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 861aa2379..f71683457 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -254,7 +254,7 @@ GEM rack redis (~> 4.0) racc (1.6.1) - rack (2.2.4) + rack (2.2.6.2) rack-test (2.0.2) rack (>= 1.3) rails (7.0.4.1) From 1fca0dd71b54979722fbb24ec335e2cc48479423 Mon Sep 17 00:00:00 2001 From: stephsachrajda Date: Thu, 23 Feb 2023 17:18:28 -0700 Subject: [PATCH 13/79] hide the api token after 5 minutes --- app/helpers/shipit/api_clients_helper.rb | 12 ++++++++++++ app/views/shipit/api_clients/show.html.erb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/helpers/shipit/api_clients_helper.rb diff --git a/app/helpers/shipit/api_clients_helper.rb b/app/helpers/shipit/api_clients_helper.rb new file mode 100644 index 000000000..1b55fc169 --- /dev/null +++ b/app/helpers/shipit/api_clients_helper.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true +module Shipit + module ApiClientsHelper + def api_client_token(api_client) + if api_client.created_at >= 5.minutes.ago && current_user == api_client.creator + api_client.authentication_token + else + "#{api_client.authentication_token[0..5]}************************" + end + end + end +end diff --git a/app/views/shipit/api_clients/show.html.erb b/app/views/shipit/api_clients/show.html.erb index 0bcfe40f5..3c515c90d 100644 --- a/app/views/shipit/api_clients/show.html.erb +++ b/app/views/shipit/api_clients/show.html.erb @@ -10,7 +10,7 @@

Authentication token:

- <%= @api_client.authentication_token %> + <%= api_client_token(@api_client) %>
From 946263e2b695a240a56d1ceaa55c8eb02457a12c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Mar 2023 03:47:51 +0000 Subject: [PATCH 14/79] Bump rack from 2.2.6.2 to 2.2.6.3 Bumps [rack](https://github.com/rack/rack) from 2.2.6.2 to 2.2.6.3. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.6.2...v2.2.6.3) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f71683457..18afd765f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -254,7 +254,7 @@ GEM rack redis (~> 4.0) racc (1.6.1) - rack (2.2.6.2) + rack (2.2.6.3) rack-test (2.0.2) rack (>= 1.3) rails (7.0.4.1) From 9cbfe38054373711d5b031a07611c85031673d6b Mon Sep 17 00:00:00 2001 From: Ruidan Date: Tue, 14 Mar 2023 18:03:57 -0400 Subject: [PATCH 15/79] Add fetch_commit during checkout_repository --- app/models/shipit/task_execution_strategy/default.rb | 1 + lib/shipit/stack_commands.rb | 6 ++++++ lib/shipit/task_commands.rb | 2 +- test/unit/deploy_commands_test.rb | 9 +++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/models/shipit/task_execution_strategy/default.rb b/app/models/shipit/task_execution_strategy/default.rb index 72e52554d..cc105f17b 100644 --- a/app/models/shipit/task_execution_strategy/default.rb +++ b/app/models/shipit/task_execution_strategy/default.rb @@ -71,6 +71,7 @@ def checkout_repository @task.ping unless @commands.fetched?(@task.until_commit).tap(&:run).success? capture!(@commands.fetch) + capture!(@commands.fetch_commit(@task.until_commit)) end end end diff --git a/lib/shipit/stack_commands.rb b/lib/shipit/stack_commands.rb index d35420506..f6a201e93 100644 --- a/lib/shipit/stack_commands.rb +++ b/lib/shipit/stack_commands.rb @@ -23,6 +23,12 @@ def fetch end end + def fetch_commit(commit) + if valid_git_repository?(@stack.git_path) + git('fetch', 'origin', '--quiet', '--tags', commit.sha, env: env, chdir: @stack.git_path) + end + end + def fetched?(commit) if valid_git_repository?(@stack.git_path) git('rev-parse', '--quiet', '--verify', "#{commit.sha}^{commit}", env: env, chdir: @stack.git_path) diff --git a/lib/shipit/task_commands.rb b/lib/shipit/task_commands.rb index 67a41585c..aaa7514a1 100644 --- a/lib/shipit/task_commands.rb +++ b/lib/shipit/task_commands.rb @@ -2,7 +2,7 @@ # rubocop:disable Lint/MissingSuper module Shipit class TaskCommands < Commands - delegate :fetch, :fetched?, to: :stack_commands + delegate :fetch, :fetched?, :fetch_commit, to: :stack_commands def initialize(task) @task = task diff --git a/test/unit/deploy_commands_test.rb b/test/unit/deploy_commands_test.rb index 626052a04..0d4bba6e9 100644 --- a/test/unit/deploy_commands_test.rb +++ b/test/unit/deploy_commands_test.rb @@ -30,6 +30,15 @@ def setup assert_equal %w(git fetch origin --quiet --tags master), command.args end + test "#fetch calls git fetch_commit if repository cache already exist" do + @stack.git_path.stubs(:exist?).returns(true) + @stack.git_path.stubs(:empty?).returns(false) + + command = @commands.fetch_commit(@deploy.until_commit) + + assert_equal %w(git fetch origin --quiet --tags 467578b362bf2b4df5903e1c7960929361c3435a), command.args + end + test "#fetch calls git fetch in git_path directory if repository cache already exist" do @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) From d6e51161c7ac5d7d7b36a1de95faae701da72675 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Tue, 14 Mar 2023 18:08:23 -0400 Subject: [PATCH 16/79] Update test --- test/unit/deploy_commands_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/deploy_commands_test.rb b/test/unit/deploy_commands_test.rb index 0d4bba6e9..8f6fd458f 100644 --- a/test/unit/deploy_commands_test.rb +++ b/test/unit/deploy_commands_test.rb @@ -30,13 +30,13 @@ def setup assert_equal %w(git fetch origin --quiet --tags master), command.args end - test "#fetch calls git fetch_commit if repository cache already exist" do + test "#fetch_commit calls git fetch commit if repository cache already exist" do @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) command = @commands.fetch_commit(@deploy.until_commit) - assert_equal %w(git fetch origin --quiet --tags 467578b362bf2b4df5903e1c7960929361c3435a), command.args + assert_equal %W(git fetch origin --quiet --tags #{@deploy.until_commit.sha}), command.args end test "#fetch calls git fetch in git_path directory if repository cache already exist" do From c99fb7b5cabe6ef1135448e12dcbd4432bfc3251 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Wed, 15 Mar 2023 14:51:47 -0400 Subject: [PATCH 17/79] Remove fetch branch --- .../shipit/task_execution_strategy/default.rb | 1 - lib/shipit/stack_commands.rb | 10 ++----- lib/shipit/task_commands.rb | 2 +- test/unit/deploy_commands_test.rb | 27 +++++++------------ 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/app/models/shipit/task_execution_strategy/default.rb b/app/models/shipit/task_execution_strategy/default.rb index cc105f17b..42af6c80a 100644 --- a/app/models/shipit/task_execution_strategy/default.rb +++ b/app/models/shipit/task_execution_strategy/default.rb @@ -70,7 +70,6 @@ def checkout_repository @task.acquire_git_cache_lock do @task.ping unless @commands.fetched?(@task.until_commit).tap(&:run).success? - capture!(@commands.fetch) capture!(@commands.fetch_commit(@task.until_commit)) end end diff --git a/lib/shipit/stack_commands.rb b/lib/shipit/stack_commands.rb index f6a201e93..b88efec88 100644 --- a/lib/shipit/stack_commands.rb +++ b/lib/shipit/stack_commands.rb @@ -13,22 +13,16 @@ def env super.merge(@stack.env) end - def fetch + def fetch_commit(commit) create_directories if valid_git_repository?(@stack.git_path) - git('fetch', 'origin', '--quiet', '--tags', @stack.branch, env: env, chdir: @stack.git_path) + git('fetch', 'origin', '--quiet', '--tags', commit.sha, env: env, chdir: @stack.git_path) else @stack.clear_git_cache! git_clone(@stack.repo_git_url, @stack.git_path, branch: @stack.branch, env: env, chdir: @stack.deploys_path) end end - def fetch_commit(commit) - if valid_git_repository?(@stack.git_path) - git('fetch', 'origin', '--quiet', '--tags', commit.sha, env: env, chdir: @stack.git_path) - end - end - def fetched?(commit) if valid_git_repository?(@stack.git_path) git('rev-parse', '--quiet', '--verify', "#{commit.sha}^{commit}", env: env, chdir: @stack.git_path) diff --git a/lib/shipit/task_commands.rb b/lib/shipit/task_commands.rb index aaa7514a1..3f736be26 100644 --- a/lib/shipit/task_commands.rb +++ b/lib/shipit/task_commands.rb @@ -2,7 +2,7 @@ # rubocop:disable Lint/MissingSuper module Shipit class TaskCommands < Commands - delegate :fetch, :fetched?, :fetch_commit, to: :stack_commands + delegate :fetch_commit, :fetched?, to: :stack_commands def initialize(task) @task = task diff --git a/test/unit/deploy_commands_test.rb b/test/unit/deploy_commands_test.rb index 8f6fd458f..60b1dae1f 100644 --- a/test/unit/deploy_commands_test.rb +++ b/test/unit/deploy_commands_test.rb @@ -25,15 +25,6 @@ def setup @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) - command = @commands.fetch - - assert_equal %w(git fetch origin --quiet --tags master), command.args - end - - test "#fetch_commit calls git fetch commit if repository cache already exist" do - @stack.git_path.stubs(:exist?).returns(true) - @stack.git_path.stubs(:empty?).returns(false) - command = @commands.fetch_commit(@deploy.until_commit) assert_equal %W(git fetch origin --quiet --tags #{@deploy.until_commit.sha}), command.args @@ -43,7 +34,7 @@ def setup @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) assert_equal @stack.git_path.to_s, command.chdir end @@ -51,7 +42,7 @@ def setup test "#fetch calls git clone if repository cache do not exist" do @stack.git_path.stubs(:exist?).returns(false) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args.map(&:to_s) @@ -61,7 +52,7 @@ def setup @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(true) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args @@ -74,7 +65,7 @@ def setup .with(@stack.git_path) .returns(false) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args @@ -88,7 +79,7 @@ def setup .with(@stack.git_path) .returns(false) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args @@ -98,7 +89,7 @@ def setup @stack.git_path.stubs(:exist?).returns(false) StackCommands.stubs(git_version: Gem::Version.new('1.7.2.30')) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) expected = %W(git clone --quiet --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args.map(&:to_s) @@ -107,20 +98,20 @@ def setup test "#fetch calls git fetch in base_path directory if repository cache do not exist" do @stack.git_path.stubs(:exist?).returns(false) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) assert_equal @stack.deploys_path.to_s, command.chdir end test "#fetch merges Shipit.env in ENVIRONMENT" do Shipit.stubs(:env).returns("SPECIFIC_CONFIG" => 5) - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) assert_equal '5', command.env["SPECIFIC_CONFIG"] end test "#env uses the correct Github token for a stack" do Shipit.github(organization: 'shopify').stubs(:token).returns('aS3cr3Tt0kEn') - command = @commands.fetch + command = @commands.fetch_commit(@deploy.until_commit) assert_equal 'aS3cr3Tt0kEn', command.env["GITHUB_TOKEN"] end From 658e3e73b8c7bfc77eed398f2621717cd00a3e2e Mon Sep 17 00:00:00 2001 From: Ruidan Date: Thu, 16 Mar 2023 13:42:05 -0400 Subject: [PATCH 18/79] Bump nokogiri --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 18afd765f..3ef9acd40 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -215,11 +215,11 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.13.10-arm64-darwin) + nokogiri (1.14.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.13.10-x86_64-darwin) + nokogiri (1.14.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.13.10-x86_64-linux) + nokogiri (1.14.2-x86_64-linux) racc (~> 1.4) oauth2 (2.0.6) faraday (>= 0.17.3, < 3.0) @@ -253,7 +253,7 @@ GEM pubsubstub (0.2.2) rack redis (~> 4.0) - racc (1.6.1) + racc (1.6.2) rack (2.2.6.3) rack-test (2.0.2) rack (>= 1.3) From ef8a01dbdb2e0bd3933aef7293766eed41fab612 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Mar 2023 21:41:04 +0000 Subject: [PATCH 19/79] Bump rack from 2.2.6.3 to 2.2.6.4 Bumps [rack](https://github.com/rack/rack) from 2.2.6.3 to 2.2.6.4. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.6.3...v2.2.6.4) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3ef9acd40..fd8b9d89a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -254,7 +254,7 @@ GEM rack redis (~> 4.0) racc (1.6.2) - rack (2.2.6.3) + rack (2.2.6.4) rack-test (2.0.2) rack (>= 1.3) rails (7.0.4.1) From b050d80a02ce9039da973337a6386e389b252ab2 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Wed, 22 Mar 2023 16:36:50 -0400 Subject: [PATCH 20/79] Add fetch command --- lib/shipit/stack_commands.rb | 10 ++++ test/unit/deploy_commands_test.rb | 87 +++++++++++++++++++++++++++---- 2 files changed, 88 insertions(+), 9 deletions(-) diff --git a/lib/shipit/stack_commands.rb b/lib/shipit/stack_commands.rb index b88efec88..932aced3b 100644 --- a/lib/shipit/stack_commands.rb +++ b/lib/shipit/stack_commands.rb @@ -23,6 +23,16 @@ def fetch_commit(commit) end end + def fetch + create_directories + if valid_git_repository?(@stack.git_path) + git('fetch', 'origin', '--quiet', '--tags', @stack.branch, env: env, chdir: @stack.git_path) + else + @stack.clear_git_cache! + git_clone(@stack.repo_git_url, @stack.git_path, branch: @stack.branch, env: env, chdir: @stack.deploys_path) + end + end + def fetched?(commit) if valid_git_repository?(@stack.git_path) git('rev-parse', '--quiet', '--verify', "#{commit.sha}^{commit}", env: env, chdir: @stack.git_path) diff --git a/test/unit/deploy_commands_test.rb b/test/unit/deploy_commands_test.rb index 60b1dae1f..ea7cfca5a 100644 --- a/test/unit/deploy_commands_test.rb +++ b/test/unit/deploy_commands_test.rb @@ -21,7 +21,7 @@ def setup StackCommands.stubs(git_version: Gem::Version.new('1.8.4.3')) end - test "#fetch calls git fetch if repository cache already exist" do + test "#fetch_commit calls git fetch if repository cache already exist" do @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) @@ -30,7 +30,7 @@ def setup assert_equal %W(git fetch origin --quiet --tags #{@deploy.until_commit.sha}), command.args end - test "#fetch calls git fetch in git_path directory if repository cache already exist" do + test "#fetch_commit calls git fetch in git_path directory if repository cache already exist" do @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) @@ -39,7 +39,7 @@ def setup assert_equal @stack.git_path.to_s, command.chdir end - test "#fetch calls git clone if repository cache do not exist" do + test "#fetch_commit calls git clone if repository cache do not exist" do @stack.git_path.stubs(:exist?).returns(false) command = @commands.fetch_commit(@deploy.until_commit) @@ -48,7 +48,7 @@ def setup assert_equal expected, command.args.map(&:to_s) end - test "#fetch calls git clone if repository cache is empty" do + test "#fetch_commit calls git clone if repository cache is empty" do @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(true) @@ -58,7 +58,7 @@ def setup assert_equal expected, command.args end - test "#fetch calls git clone if repository cache corrupt" do + test "#fetch_commit calls git clone if repository cache corrupt" do @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) StackCommands.any_instance.expects(:git_cmd_succeeds?) @@ -71,7 +71,7 @@ def setup assert_equal expected, command.args end - test "#fetch clears a corrupted git stash before cloning" do + test "#fetch_commit clears a corrupted git stash before cloning" do @stack.expects(:clear_git_cache!) @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(false) @@ -85,7 +85,7 @@ def setup assert_equal expected, command.args end - test "#fetch does not use --single-branch if git is outdated" do + test "#fetch_commit does not use --single-branch if git is outdated" do @stack.git_path.stubs(:exist?).returns(false) StackCommands.stubs(git_version: Gem::Version.new('1.7.2.30')) @@ -95,7 +95,7 @@ def setup assert_equal expected, command.args.map(&:to_s) end - test "#fetch calls git fetch in base_path directory if repository cache do not exist" do + test "#fetch_commit calls git fetch in base_path directory if repository cache do not exist" do @stack.git_path.stubs(:exist?).returns(false) command = @commands.fetch_commit(@deploy.until_commit) @@ -103,7 +103,7 @@ def setup assert_equal @stack.deploys_path.to_s, command.chdir end - test "#fetch merges Shipit.env in ENVIRONMENT" do + test "#fetch_commit merges Shipit.env in ENVIRONMENT" do Shipit.stubs(:env).returns("SPECIFIC_CONFIG" => 5) command = @commands.fetch_commit(@deploy.until_commit) assert_equal '5', command.env["SPECIFIC_CONFIG"] @@ -115,6 +115,75 @@ def setup assert_equal 'aS3cr3Tt0kEn', command.env["GITHUB_TOKEN"] end + test "#fetch calls git fetch if repository cache already exist" do + @stack.git_path.stubs(:exist?).returns(true) + @stack.git_path.stubs(:empty?).returns(false) + + command = @commands.fetch + + assert_equal %w(git fetch origin --quiet --tags master), command.args + end + + test "#fetch calls git fetch in git_path directory if repository cache already exist" do + @stack.git_path.stubs(:exist?).returns(true) + @stack.git_path.stubs(:empty?).returns(false) + + command = @commands.fetch + + assert_equal @stack.git_path.to_s, command.chdir + end + + test "#fetch calls git clone if repository cache do not exist" do + @stack.git_path.stubs(:exist?).returns(false) + + command = @commands.fetch + + expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) + assert_equal expected, command.args.map(&:to_s) + @stack.git_path.stubs(:exist?).returns(true) + @stack.git_path.stubs(:empty?).returns(true) + + command = @commands.fetch + + expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) + assert_equal expected, command.args + .with(@stack.git_path) + .returns(false) + + command = @commands.fetch + + expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) + assert_equal expected, command.args + .with(@stack.git_path) + .returns(false) + + command = @commands.fetch + + expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) + assert_equal expected, command.args + @stack.git_path.stubs(:exist?).returns(false) + StackCommands.stubs(git_version: Gem::Version.new('1.7.2.30')) + + command = @commands.fetch + + expected = %W(git clone --quiet --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) + assert_equal expected, command.args.map(&:to_s) + end + + test "#fetch calls git fetch in base_path directory if repository cache do not exist" do + @stack.git_path.stubs(:exist?).returns(false) + + command = @commands.fetch + + assert_equal @stack.deploys_path.to_s, command.chdir + end + + test "#fetch merges Shipit.env in ENVIRONMENT" do + Shipit.stubs(:env).returns("SPECIFIC_CONFIG" => 5) + command = @commands.fetch + assert_equal '5', command.env["SPECIFIC_CONFIG"] + end + test "#clone clones the repository cache into the working directory" do commands = @commands.clone assert_equal 2, commands.size From dc985abc5c5d6ff5a4f44b251203e7b0c3e1d237 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Wed, 22 Mar 2023 16:44:43 -0400 Subject: [PATCH 21/79] Delegate fetch command --- lib/shipit/task_commands.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shipit/task_commands.rb b/lib/shipit/task_commands.rb index 3f736be26..275d14ba7 100644 --- a/lib/shipit/task_commands.rb +++ b/lib/shipit/task_commands.rb @@ -2,7 +2,7 @@ # rubocop:disable Lint/MissingSuper module Shipit class TaskCommands < Commands - delegate :fetch_commit, :fetched?, to: :stack_commands + delegate :fetch_commit, :fetch, :fetched?, to: :stack_commands def initialize(task) @task = task From afa307ab9124ed6419ac5b77e5b5c5efe3e676f0 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Wed, 22 Mar 2023 17:02:14 -0400 Subject: [PATCH 22/79] update test --- test/unit/deploy_commands_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/unit/deploy_commands_test.rb b/test/unit/deploy_commands_test.rb index ea7cfca5a..9b446565c 100644 --- a/test/unit/deploy_commands_test.rb +++ b/test/unit/deploy_commands_test.rb @@ -140,6 +140,9 @@ def setup expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args.map(&:to_s) + end + + test "#fetch calls git clone if repository cache is empty" do @stack.git_path.stubs(:exist?).returns(true) @stack.git_path.stubs(:empty?).returns(true) @@ -147,6 +150,12 @@ def setup expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args + end + + test "#fetch calls git clone if repository cache corrupt" do + @stack.git_path.stubs(:exist?).returns(true) + @stack.git_path.stubs(:empty?).returns(false) + StackCommands.any_instance.expects(:git_cmd_succeeds?) .with(@stack.git_path) .returns(false) @@ -154,6 +163,13 @@ def setup expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args + end + + test "#fetch clears a corrupted git stash before cloning" do + @stack.expects(:clear_git_cache!) + @stack.git_path.stubs(:exist?).returns(true) + @stack.git_path.stubs(:empty?).returns(false) + StackCommands.any_instance.expects(:git_cmd_succeeds?) .with(@stack.git_path) .returns(false) @@ -161,6 +177,9 @@ def setup expected = %W(git clone --quiet --single-branch --recursive --branch master #{@stack.repo_git_url} #{@stack.git_path}) assert_equal expected, command.args + end + + test "#fetch does not use --single-branch if git is outdated" do @stack.git_path.stubs(:exist?).returns(false) StackCommands.stubs(git_version: Gem::Version.new('1.7.2.30')) From f7e87111e3177ef51352c0e91a0a5cea94272495 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 May 2023 14:49:28 +0200 Subject: [PATCH 23/79] Bump globalid from 1.0.0 to 1.0.1 (#1294) Bumps [globalid](https://github.com/rails/globalid) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/rails/globalid/releases) - [Commits](https://github.com/rails/globalid/compare/v1.0.0...v1.0.1) --- updated-dependencies: - dependency-name: globalid dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fd8b9d89a..35a3ee190 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -167,7 +167,7 @@ GEM faraday-retry (1.0.3) ffi (1.15.5) gemoji (2.1.0) - globalid (1.0.0) + globalid (1.0.1) activesupport (>= 5.0) hashdiff (1.0.1) hashie (5.0.0) From 77aa6dcd64577c90c2c65fcb1f92bd643ded1430 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 May 2023 13:21:16 +0000 Subject: [PATCH 24/79] Bump nokogiri from 1.14.2 to 1.14.4 (#1307) --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 35a3ee190..125402721 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -215,11 +215,11 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.14.2-arm64-darwin) + nokogiri (1.14.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.14.2-x86_64-darwin) + nokogiri (1.14.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.14.2-x86_64-linux) + nokogiri (1.14.4-x86_64-linux) racc (~> 1.4) oauth2 (2.0.6) faraday (>= 0.17.3, < 3.0) From 0419ae9aebd9ef265ce91c5f9a5cb02ec21d2a29 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 May 2023 13:21:45 +0000 Subject: [PATCH 25/79] Bump activesupport from 7.0.4.1 to 7.0.4.3 (#1301) --- Gemfile.lock | 114 +++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 125402721..69449af7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,47 +33,47 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4.1) - actionpack (= 7.0.4.1) - activesupport (= 7.0.4.1) + actioncable (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.1) - actionpack (= 7.0.4.1) - activejob (= 7.0.4.1) - activerecord (= 7.0.4.1) - activestorage (= 7.0.4.1) - activesupport (= 7.0.4.1) + actionmailbox (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.1) - actionpack (= 7.0.4.1) - actionview (= 7.0.4.1) - activejob (= 7.0.4.1) - activesupport (= 7.0.4.1) + actionmailer (7.0.4.3) + actionpack (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.1) - actionview (= 7.0.4.1) - activesupport (= 7.0.4.1) + actionpack (7.0.4.3) + actionview (= 7.0.4.3) + activesupport (= 7.0.4.3) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.1) - actionpack (= 7.0.4.1) - activerecord (= 7.0.4.1) - activestorage (= 7.0.4.1) - activesupport (= 7.0.4.1) + actiontext (7.0.4.3) + actionpack (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.1) - activesupport (= 7.0.4.1) + actionview (7.0.4.3) + activesupport (= 7.0.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -81,22 +81,22 @@ GEM active_model_serializers (0.9.8) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.0.4.1) - activesupport (= 7.0.4.1) + activejob (7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.3.6) - activemodel (7.0.4.1) - activesupport (= 7.0.4.1) - activerecord (7.0.4.1) - activemodel (= 7.0.4.1) - activesupport (= 7.0.4.1) - activestorage (7.0.4.1) - actionpack (= 7.0.4.1) - activejob (= 7.0.4.1) - activerecord (= 7.0.4.1) - activesupport (= 7.0.4.1) + activemodel (7.0.4.3) + activesupport (= 7.0.4.3) + activerecord (7.0.4.3) + activemodel (= 7.0.4.3) + activesupport (= 7.0.4.3) + activestorage (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activesupport (= 7.0.4.3) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4.1) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -123,7 +123,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) crack (0.4.5) rexml crass (1.0.6) @@ -171,7 +171,7 @@ GEM activesupport (>= 5.0) hashdiff (1.0.1) hashie (5.0.0) - i18n (1.12.0) + i18n (1.13.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) jquery-rails (4.5.1) @@ -194,7 +194,7 @@ GEM mini_mime (1.1.2) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.17.0) + minitest (5.18.0) mocha (1.13.0) msgpack (1.5.4) multi_xml (0.6.0) @@ -257,20 +257,20 @@ GEM rack (2.2.6.4) rack-test (2.0.2) rack (>= 1.3) - rails (7.0.4.1) - actioncable (= 7.0.4.1) - actionmailbox (= 7.0.4.1) - actionmailer (= 7.0.4.1) - actionpack (= 7.0.4.1) - actiontext (= 7.0.4.1) - actionview (= 7.0.4.1) - activejob (= 7.0.4.1) - activemodel (= 7.0.4.1) - activerecord (= 7.0.4.1) - activestorage (= 7.0.4.1) - activesupport (= 7.0.4.1) + rails (7.0.4.3) + actioncable (= 7.0.4.3) + actionmailbox (= 7.0.4.3) + actionmailer (= 7.0.4.3) + actionpack (= 7.0.4.3) + actiontext (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activemodel (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) bundler (>= 1.15.0) - railties (= 7.0.4.1) + railties (= 7.0.4.3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -281,9 +281,9 @@ GEM activesupport (>= 3.1) rails_autolink (1.1.6) rails (> 3.1) - railties (7.0.4.1) - actionpack (= 7.0.4.1) - activesupport (= 7.0.4.1) + railties (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) method_source rake (>= 12.2) thor (~> 1.0) @@ -357,7 +357,7 @@ GEM thread_safe (0.3.6) tilt (2.0.11) timeout (0.3.0) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) validate_url (1.0.15) From 24dbb35fadd1b41d859eeb4ef58e26bfb78b2f44 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma <59575943+kartiki975@users.noreply.github.com> Date: Tue, 16 May 2023 16:40:01 -0400 Subject: [PATCH 26/79] Update octokit_iterator.rb --- lib/shipit/octokit_iterator.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/shipit/octokit_iterator.rb b/lib/shipit/octokit_iterator.rb index c6c96f0b6..3a113cb1b 100644 --- a/lib/shipit/octokit_iterator.rb +++ b/lib/shipit/octokit_iterator.rb @@ -16,6 +16,8 @@ def each(&block) response = @response loop do + return unless response.present? + response.data.each(&block) return unless response.rels[:next] response = response.rels[:next].get From 40825cd9f5519de0eb62cd0b7c799fad6803f921 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Wed, 31 May 2023 12:49:57 -0400 Subject: [PATCH 27/79] ContinuousDeliveryJob accounts for concurrent tasks --- app/jobs/shipit/continuous_delivery_job.rb | 5 +++- app/models/shipit/stack.rb | 8 ++++++ test/models/shipit/stacks_test.rb | 30 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/app/jobs/shipit/continuous_delivery_job.rb b/app/jobs/shipit/continuous_delivery_job.rb index de5c1b4b3..46a292f01 100644 --- a/app/jobs/shipit/continuous_delivery_job.rb +++ b/app/jobs/shipit/continuous_delivery_job.rb @@ -8,7 +8,10 @@ class ContinuousDeliveryJob < BackgroundJob def perform(stack) return unless stack.continuous_deployment? - return if stack.active_task? + + # checks if there are any tasks running, including concurrent tasks + return if stack.occupied? + stack.trigger_continuous_delivery end end diff --git a/app/models/shipit/stack.rb b/app/models/shipit/stack.rb index 8e93a8e6b..78f2a2047 100644 --- a/app/models/shipit/stack.rb +++ b/app/models/shipit/stack.rb @@ -453,6 +453,14 @@ def active_task @active_task ||= tasks.current end + def occupied? + !!occupied + end + + def occupied + @occupied ||= tasks.active.last + end + def locked? lock_reason.present? end diff --git a/test/models/shipit/stacks_test.rb b/test/models/shipit/stacks_test.rb index dbfe5bb9a..b0f041f12 100644 --- a/test/models/shipit/stacks_test.rb +++ b/test/models/shipit/stacks_test.rb @@ -278,6 +278,36 @@ def self.deliver(event, stack, payload) end end + test "#active_task? is false if stack has a concurrent deploy in active state" do + @stack.trigger_deploy(shipit_commits(:third), AnonymousUser.new, force: true) + refute @stack.active_task? + end + + test "#occupied? is false if stack has no deploy in either pending or running state" do + @stack.deploys.active.destroy_all + refute @stack.occupied? + end + + test "#occupied? is false if stack has no deploy at all" do + @stack.deploys.destroy_all + refute @stack.occupied? + end + + test "occupied? is true if stack has a concurrent deploy in active state" do + @stack.trigger_deploy(shipit_commits(:third), AnonymousUser.new, force: true) + assert @stack.occupied? + end + + test "occupied? is true if stack has a deploy in pending state" do + @stack.trigger_deploy(shipit_commits(:third), AnonymousUser.new) + assert @stack.occupied? + end + + test "#occupied? is true if a rollback is ongoing" do + shipit_deploys(:shipit_complete).trigger_rollback(AnonymousUser.new) + assert @stack.occupied? + end + test "#deployable? returns true if the stack is not locked, not awaiting provision, and is not deploying" do @stack.deploys.destroy_all @stack.update!(lock_reason: nil, awaiting_provision: false) From 7478ea32c566ba1a5f63b82ebef9ae53f3cf0e57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Jun 2023 16:01:38 +0000 Subject: [PATCH 28/79] Bump actionpack from 7.0.4.3 to 7.0.5.1 Bumps [actionpack](https://github.com/rails/rails) from 7.0.4.3 to 7.0.5.1. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.0.5.1/actionpack/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.0.4.3...v7.0.5.1) --- updated-dependencies: - dependency-name: actionpack dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 137 ++++++++++++++++++++++++++------------------------- 1 file changed, 69 insertions(+), 68 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 69449af7e..1d6674e6c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,70 +33,70 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + actioncable (7.0.5.1) + actionpack (= 7.0.5.1) + activesupport (= 7.0.5.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailbox (7.0.5.1) + actionpack (= 7.0.5.1) + activejob (= 7.0.5.1) + activerecord (= 7.0.5.1) + activestorage (= 7.0.5.1) + activesupport (= 7.0.5.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.3) - actionpack (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailer (7.0.5.1) + actionpack (= 7.0.5.1) + actionview (= 7.0.5.1) + activejob (= 7.0.5.1) + activesupport (= 7.0.5.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.5.1) + actionview (= 7.0.5.1) + activesupport (= 7.0.5.1) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.3) - actionpack (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actiontext (7.0.5.1) + actionpack (= 7.0.5.1) + activerecord (= 7.0.5.1) + activestorage (= 7.0.5.1) + activesupport (= 7.0.5.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + actionview (7.0.5.1) + activesupport (= 7.0.5.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_model_serializers (0.9.8) + active_model_serializers (0.9.9) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.0.4.3) - activesupport (= 7.0.4.3) + activejob (7.0.5.1) + activesupport (= 7.0.5.1) globalid (>= 0.3.6) - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) - activestorage (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activesupport (= 7.0.4.3) + activemodel (7.0.5.1) + activesupport (= 7.0.5.1) + activerecord (7.0.5.1) + activemodel (= 7.0.5.1) + activesupport (= 7.0.5.1) + activestorage (7.0.5.1) + actionpack (= 7.0.5.1) + activejob (= 7.0.5.1) + activerecord (= 7.0.5.1) + activesupport (= 7.0.5.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4.3) + activesupport (7.0.5.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -132,7 +132,7 @@ GEM digest (3.1.0) docile (1.4.0) equalizer (0.0.11) - erubi (1.11.0) + erubi (1.12.0) execjs (2.8.1) explicit-parameters (0.4.1) actionpack (>= 6.0) @@ -171,7 +171,7 @@ GEM activesupport (>= 5.0) hashdiff (1.0.1) hashie (5.0.0) - i18n (1.13.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) ice_nine (0.11.2) jquery-rails (4.5.1) @@ -184,9 +184,9 @@ GEM libv8-node (16.10.0.0-x86_64-linux) lodash-rails (4.17.21) railties (>= 3.1) - loofah (2.19.1) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) @@ -194,7 +194,7 @@ GEM mini_mime (1.1.2) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.18.0) + minitest (5.18.1) mocha (1.13.0) msgpack (1.5.4) multi_xml (0.6.0) @@ -215,11 +215,11 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.14.4-arm64-darwin) + nokogiri (1.15.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.14.4-x86_64-darwin) + nokogiri (1.15.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.14.4-x86_64-linux) + nokogiri (1.15.2-x86_64-linux) racc (~> 1.4) oauth2 (2.0.6) faraday (>= 0.17.3, < 3.0) @@ -253,37 +253,38 @@ GEM pubsubstub (0.2.2) rack redis (~> 4.0) - racc (1.6.2) - rack (2.2.6.4) - rack-test (2.0.2) + racc (1.7.1) + rack (2.2.7) + rack-test (2.1.0) rack (>= 1.3) - rails (7.0.4.3) - actioncable (= 7.0.4.3) - actionmailbox (= 7.0.4.3) - actionmailer (= 7.0.4.3) - actionpack (= 7.0.4.3) - actiontext (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activemodel (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rails (7.0.5.1) + actioncable (= 7.0.5.1) + actionmailbox (= 7.0.5.1) + actionmailer (= 7.0.5.1) + actionpack (= 7.0.5.1) + actiontext (= 7.0.5.1) + actionview (= 7.0.5.1) + activejob (= 7.0.5.1) + activemodel (= 7.0.5.1) + activerecord (= 7.0.5.1) + activestorage (= 7.0.5.1) + activesupport (= 7.0.5.1) bundler (>= 1.15.0) - railties (= 7.0.4.3) + railties (= 7.0.5.1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.4) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rails-timeago (2.13.0) actionpack (>= 3.1) activesupport (>= 3.1) rails_autolink (1.1.6) rails (> 3.1) - railties (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + railties (7.0.5.1) + actionpack (= 7.0.5.1) + activesupport (= 7.0.5.1) method_source rake (>= 12.2) thor (~> 1.0) From 3f46c63dfdaa71aba7bc61d75e2e69234036e42a Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Mon, 3 Jul 2023 11:14:39 -0700 Subject: [PATCH 29/79] Change github_id on commit_deployment_statuses to bigint --- ...change_commit_deployment_statuses_github_id_to_big_int.rb | 5 +++++ test/dummy/db/schema.rb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20230703181143_change_commit_deployment_statuses_github_id_to_big_int.rb diff --git a/db/migrate/20230703181143_change_commit_deployment_statuses_github_id_to_big_int.rb b/db/migrate/20230703181143_change_commit_deployment_statuses_github_id_to_big_int.rb new file mode 100644 index 000000000..a450890b3 --- /dev/null +++ b/db/migrate/20230703181143_change_commit_deployment_statuses_github_id_to_big_int.rb @@ -0,0 +1,5 @@ +class ChangeCommitDeploymentStatusesGithubIdToBigInt < ActiveRecord::Migration[7.0] + def change + change_column :commit_deployment_statuses, :github_id, :bigint + end +end diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 2cea45691..22bbfaffb 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_11_03_154121) do +ActiveRecord::Schema.define(version: 2023_07_03_181143) do create_table "api_clients", force: :cascade do |t| t.text "permissions", limit: 65535 @@ -42,7 +42,7 @@ create_table "commit_deployment_statuses", force: :cascade do |t| t.integer "commit_deployment_id" t.string "status" - t.integer "github_id" + t.bigint "github_id" t.string "api_url" t.datetime "created_at", null: false t.datetime "updated_at", null: false From 3121ad10cfe3eac09fade67b580ba5cad9d1e2e3 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 4 Jul 2023 13:13:47 +0200 Subject: [PATCH 30/79] Release 0.38.0 --- CHANGELOG.md | 6 ++ Gemfile.lock | 189 +++++++++++++++++++++--------------------- lib/shipit/version.rb | 2 +- 3 files changed, 102 insertions(+), 95 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff860eef..cc7f00316 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Unreleased +# 0.38.0 + +* Convert `commit_deployment_statuses.github_id` to bigint (#1312) +* Allow to lock and archive stacks from the API (#1282) +* Hide API tokens from the user interface after the initial creation (#1298) + # 0.37.0 * Suppress progress output for git checkout (#1278) diff --git a/Gemfile.lock b/Gemfile.lock index 1d6674e6c..7202f3582 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - shipit-engine (0.37.0) + shipit-engine (0.38.0) active_model_serializers (~> 0.9.3) ansi_stream (~> 0.0.6) autoprefixer-rails (~> 6.4.1) @@ -33,47 +33,47 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.5.1) - actionpack (= 7.0.5.1) - activesupport (= 7.0.5.1) + actioncable (7.0.6) + actionpack (= 7.0.6) + activesupport (= 7.0.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.5.1) - actionpack (= 7.0.5.1) - activejob (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionmailbox (7.0.6) + actionpack (= 7.0.6) + activejob (= 7.0.6) + activerecord (= 7.0.6) + activestorage (= 7.0.6) + activesupport (= 7.0.6) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.5.1) - actionpack (= 7.0.5.1) - actionview (= 7.0.5.1) - activejob (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionmailer (7.0.6) + actionpack (= 7.0.6) + actionview (= 7.0.6) + activejob (= 7.0.6) + activesupport (= 7.0.6) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.5.1) - actionview (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionpack (7.0.6) + actionview (= 7.0.6) + activesupport (= 7.0.6) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.5.1) - actionpack (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + actiontext (7.0.6) + actionpack (= 7.0.6) + activerecord (= 7.0.6) + activestorage (= 7.0.6) + activesupport (= 7.0.6) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.5.1) - activesupport (= 7.0.5.1) + actionview (7.0.6) + activesupport (= 7.0.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -81,22 +81,22 @@ GEM active_model_serializers (0.9.9) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.0.5.1) - activesupport (= 7.0.5.1) + activejob (7.0.6) + activesupport (= 7.0.6) globalid (>= 0.3.6) - activemodel (7.0.5.1) - activesupport (= 7.0.5.1) - activerecord (7.0.5.1) - activemodel (= 7.0.5.1) - activesupport (= 7.0.5.1) - activestorage (7.0.5.1) - actionpack (= 7.0.5.1) - activejob (= 7.0.5.1) - activerecord (= 7.0.5.1) - activesupport (= 7.0.5.1) + activemodel (7.0.6) + activesupport (= 7.0.6) + activerecord (7.0.6) + activemodel (= 7.0.6) + activesupport (= 7.0.6) + activestorage (7.0.6) + actionpack (= 7.0.6) + activejob (= 7.0.6) + activerecord (= 7.0.6) + activesupport (= 7.0.6) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.5.1) + activesupport (7.0.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -127,9 +127,9 @@ GEM crack (0.4.5) rexml crass (1.0.6) + date (3.3.3) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - digest (3.1.0) docile (1.4.0) equalizer (0.0.11) erubi (1.12.0) @@ -140,7 +140,7 @@ GEM virtus (~> 1.0) faker (2.20.0) i18n (>= 1.8.11, < 2) - faraday (1.10.1) + faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -155,7 +155,7 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) - faraday-http-cache (2.4.1) + faraday-http-cache (2.5.0) faraday (>= 0.8) faraday-httpclient (1.0.1) faraday-multipart (1.0.4) @@ -167,18 +167,18 @@ GEM faraday-retry (1.0.3) ffi (1.15.5) gemoji (2.1.0) - globalid (1.0.1) + globalid (1.1.0) activesupport (>= 5.0) hashdiff (1.0.1) hashie (5.0.0) i18n (1.14.1) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - jquery-rails (4.5.1) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jwt (2.4.1) + jwt (2.7.1) libv8-node (16.10.0.0-arm64-darwin) libv8-node (16.10.0.0-x86_64-darwin) libv8-node (16.10.0.0-x86_64-linux) @@ -187,8 +187,11 @@ GEM loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) @@ -196,37 +199,32 @@ GEM libv8-node (~> 16.10.0.0) minitest (5.18.1) mocha (1.13.0) - msgpack (1.5.4) + msgpack (1.7.1) multi_xml (0.6.0) - multipart-post (2.2.3) + multipart-post (2.3.0) mysql2 (0.5.3) - net-imap (0.2.3) - digest + net-imap (0.3.6) + date net-protocol - strscan - net-pop (0.1.1) - digest + net-pop (0.1.2) net-protocol + net-protocol (0.2.1) timeout - net-protocol (0.1.3) - timeout - net-smtp (0.3.1) - digest + net-smtp (0.3.3) net-protocol - timeout - nio4r (2.5.8) + nio4r (2.5.9) nokogiri (1.15.2-arm64-darwin) racc (~> 1.4) nokogiri (1.15.2-x86_64-darwin) racc (~> 1.4) nokogiri (1.15.2-x86_64-linux) racc (~> 1.4) - oauth2 (2.0.6) + oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) multi_xml (~> 0.5) - rack (>= 1.2, < 3) - rash_alt (>= 0.4, < 1) + rack (>= 1.2, < 4) + snaky_hash (~> 2.0) version_gem (~> 1.1) octokit (4.25.1) faraday (>= 1, < 3) @@ -240,7 +238,7 @@ GEM omniauth-oauth2 (1.7.3) oauth2 (>= 1.4, < 3) omniauth (>= 1.9, < 3) - paquito (0.7.0) + paquito (0.10.0) msgpack (>= 1.5.2) parallel (1.21.0) parser (3.1.1.0) @@ -257,22 +255,23 @@ GEM rack (2.2.7) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.5.1) - actioncable (= 7.0.5.1) - actionmailbox (= 7.0.5.1) - actionmailer (= 7.0.5.1) - actionpack (= 7.0.5.1) - actiontext (= 7.0.5.1) - actionview (= 7.0.5.1) - activejob (= 7.0.5.1) - activemodel (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + rails (7.0.6) + actioncable (= 7.0.6) + actionmailbox (= 7.0.6) + actionmailer (= 7.0.6) + actionpack (= 7.0.6) + actiontext (= 7.0.6) + actionview (= 7.0.6) + activejob (= 7.0.6) + activemodel (= 7.0.6) + activerecord (= 7.0.6) + activestorage (= 7.0.6) + activesupport (= 7.0.6) bundler (>= 1.15.0) - railties (= 7.0.5.1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + railties (= 7.0.6) + rails-dom-testing (2.1.1) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.0) loofah (~> 2.21) @@ -280,26 +279,26 @@ GEM rails-timeago (2.13.0) actionpack (>= 3.1) activesupport (>= 3.1) - rails_autolink (1.1.6) - rails (> 3.1) - railties (7.0.5.1) - actionpack (= 7.0.5.1) - activesupport (= 7.0.5.1) + rails_autolink (1.1.8) + actionview (> 3.1) + activesupport (> 3.1) + railties (> 3.1) + railties (7.0.6) + actionpack (= 7.0.6) + activesupport (= 7.0.6) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - rash_alt (0.4.12) - hashie (>= 3.4) - redis (4.7.1) + redis (4.8.1) redis-objects (1.7.0) redis regexp_parser (2.2.1) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.2.5) rubocop (1.18.3) parallel (~> 1.10) @@ -337,6 +336,9 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) + snaky_hash (2.0.1) + hashie + version_gem (~> 1.1, >= 1.1.1) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -353,18 +355,17 @@ GEM state_machines-activerecord (0.8.0) activerecord (>= 5.1) state_machines-activemodel (>= 0.8.0) - strscan (3.0.4) - thor (1.2.1) + thor (1.2.2) thread_safe (0.3.6) - tilt (2.0.11) - timeout (0.3.0) + tilt (2.2.0) + timeout (0.4.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix - version_gem (1.1.0) + version_gem (1.1.3) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -377,7 +378,7 @@ GEM websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.0) + zeitwerk (2.6.8) PLATFORMS arm64-darwin-21 diff --git a/lib/shipit/version.rb b/lib/shipit/version.rb index 2124dbe3c..5e104fc24 100644 --- a/lib/shipit/version.rb +++ b/lib/shipit/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Shipit - VERSION = '0.37.0' + VERSION = '0.38.0' end From 7e7c3314d2d250c60b4242ab874d056496182f0d Mon Sep 17 00:00:00 2001 From: stephsachrajda Date: Fri, 14 Jul 2023 12:59:24 -0600 Subject: [PATCH 31/79] Give concurrent task running a clear error message --- app/controllers/shipit/api/base_controller.rb | 4 ++-- app/models/shipit/task.rb | 6 +++++- test/controllers/api/deploys_controller_test.rb | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/shipit/api/base_controller.rb b/app/controllers/shipit/api/base_controller.rb index b294e1374..d7df8157a 100644 --- a/app/controllers/shipit/api/base_controller.rb +++ b/app/controllers/shipit/api/base_controller.rb @@ -93,8 +93,8 @@ def not_found(_error) render(status: :not_found, json: { status: '404', error: 'Not Found' }) end - def conflict(_error) - render(status: :conflict, json: { status: '409', error: 'Conflict' }) + def conflict(error) + render(status: :conflict, json: { status: '409', error: error.message }) end end end diff --git a/app/models/shipit/task.rb b/app/models/shipit/task.rb index f2b6f0f05..9db5e1155 100644 --- a/app/models/shipit/task.rb +++ b/app/models/shipit/task.rb @@ -3,7 +3,11 @@ module Shipit class Task < Record include DeferredTouch - ConcurrentTaskRunning = Class.new(StandardError) + class ConcurrentTaskRunning < StandardError + def message + "A task is already running." + end + end PRESENCE_CHECK_TIMEOUT = 30 ACTIVE_STATUSES = %w(pending running aborting).freeze diff --git a/test/controllers/api/deploys_controller_test.rb b/test/controllers/api/deploys_controller_test.rb index dc89c73da..7a044b8ff 100644 --- a/test/controllers/api/deploys_controller_test.rb +++ b/test/controllers/api/deploys_controller_test.rb @@ -81,6 +81,7 @@ class DeploysControllerTest < ApiControllerTestCase end assert_response :conflict + assert_json 'error', 'A task is already running.' end test "#create refuses to deploy unsuccessful commits if the require_ci flag is passed" do From 8d9249a69fcf4470fde6408852669020988d06ab Mon Sep 17 00:00:00 2001 From: bradenchime <81321312+bradenchime@users.noreply.github.com> Date: Wed, 16 Aug 2023 14:55:33 -0700 Subject: [PATCH 32/79] Update README.md Remove errant comma and period from bulleted list --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8bde27a95..ae1a7cb46 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ This guide aims to help you [set up](#installation-and-setup), [use](#using-ship **II. USING SHIPIT** * [Adding stacks](#adding-stacks) -* [Working on stacks](#working-on-stacks), -* [Configuring stacks](#configuring-stacks). +* [Working on stacks](#working-on-stacks) +* [Configuring stacks](#configuring-stacks) **III. REFERENCE** From 524bbedb7458711c71ea32f4aad112448b826c73 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Aug 2023 21:48:00 +0000 Subject: [PATCH 33/79] Bump activesupport from 7.0.6 to 7.0.7.2 Bumps [activesupport](https://github.com/rails/rails) from 7.0.6 to 7.0.7.2. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.0.7.2/activesupport/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.0.6...v7.0.7.2) --- updated-dependencies: - dependency-name: activesupport dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 108 +++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7202f3582..eb34f80c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,47 +33,47 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + actioncable (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + actionmailbox (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.6) - actionpack (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activesupport (= 7.0.6) + actionmailer (7.0.7.2) + actionpack (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.6) - actionview (= 7.0.6) - activesupport (= 7.0.6) + actionpack (7.0.7.2) + actionview (= 7.0.7.2) + activesupport (= 7.0.7.2) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.6) - actionpack (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + actiontext (7.0.7.2) + actionpack (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.6) - activesupport (= 7.0.6) + actionview (7.0.7.2) + activesupport (= 7.0.7.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -81,22 +81,22 @@ GEM active_model_serializers (0.9.9) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.0.6) - activesupport (= 7.0.6) + activejob (7.0.7.2) + activesupport (= 7.0.7.2) globalid (>= 0.3.6) - activemodel (7.0.6) - activesupport (= 7.0.6) - activerecord (7.0.6) - activemodel (= 7.0.6) - activesupport (= 7.0.6) - activestorage (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activesupport (= 7.0.6) + activemodel (7.0.7.2) + activesupport (= 7.0.7.2) + activerecord (7.0.7.2) + activemodel (= 7.0.7.2) + activesupport (= 7.0.7.2) + activestorage (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activesupport (= 7.0.7.2) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.6) + activesupport (7.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -197,7 +197,7 @@ GEM mini_mime (1.1.2) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.18.1) + minitest (5.19.0) mocha (1.13.0) msgpack (1.7.1) multi_xml (0.6.0) @@ -255,20 +255,20 @@ GEM rack (2.2.7) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.6) - actioncable (= 7.0.6) - actionmailbox (= 7.0.6) - actionmailer (= 7.0.6) - actionpack (= 7.0.6) - actiontext (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activemodel (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + rails (7.0.7.2) + actioncable (= 7.0.7.2) + actionmailbox (= 7.0.7.2) + actionmailer (= 7.0.7.2) + actionpack (= 7.0.7.2) + actiontext (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activemodel (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) bundler (>= 1.15.0) - railties (= 7.0.6) + railties (= 7.0.7.2) rails-dom-testing (2.1.1) activesupport (>= 5.0.0) minitest @@ -283,9 +283,9 @@ GEM actionview (> 3.1) activesupport (> 3.1) railties (> 3.1) - railties (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + railties (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) method_source rake (>= 12.2) thor (~> 1.0) From bed1cd7018dcfbc686e26975cce8048687f32817 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 30 Aug 2023 10:02:13 +0200 Subject: [PATCH 34/79] Update mocha --- Gemfile.lock | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index eb34f80c4..2b125cfb3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -198,7 +198,8 @@ GEM mini_racer (0.6.2) libv8-node (~> 16.10.0.0) minitest (5.19.0) - mocha (1.13.0) + mocha (2.1.0) + ruby2_keywords (>= 0.0.5) msgpack (1.7.1) multi_xml (0.6.0) multipart-post (2.3.0) @@ -382,6 +383,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-22 x86_64-darwin-20 x86_64-linux @@ -402,4 +404,4 @@ DEPENDENCIES webmock BUNDLED WITH - 2.3.8 + 2.4.18 From 195d41e3996b2c16e9f382509230bcd27ba9d770 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 30 Aug 2023 10:02:47 +0200 Subject: [PATCH 35/79] Test against Ruby 3.2 --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f1ac244c2..6994a87c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,6 +110,7 @@ jobs: - '2.7' - '3.0' - '3.1' + - '3.2' services: redis: From d00926c05ded4c98f65d103ec62d413085f1eeb1 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Thu, 7 Sep 2023 17:05:59 -0400 Subject: [PATCH 36/79] Update stack.rb --- app/models/shipit/stack.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/shipit/stack.rb b/app/models/shipit/stack.rb index 78f2a2047..403f7ff82 100644 --- a/app/models/shipit/stack.rb +++ b/app/models/shipit/stack.rb @@ -226,8 +226,12 @@ def schedule_merges def next_commit_to_deploy commits_to_deploy = commits.order(id: :asc).newer_than(last_deployed_commit).reachable.preload(:statuses) - commits_to_deploy = commits_to_deploy.limit(maximum_commits_per_deploy) if maximum_commits_per_deploy - commits_to_deploy.to_a.reverse.find(&:deployable?) + if maximum_commits_per_deploy + commits_with_max_applied = commits_to_deploy.limit(maximum_commits_per_deploy) + deployable_commits(commits_with_max_applied) || deployable_commits(commits_to_deploy) + else + deployable_commits(commits_to_deploy) + end end def deployed_too_recently? @@ -628,6 +632,10 @@ def emit_lock_hooks private + def deployable_commits(commits) + commits.to_a.reverse.find(&:deployable?) + end + def clear_cache remove_instance_variable(:@active_task) if defined?(@active_task) end From 3e71f786bcfc0ef1844476facb6404e402661e22 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Thu, 7 Sep 2023 17:08:41 -0400 Subject: [PATCH 37/79] Rename test file --- test/models/shipit/{stacks_test.rb => stack_test.rb} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename test/models/shipit/{stacks_test.rb => stack_test.rb} (99%) diff --git a/test/models/shipit/stacks_test.rb b/test/models/shipit/stack_test.rb similarity index 99% rename from test/models/shipit/stacks_test.rb rename to test/models/shipit/stack_test.rb index b0f041f12..3b376d34a 100644 --- a/test/models/shipit/stacks_test.rb +++ b/test/models/shipit/stack_test.rb @@ -3,7 +3,7 @@ require 'securerandom' module Shipit - class StacksTest < ActiveSupport::TestCase + class StackTest < ActiveSupport::TestCase def setup @stack = shipit_stacks(:shipit) @expected_base_path = Rails.root.join('data', 'stacks', @stack.to_param).to_s From a8383d7b900cb0676fc140e656824df46c72ead4 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Thu, 7 Sep 2023 17:32:24 -0400 Subject: [PATCH 38/79] Update stack_test.rb --- test/models/shipit/stack_test.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test/models/shipit/stack_test.rb b/test/models/shipit/stack_test.rb index 3b376d34a..a65e82efe 100644 --- a/test/models/shipit/stack_test.rb +++ b/test/models/shipit/stack_test.rb @@ -704,12 +704,12 @@ def self.deliver(event, stack, payload) assert_equal shipit_commits(:fifth), @stack.next_commit_to_deploy end - test "#next_commit_to_deploy respects the deploy.max_commits directive" do + test "#next_commit_to_deploy respects the deploy.max_commits directive given the commit is deployable" do @stack.tasks.destroy_all - fifth_commit = shipit_commits(:third) - fifth_commit.statuses.create!(stack_id: @stack.id, state: 'success', context: 'ci/travis') - assert_predicate fifth_commit, :deployable? + third_commit = shipit_commits(:third) + third_commit.statuses.create!(stack_id: @stack.id, state: 'success', context: 'ci/travis') + assert_predicate third_commit, :deployable? assert_equal shipit_commits(:third), @stack.next_commit_to_deploy @@ -717,6 +717,19 @@ def self.deliver(event, stack, payload) assert_equal shipit_commits(:third), @stack.next_commit_to_deploy end + test "#next_commit_to_deploy deploys the first deployable commit when deploy.max_commits directive fails to find a deployable commit" do + @stack.tasks.destroy_all + + third_commit = shipit_commits(:third) + third_commit.statuses.create!(stack_id: @stack.id, state: 'success', context: 'ci/travis') + assert_predicate third_commit, :deployable? + + assert_equal shipit_commits(:third), @stack.next_commit_to_deploy + + @stack.expects(:maximum_commits_per_deploy).returns(1).at_least_once + assert_equal shipit_commits(:third), @stack.next_commit_to_deploy + end + test "setting #lock_reason also sets #locked_since" do assert_predicate @stack.locked_since, :nil? From 6c5983a74fbe526a916000e6ebfcbc737de70449 Mon Sep 17 00:00:00 2001 From: Derek Watson Date: Tue, 12 Sep 2023 22:11:14 -0400 Subject: [PATCH 39/79] added support for config files nested in .shipit/ --- app/models/shipit/deploy_spec/file_system.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/shipit/deploy_spec/file_system.rb b/app/models/shipit/deploy_spec/file_system.rb index 8e3d0f84a..f4b0a987c 100644 --- a/app/models/shipit/deploy_spec/file_system.rb +++ b/app/models/shipit/deploy_spec/file_system.rb @@ -101,7 +101,16 @@ def load_config end def shipit_file_names_in_priority_order - ["#{app_name}.#{@env}.yml", "#{app_name}.yml", "shipit.#{@env}.yml", "shipit.yml"].uniq + [ + "#{app_name}.#{@env}.yml", + "#{app_name}.yml", + "shipit.#{@env}.yml", + "shipit.yml", + ".shipit/#{app_name}.#{@env}.yml", + ".shipit/#{app_name}.yml", + ".shipit/#{@env}.yml", + ".shipit/shipit.yml", + ].uniq end def bare_shipit_filenames From eebb54def17593c6840c6f0720f3552e67b809d2 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 13 Sep 2023 08:28:00 +0200 Subject: [PATCH 40/79] Improve config file order --- app/models/shipit/deploy_spec/file_system.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/shipit/deploy_spec/file_system.rb b/app/models/shipit/deploy_spec/file_system.rb index f4b0a987c..3708b9df3 100644 --- a/app/models/shipit/deploy_spec/file_system.rb +++ b/app/models/shipit/deploy_spec/file_system.rb @@ -103,18 +103,21 @@ def load_config def shipit_file_names_in_priority_order [ "#{app_name}.#{@env}.yml", - "#{app_name}.yml", - "shipit.#{@env}.yml", - "shipit.yml", ".shipit/#{app_name}.#{@env}.yml", + + "#{app_name}.yml", ".shipit/#{app_name}.yml", + + "shipit.#{@env}.yml", ".shipit/#{@env}.yml", + + "shipit.yml", ".shipit/shipit.yml", ].uniq end def bare_shipit_filenames - ["#{app_name}.yml", "shipit.yml"].uniq + ["#{app_name}.yml", "shipit.yml", ".shipit/#{app_name}.yml", ".shipit/shipit.yml"].uniq end def config_file_path From 7f5bce4cbea4e9ef0bad51e868c5e689b71062f6 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Thu, 5 Oct 2023 17:36:31 -0400 Subject: [PATCH 41/79] Update `master` to `main` --- README.md | 2 +- config/secrets.development.example.yml | 2 +- config/secrets.development.shopify.yml | 2 +- contrib/browser-extension/README.md | 4 ++-- docs/setup.md | 2 +- template.rb | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ae1a7cb46..e8a6f17f1 100644 --- a/README.md +++ b/README.md @@ -641,7 +641,7 @@ Your deploy scripts have access to the following environment variables: * `GITHUB_REPO_OWNER`: The GitHub username of the repository owner for the current deploy/task. * `EMAIL`: Email of the user that triggered the deploy/task (if available) * `ENVIRONMENT`: The stack environment (e.g `production` / `staging`) -* `BRANCH`: The stack branch (e.g `master`) +* `BRANCH`: The stack branch (e.g `main`) * `LAST_DEPLOYED_SHA`: The git SHA of the last deployed commit * `DIFF_LINK`: URL to the diff on GitHub. * `TASK_ID`: ID of the task that is running diff --git a/config/secrets.development.example.yml b/config/secrets.development.example.yml index 90829c9f8..ef996717d 100644 --- a/config/secrets.development.example.yml +++ b/config/secrets.development.example.yml @@ -1,7 +1,7 @@ host: 'localhost:3000' redis_url: 'redis://127.0.0.1:6379/0' -# For creating an app see: https://github.com/Shopify/shipit-engine/blob/master/docs/setup.md#creating-the-github-app +# For creating an app see: https://github.com/Shopify/shipit-engine/blob/main/docs/setup.md#creating-the-github-app # Can be obtained there: https://github.com/settings/apps # Set the "Authorization callback URL" as `/github/auth/github/callback` diff --git a/config/secrets.development.shopify.yml b/config/secrets.development.shopify.yml index f13fa971c..52e9ff6c5 100644 --- a/config/secrets.development.shopify.yml +++ b/config/secrets.development.shopify.yml @@ -1,7 +1,7 @@ host: 'shipit-engine.myshopify.io' redis_url: 'redis://shipit-engine.railgun:6379' -# For creating an app see: https://github.com/Shopify/shipit-engine/blob/master/docs/setup.md#creating-the-github-app +# For creating an app see: https://github.com/Shopify/shipit-engine/blob/main/docs/setup.md#creating-the-github-app github: somegithuborg: diff --git a/contrib/browser-extension/README.md b/contrib/browser-extension/README.md index 642015dbe..5a4a5452f 100644 --- a/contrib/browser-extension/README.md +++ b/contrib/browser-extension/README.md @@ -1,8 +1,8 @@ # Shipit Browser Extension -If you have ever pushed to a broken `master` because you forgot to check CI/Slack then we have the extension for you. +If you have ever pushed to a broken `main` because you forgot to check CI/Slack then we have the extension for you. -This extension will alert you on GitHub's pull request page if `master` is broken, so that you can avoid the embarassment of having merged on red master. +This extension will alert you on GitHub's pull request page if `main` is broken, so that you can avoid the embarassment of having merged on red master. ## Installation diff --git a/docs/setup.md b/docs/setup.md index 0a907a9aa..4bf035fda 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -15,7 +15,7 @@ In the future we'd like to provide it fully packaged inside a Docker container, Shipit provides you with a Rails template. To bootstrap your Shipit installation: 1. If you don't have Rails installed, run this command: `gem install rails -v 7.0` -2. Run this command: `rails _7.0_ new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m https://raw.githubusercontent.com/Shopify/shipit-engine/master/template.rb` +2. Run this command: `rails _7.0_ new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m https://raw.githubusercontent.com/Shopify/shipit-engine/main/template.rb` ## Creating the GitHub App diff --git a/template.rb b/template.rb index 607b043e0..560d8f8de 100644 --- a/template.rb +++ b/template.rb @@ -151,5 +151,5 @@ ) end - say("Read https://github.com/Shopify/shipit-engine/blob/master/docs/setup.md for the details on how to create the App and update config/secrets.yml", Thor::Shell::Color::GREEN, true) + say("Read https://github.com/Shopify/shipit-engine/blob/main/docs/setup.md for the details on how to create the App and update config/secrets.yml", Thor::Shell::Color::GREEN, true) end From 0400cd0a9cf958d368cad2a695a58b0cd2f45b43 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Thu, 5 Oct 2023 17:37:07 -0400 Subject: [PATCH 42/79] maybe these changes are not supposed to be made --- app/views/shipit/merge_status/failure.html.erb | 2 +- lib/shipit/stack_commands.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/shipit/merge_status/failure.html.erb b/app/views/shipit/merge_status/failure.html.erb index dcd0a258e..2fe738881 100644 --- a/app/views/shipit/merge_status/failure.html.erb +++ b/app/views/shipit/merge_status/failure.html.erb @@ -15,7 +15,7 @@ <%= link_to @stack.to_param, stack_url(@stack), target: '_blank', rel: 'noopener' %> - master branch is failing! + main branch is failing! <%= render 'commit_count_warning' if display_commit_count_warning?(params[:commits].to_i) %> diff --git a/lib/shipit/stack_commands.rb b/lib/shipit/stack_commands.rb index 932aced3b..ecc3daf21 100644 --- a/lib/shipit/stack_commands.rb +++ b/lib/shipit/stack_commands.rb @@ -106,7 +106,7 @@ def git_cmd_succeeds?(path) .success? end - def git_clone(url, path, branch: 'master', **kwargs) + def git_clone(url, path, branch: 'main', **kwargs) git('clone', '--quiet', *modern_git_args, '--recursive', '--branch', branch, url, path, **kwargs) end From 822679696ed9b70f9534fecee3178d0fa3716607 Mon Sep 17 00:00:00 2001 From: Oleksiy Kovyrin Date: Thu, 14 Dec 2023 15:01:31 -0500 Subject: [PATCH 43/79] Allow overrides for default task values via URL parameters --- app/controllers/shipit/tasks_controller.rb | 1 + app/models/shipit/task_definition.rb | 8 ++++++++ app/models/shipit/variable_definition.rb | 8 ++++++++ app/views/shipit/_variables.html.erb | 2 +- test/controllers/tasks_controller_test.rb | 9 ++++++++- 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/controllers/shipit/tasks_controller.rb b/app/controllers/shipit/tasks_controller.rb index 6a95d84b7..18bdd337d 100644 --- a/app/controllers/shipit/tasks_controller.rb +++ b/app/controllers/shipit/tasks_controller.rb @@ -16,6 +16,7 @@ def index def new @definition = stack.find_task_definition(params[:definition_id]) @task = stack.tasks.build(definition: @definition) + @task.definition.override_variables(params) end def show diff --git a/app/models/shipit/task_definition.rb b/app/models/shipit/task_definition.rb index bc814709b..4d1bd2704 100644 --- a/app/models/shipit/task_definition.rb +++ b/app/models/shipit/task_definition.rb @@ -40,6 +40,14 @@ def render_title(env) "This task (title: #{@title}) cannot be shown due to an incorrect variable name. Check your shipit.yml file" end + def override_variables(params) + variables.each do |var| + if params.key?(var.name) + var.override_value(params[var.name]) + end + end + end + def allow_concurrency? @allow_concurrency end diff --git a/app/models/shipit/variable_definition.rb b/app/models/shipit/variable_definition.rb index 5093e81f2..6d0e0a32a 100644 --- a/app/models/shipit/variable_definition.rb +++ b/app/models/shipit/variable_definition.rb @@ -15,6 +15,14 @@ def default_provided? @default_provided end + def override_value(value) + @override = value.to_s + end + + def value + @override.presence || default + end + def to_h { 'name' => @name, diff --git a/app/views/shipit/_variables.html.erb b/app/views/shipit/_variables.html.erb index c87397154..63b8b66ce 100644 --- a/app/views/shipit/_variables.html.erb +++ b/app/views/shipit/_variables.html.erb @@ -9,7 +9,7 @@ <% if variable.select %> <%= field.select variable.name, options_for_select([["Please select...", { disabled: "disabled" }]] + variable.select, variable.default || "Please select...") %> <% else %> - <%= field.text_field variable.name, value: variable.default %> + <%= field.text_field variable.name, value: variable.value %> <% end %> <%= field.label variable.name, variable.title || variable.name %>

diff --git a/test/controllers/tasks_controller_test.rb b/test/controllers/tasks_controller_test.rb index adbd9355c..ff5fc08c2 100644 --- a/test/controllers/tasks_controller_test.rb +++ b/test/controllers/tasks_controller_test.rb @@ -11,9 +11,16 @@ class TasksControllerTest < ActionController::TestCase session[:user_id] = shipit_users(:walrus).id end - test "tasks defined in the shipit.yml can be displayed" do + test "tasks defined in the shipit.yml can be displayed with default variable values" do get :new, params: { stack_id: @stack, definition_id: @definition.id } assert_response :ok + assert_select 'input[name="task[env][FOO]"][value="1"]' + end + + test "it is possible to provide a default value override for a task" do + get :new, params: { stack_id: @stack, definition_id: @definition.id, FOO: '42' } + assert_response :ok + assert_select 'input[name="task[env][FOO]"][value="42"]' end test "tasks defined in the shipit.yml can't be triggered if the stack is being deployed" do From 4b5ac2b3d9d7d9d8ce49a2559fca46d9548a8495 Mon Sep 17 00:00:00 2001 From: Oleksiy Kovyrin Date: Thu, 14 Dec 2023 15:41:40 -0500 Subject: [PATCH 44/79] Update app/views/shipit/_variables.html.erb Co-authored-by: Jean byroot Boussier --- app/views/shipit/_variables.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shipit/_variables.html.erb b/app/views/shipit/_variables.html.erb index 63b8b66ce..a43dd6c93 100644 --- a/app/views/shipit/_variables.html.erb +++ b/app/views/shipit/_variables.html.erb @@ -9,7 +9,7 @@ <% if variable.select %> <%= field.select variable.name, options_for_select([["Please select...", { disabled: "disabled" }]] + variable.select, variable.default || "Please select...") %> <% else %> - <%= field.text_field variable.name, value: variable.value %> + <%= field.text_field variable.name, value: params[variable.name].presence || variable.default %> <% end %> <%= field.label variable.name, variable.title || variable.name %>

From d9785f7a43c5cfd1aa1c34a63c6798c8c3a7f3e5 Mon Sep 17 00:00:00 2001 From: Oleksiy Kovyrin Date: Thu, 14 Dec 2023 15:43:13 -0500 Subject: [PATCH 45/79] Allow override in the view --- app/controllers/shipit/tasks_controller.rb | 1 - app/models/shipit/task_definition.rb | 8 -------- app/models/shipit/variable_definition.rb | 8 -------- 3 files changed, 17 deletions(-) diff --git a/app/controllers/shipit/tasks_controller.rb b/app/controllers/shipit/tasks_controller.rb index 18bdd337d..6a95d84b7 100644 --- a/app/controllers/shipit/tasks_controller.rb +++ b/app/controllers/shipit/tasks_controller.rb @@ -16,7 +16,6 @@ def index def new @definition = stack.find_task_definition(params[:definition_id]) @task = stack.tasks.build(definition: @definition) - @task.definition.override_variables(params) end def show diff --git a/app/models/shipit/task_definition.rb b/app/models/shipit/task_definition.rb index 4d1bd2704..bc814709b 100644 --- a/app/models/shipit/task_definition.rb +++ b/app/models/shipit/task_definition.rb @@ -40,14 +40,6 @@ def render_title(env) "This task (title: #{@title}) cannot be shown due to an incorrect variable name. Check your shipit.yml file" end - def override_variables(params) - variables.each do |var| - if params.key?(var.name) - var.override_value(params[var.name]) - end - end - end - def allow_concurrency? @allow_concurrency end diff --git a/app/models/shipit/variable_definition.rb b/app/models/shipit/variable_definition.rb index 6d0e0a32a..5093e81f2 100644 --- a/app/models/shipit/variable_definition.rb +++ b/app/models/shipit/variable_definition.rb @@ -15,14 +15,6 @@ def default_provided? @default_provided end - def override_value(value) - @override = value.to_s - end - - def value - @override.presence || default - end - def to_h { 'name' => @name, From 9607b861ae0ad7ddd72a624eea6b1e7f673d480d Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Thu, 18 Jan 2024 15:52:28 -0500 Subject: [PATCH 46/79] Update dev.yml --- dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev.yml b/dev.yml index 3327f5df7..6d9736d38 100644 --- a/dev.yml +++ b/dev.yml @@ -5,7 +5,7 @@ name: shipit-engine type: rails up: - - homebrew: + - packages: - sqlite - ruby: version: 2.7.5 From 402eb77a1c13db2a1a2b8a4424f5e394dea7ea00 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Thu, 18 Jan 2024 15:39:17 -0500 Subject: [PATCH 47/79] Rails 7.1.1 upgrade Update CHANGELOG.md --- .github/workflows/main.yml | 2 +- CHANGELOG.md | 2 ++ docs/setup.md | 2 +- script/cibuild | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6994a87c8..6efee0c9f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -150,7 +150,7 @@ jobs: export SHIPIT_GEM_PATH="${PWD}" mkdir /tmp/new-app cd /tmp/new-app - gem install rails -v '~> 7.0.2' --no-document + gem install rails -v '~> 7.1.1' --no-document rails new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m "${SHIPIT_GEM_PATH}/template.rb" env: SHIPIT_EDGE: "1" diff --git a/CHANGELOG.md b/CHANGELOG.md index cc7f00316..53f3ea8e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +* Upgraded to Rails 7.1.1 + # 0.38.0 * Convert `commit_deployment_statuses.github_id` to bigint (#1312) diff --git a/docs/setup.md b/docs/setup.md index 4bf035fda..fbcf710f6 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -14,7 +14,7 @@ In the future we'd like to provide it fully packaged inside a Docker container, Shipit provides you with a Rails template. To bootstrap your Shipit installation: -1. If you don't have Rails installed, run this command: `gem install rails -v 7.0` +1. If you don't have Rails installed, run this command: `gem install rails -v 7.1.1` 2. Run this command: `rails _7.0_ new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m https://raw.githubusercontent.com/Shopify/shipit-engine/main/template.rb` ## Creating the GitHub App diff --git a/script/cibuild b/script/cibuild index 3ed1e1a50..12d7377ac 100755 --- a/script/cibuild +++ b/script/cibuild @@ -38,8 +38,8 @@ case $SUITE in git config --global user.email "anonymous@example.com" git config --global user.name "Anonymous" - gem install rails -v 7.0 - rails _7.0_ new shipit -m "${TEMPLATE}" \ + gem install rails -v 7.1.1 + rails _7.1.1_ new shipit -m "${TEMPLATE}" \ --skip-action-cable \ --skip-turbolinks \ --skip-action-mailer \ From 1e5831b41a9564d97f56c2508eb2c93449df5f09 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 19 Jan 2024 16:14:26 -0500 Subject: [PATCH 48/79] wip --- shipit-engine.gemspec | 2 +- template.rb | 6 +++--- test/dummy/config/application.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shipit-engine.gemspec b/shipit-engine.gemspec index 3ede910da..99ae08cea 100644 --- a/shipit-engine.gemspec +++ b/shipit-engine.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_dependency('octokit', '~> 4.20') s.add_dependency('omniauth-github', '~> 1.4') s.add_dependency('pubsubstub', '~> 0.2.0') - s.add_dependency('rails', '~> 7.0.0') + s.add_dependency('rails', '~> 7.1.1') s.add_dependency('rails-timeago', '~> 2.13.0') s.add_dependency('rails_autolink', '~> 1.1.6') s.add_dependency('rake') diff --git a/template.rb b/template.rb index 560d8f8de..7e2f24a10 100644 --- a/template.rb +++ b/template.rb @@ -3,8 +3,8 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7') raise Thor::Error, "You need at least Ruby 2.7 to install shipit" end -if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('7.0') - raise Thor::Error, "You need Rails 7.0 to install shipit" +if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('7.1.1') + raise Thor::Error, "You need Rails 7.1.1 to install shipit" end route %(mount Shipit::Engine, at: '/') @@ -124,7 +124,7 @@ end CODE -inject_into_file 'config/application.rb', after: "load_defaults 7.0\n" do +inject_into_file 'config/application.rb', after: "load_defaults 7.1\n" do "\n config.active_job.queue_adapter = :sidekiq\n" end diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 99c43aac8..fe54eff24 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -17,6 +17,6 @@ module Shipit class Application < Rails::Application - config.load_defaults 7.0 + config.load_defaults 7.1 end end From ff98ab8ae0eeed7f815a240f995c5bdd00cce6ae Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 26 Jan 2024 10:59:38 -0500 Subject: [PATCH 49/79] Update Gemfile.lock --- Gemfile.lock | 165 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 99 insertions(+), 66 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2b125cfb3..6c2c819f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,7 +16,7 @@ PATH omniauth-github (~> 1.4) paquito pubsubstub (~> 0.2.0) - rails (~> 7.0.0) + rails (~> 7.1.1) rails-timeago (~> 2.13.0) rails_autolink (~> 1.1.6) rake @@ -33,73 +33,82 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) + actioncable (7.1.3) + actionpack (= 7.1.3) + activesupport (= 7.1.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + zeitwerk (~> 2.6) + actionmailbox (7.1.3) + actionpack (= 7.1.3) + activejob (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.7.2) - actionpack (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionmailer (7.1.3) + actionpack (= 7.1.3) + actionview (= 7.1.3) + activejob (= 7.1.3) + activesupport (= 7.1.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.7.2) - actionview (= 7.0.7.2) - activesupport (= 7.0.7.2) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.3) + actionview (= 7.1.3) + activesupport (= 7.1.3) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.7.2) - actionpack (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.3) + actionpack (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.7.2) - activesupport (= 7.0.7.2) + actionview (7.1.3) + activesupport (= 7.1.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_model_serializers (0.9.9) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.0.7.2) - activesupport (= 7.0.7.2) + activejob (7.1.3) + activesupport (= 7.1.3) globalid (>= 0.3.6) - activemodel (7.0.7.2) - activesupport (= 7.0.7.2) - activerecord (7.0.7.2) - activemodel (= 7.0.7.2) - activesupport (= 7.0.7.2) - activestorage (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activesupport (= 7.0.7.2) + activemodel (7.1.3) + activesupport (= 7.1.3) + activerecord (7.1.3) + activemodel (= 7.1.3) + activesupport (= 7.1.3) + timeout (>= 0.4.0) + activestorage (7.1.3) + actionpack (= 7.1.3) + activejob (= 7.1.3) + activerecord (= 7.1.3) + activesupport (= 7.1.3) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.7.2) + activesupport (7.1.3) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) @@ -111,6 +120,8 @@ GEM descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) + base64 (0.2.0) + bigdecimal (3.1.6) builder (3.2.4) byebug (11.1.3) coderay (1.1.3) @@ -124,6 +135,7 @@ GEM execjs coffee-script-source (1.12.2) concurrent-ruby (1.2.2) + connection_pool (2.4.1) crack (0.4.5) rexml crass (1.0.6) @@ -131,6 +143,8 @@ GEM descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) docile (1.4.0) + drb (2.2.0) + ruby2_keywords equalizer (0.0.11) erubi (1.12.0) execjs (2.8.1) @@ -174,6 +188,10 @@ GEM i18n (1.14.1) concurrent-ruby (~> 1.0) ice_nine (0.11.2) + io-console (0.7.2) + irb (1.11.1) + rdoc + reline (>= 0.4.2) jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -203,6 +221,7 @@ GEM msgpack (1.7.1) multi_xml (0.6.0) multipart-post (2.3.0) + mutex_m (0.2.0) mysql2 (0.5.3) net-imap (0.3.6) date @@ -248,29 +267,36 @@ GEM pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) + psych (5.1.2) + stringio public_suffix (4.0.6) pubsubstub (0.2.2) rack redis (~> 4.0) racc (1.7.1) rack (2.2.7) + rack-session (1.0.2) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.7.2) - actioncable (= 7.0.7.2) - actionmailbox (= 7.0.7.2) - actionmailer (= 7.0.7.2) - actionpack (= 7.0.7.2) - actiontext (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activemodel (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + rackup (1.0.0) + rack (< 3) + webrick + rails (7.1.3) + actioncable (= 7.1.3) + actionmailbox (= 7.1.3) + actionmailer (= 7.1.3) + actionpack (= 7.1.3) + actiontext (= 7.1.3) + actionview (= 7.1.3) + activejob (= 7.1.3) + activemodel (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) bundler (>= 1.15.0) - railties (= 7.0.7.2) - rails-dom-testing (2.1.1) + railties (= 7.1.3) + rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) @@ -284,19 +310,24 @@ GEM actionview (> 3.1) activesupport (> 3.1) railties (> 3.1) - railties (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) - method_source + railties (7.1.3) + actionpack (= 7.1.3) + activesupport (= 7.1.3) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.0.6) + rdoc (6.6.2) + psych (>= 4.0.0) redis (4.8.1) redis-objects (1.7.0) redis regexp_parser (2.2.1) + reline (0.4.2) + io-console (~> 0.5) responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) @@ -356,6 +387,7 @@ GEM state_machines-activerecord (0.8.0) activerecord (>= 5.1) state_machines-activemodel (>= 0.8.0) + stringio (3.1.0) thor (1.2.2) thread_safe (0.3.6) tilt (2.2.0) @@ -376,6 +408,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.1) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) From 75085425c443cd502e911ea69f94e4d1db38a31c Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Tue, 23 Jan 2024 12:56:29 -0500 Subject: [PATCH 50/79] Update application.rb --- test/dummy/config/application.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index fe54eff24..9a9a61c14 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -18,5 +18,6 @@ module Shipit class Application < Rails::Application config.load_defaults 7.1 + config.active_record.encryption.support_sha1_for_non_deterministic_encryption = true end end From 6dcb9702791ea4385f64bb392f8921e3db1821c7 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Wed, 24 Jan 2024 12:12:14 -0500 Subject: [PATCH 51/79] Update merge_request_test.rb --- test/models/merge_request_test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/models/merge_request_test.rb b/test/models/merge_request_test.rb index 249d6a5c6..dc09ebcb6 100644 --- a/test/models/merge_request_test.rb +++ b/test/models/merge_request_test.rb @@ -243,7 +243,10 @@ class MergeRequestTest < ActiveSupport::TestCase end test "status transitions emit hooks" do - job = assert_enqueued_with(job: EmitEventJob) do + expected_args = ->(job_args) do + job_args.first[:event] == 'merge' + end + job = assert_enqueued_with(job: EmitEventJob, args: expected_args) do @pr.reject!('merge_conflict') end params = job.arguments.first From af3c0438e6ca55f2ed74559656eead3ba41bc734 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Tue, 23 Jan 2024 18:09:38 -0500 Subject: [PATCH 52/79] Restrict to Rails 7.1.1 --- .github/workflows/main.yml | 2 +- shipit-engine.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6efee0c9f..9e27d30a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -150,7 +150,7 @@ jobs: export SHIPIT_GEM_PATH="${PWD}" mkdir /tmp/new-app cd /tmp/new-app - gem install rails -v '~> 7.1.1' --no-document + gem install rails -v '7.1.1' --no-document rails new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m "${SHIPIT_GEM_PATH}/template.rb" env: SHIPIT_EDGE: "1" diff --git a/shipit-engine.gemspec b/shipit-engine.gemspec index 99ae08cea..054a7a589 100644 --- a/shipit-engine.gemspec +++ b/shipit-engine.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_dependency('octokit', '~> 4.20') s.add_dependency('omniauth-github', '~> 1.4') s.add_dependency('pubsubstub', '~> 0.2.0') - s.add_dependency('rails', '~> 7.1.1') + s.add_dependency('rails', '= 7.1.1') s.add_dependency('rails-timeago', '~> 2.13.0') s.add_dependency('rails_autolink', '~> 1.1.6') s.add_dependency('rake') From 1214962a99f0a7a8c90dd2646112ebfba3158233 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 26 Jan 2024 11:15:34 -0500 Subject: [PATCH 53/79] Update Gemfile.lock --- Gemfile.lock | 151 +++++++++++++++++++++++++-------------------------- 1 file changed, 75 insertions(+), 76 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6c2c819f8..2af1e3003 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,7 +16,7 @@ PATH omniauth-github (~> 1.4) paquito pubsubstub (~> 0.2.0) - rails (~> 7.1.1) + rails (= 7.1.1) rails-timeago (~> 2.13.0) rails_autolink (~> 1.1.6) rake @@ -33,51 +33,50 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + actioncable (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actionmailbox (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3) - actionpack (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activesupport (= 7.1.3) + actionmailer (7.1.1) + actionpack (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activesupport (= 7.1.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3) - actionview (= 7.1.3) - activesupport (= 7.1.3) + actionpack (7.1.1) + actionview (= 7.1.1) + activesupport (= 7.1.1) nokogiri (>= 1.8.5) - racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3) - actionpack (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actiontext (7.1.1) + actionpack (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3) - activesupport (= 7.1.3) + actionview (7.1.1) + activesupport (= 7.1.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -85,22 +84,22 @@ GEM active_model_serializers (0.9.9) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.1.3) - activesupport (= 7.1.3) + activejob (7.1.1) + activesupport (= 7.1.1) globalid (>= 0.3.6) - activemodel (7.1.3) - activesupport (= 7.1.3) - activerecord (7.1.3) - activemodel (= 7.1.3) - activesupport (= 7.1.3) + activemodel (7.1.1) + activesupport (= 7.1.1) + activerecord (7.1.1) + activemodel (= 7.1.1) + activesupport (= 7.1.1) timeout (>= 0.4.0) - activestorage (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activesupport (= 7.1.3) + activestorage (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activesupport (= 7.1.1) marcel (~> 1.0) - activesupport (7.1.3) + activesupport (7.1.1) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -134,12 +133,12 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) connection_pool (2.4.1) crack (0.4.5) rexml crass (1.0.6) - date (3.3.3) + date (3.3.4) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) docile (1.4.0) @@ -181,8 +180,8 @@ GEM faraday-retry (1.0.3) ffi (1.15.5) gemoji (2.1.0) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) hashdiff (1.0.1) hashie (5.0.0) i18n (1.14.1) @@ -202,7 +201,7 @@ GEM libv8-node (16.10.0.0-x86_64-linux) lodash-rails (4.17.21) railties (>= 3.1) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -212,10 +211,10 @@ GEM net-smtp marcel (1.0.2) method_source (1.0.0) - mini_mime (1.1.2) + mini_mime (1.1.5) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.19.0) + minitest (5.21.2) mocha (2.1.0) ruby2_keywords (>= 0.0.5) msgpack (1.7.1) @@ -223,21 +222,21 @@ GEM multipart-post (2.3.0) mutex_m (0.2.0) mysql2 (0.5.3) - net-imap (0.3.6) + net-imap (0.4.9.1) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.3.3) + net-smtp (0.4.0.1) net-protocol - nio4r (2.5.9) - nokogiri (1.15.2-arm64-darwin) + nio4r (2.7.0) + nokogiri (1.15.5-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.2-x86_64-darwin) + nokogiri (1.15.5-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.2-x86_64-linux) + nokogiri (1.15.5-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -273,8 +272,8 @@ GEM pubsubstub (0.2.2) rack redis (~> 4.0) - racc (1.7.1) - rack (2.2.7) + racc (1.7.3) + rack (2.2.8) rack-session (1.0.2) rack (< 3) rack-test (2.1.0) @@ -282,20 +281,20 @@ GEM rackup (1.0.0) rack (< 3) webrick - rails (7.1.3) - actioncable (= 7.1.3) - actionmailbox (= 7.1.3) - actionmailer (= 7.1.3) - actionpack (= 7.1.3) - actiontext (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activemodel (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + rails (7.1.1) + actioncable (= 7.1.1) + actionmailbox (= 7.1.1) + actionmailer (= 7.1.1) + actionpack (= 7.1.1) + actiontext (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activemodel (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) bundler (>= 1.15.0) - railties (= 7.1.3) + railties (= 7.1.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -310,16 +309,16 @@ GEM actionview (> 3.1) activesupport (> 3.1) railties (> 3.1) - railties (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + railties (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) irb rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rdoc (6.6.2) psych (>= 4.0.0) redis (4.8.1) @@ -388,10 +387,10 @@ GEM activerecord (>= 5.1) state_machines-activemodel (>= 0.8.0) stringio (3.1.0) - thor (1.2.2) + thor (1.3.0) thread_safe (0.3.6) tilt (2.2.0) - timeout (0.4.0) + timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) @@ -409,10 +408,10 @@ GEM crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webrick (1.8.1) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.8) + zeitwerk (2.6.12) PLATFORMS arm64-darwin-21 From ba2c64a58a014e2eb394e9f263d64892a9d3ef0d Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 26 Jan 2024 11:19:54 -0500 Subject: [PATCH 54/79] Fix failing setup ruby 2.7 step in some Github Actions --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2af1e3003..f293118e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -196,9 +196,9 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) jwt (2.7.1) - libv8-node (16.10.0.0-arm64-darwin) - libv8-node (16.10.0.0-x86_64-darwin) - libv8-node (16.10.0.0-x86_64-linux) + libv8-node (16.19.0.1-arm64-darwin) + libv8-node (16.19.0.1-x86_64-darwin) + libv8-node (16.19.0.1-x86_64-linux) lodash-rails (4.17.21) railties (>= 3.1) loofah (2.22.0) @@ -212,8 +212,8 @@ GEM marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.5) - mini_racer (0.6.2) - libv8-node (~> 16.10.0.0) + mini_racer (0.6.4) + libv8-node (~> 16.19.0.0) minitest (5.21.2) mocha (2.1.0) ruby2_keywords (>= 0.0.5) From 4f72beedc5c78014e8340baabc133341d8f13c4c Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 26 Jan 2024 13:20:11 -0500 Subject: [PATCH 55/79] Remove mini_racer gem --- Gemfile | 1 - Gemfile.lock | 6 ------ 2 files changed, 7 deletions(-) diff --git a/Gemfile b/Gemfile index e6c52fb4c..21ebd4a8c 100644 --- a/Gemfile +++ b/Gemfile @@ -25,5 +25,4 @@ end group :development, :test do gem 'byebug' gem 'pry' - gem 'mini_racer' end diff --git a/Gemfile.lock b/Gemfile.lock index f293118e8..bc11eee1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -196,9 +196,6 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) jwt (2.7.1) - libv8-node (16.19.0.1-arm64-darwin) - libv8-node (16.19.0.1-x86_64-darwin) - libv8-node (16.19.0.1-x86_64-linux) lodash-rails (4.17.21) railties (>= 3.1) loofah (2.22.0) @@ -212,8 +209,6 @@ GEM marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.5) - mini_racer (0.6.4) - libv8-node (~> 16.19.0.0) minitest (5.21.2) mocha (2.1.0) ruby2_keywords (>= 0.0.5) @@ -422,7 +417,6 @@ PLATFORMS DEPENDENCIES byebug faker - mini_racer mocha mysql2 pg From 5329c4f3b357b41a43937aec5723a10764644cd3 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 26 Jan 2024 13:34:05 -0500 Subject: [PATCH 56/79] Revert "Restrict to Rails 7.1.1" This reverts commit af3c0438e6ca55f2ed74559656eead3ba41bc734. --- .github/workflows/main.yml | 2 +- shipit-engine.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e27d30a1..6efee0c9f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -150,7 +150,7 @@ jobs: export SHIPIT_GEM_PATH="${PWD}" mkdir /tmp/new-app cd /tmp/new-app - gem install rails -v '7.1.1' --no-document + gem install rails -v '~> 7.1.1' --no-document rails new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m "${SHIPIT_GEM_PATH}/template.rb" env: SHIPIT_EDGE: "1" diff --git a/shipit-engine.gemspec b/shipit-engine.gemspec index 054a7a589..99ae08cea 100644 --- a/shipit-engine.gemspec +++ b/shipit-engine.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_dependency('octokit', '~> 4.20') s.add_dependency('omniauth-github', '~> 1.4') s.add_dependency('pubsubstub', '~> 0.2.0') - s.add_dependency('rails', '= 7.1.1') + s.add_dependency('rails', '~> 7.1.1') s.add_dependency('rails-timeago', '~> 2.13.0') s.add_dependency('rails_autolink', '~> 1.1.6') s.add_dependency('rake') From c1f65c4a7d59b0dee08e88a164b0282bc6ed051a Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 26 Jan 2024 13:35:47 -0500 Subject: [PATCH 57/79] Update Gemfile.lock --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index bc11eee1a..19e2cf230 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,7 +16,7 @@ PATH omniauth-github (~> 1.4) paquito pubsubstub (~> 0.2.0) - rails (= 7.1.1) + rails (~> 7.1.1) rails-timeago (~> 2.13.0) rails_autolink (~> 1.1.6) rake From 5550402492faf06794dcff3adc2fbe573fa51e91 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 26 Jan 2024 15:31:29 -0500 Subject: [PATCH 58/79] Add minor tweaks --- docs/setup.md | 4 ++-- template.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/setup.md b/docs/setup.md index fbcf710f6..ffbfc1727 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -14,8 +14,8 @@ In the future we'd like to provide it fully packaged inside a Docker container, Shipit provides you with a Rails template. To bootstrap your Shipit installation: -1. If you don't have Rails installed, run this command: `gem install rails -v 7.1.1` -2. Run this command: `rails _7.0_ new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m https://raw.githubusercontent.com/Shopify/shipit-engine/main/template.rb` +1. If you don't have Rails installed, run this command: `gem install rails -v 7.1` +2. Run this command: `rails _7.1_ new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m https://raw.githubusercontent.com/Shopify/shipit-engine/main/template.rb` ## Creating the GitHub App diff --git a/template.rb b/template.rb index 7e2f24a10..7f7b2cea4 100644 --- a/template.rb +++ b/template.rb @@ -3,8 +3,8 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7') raise Thor::Error, "You need at least Ruby 2.7 to install shipit" end -if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('7.1.1') - raise Thor::Error, "You need Rails 7.1.1 to install shipit" +if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('7.1') + raise Thor::Error, "You need Rails 7.1 to install shipit" end route %(mount Shipit::Engine, at: '/') From d7200a0e7cb781691692e91e1e980becfc4db7e9 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Mon, 5 Feb 2024 16:18:50 -0500 Subject: [PATCH 59/79] Bump Octokit to 5.6.1 --- Gemfile.lock | 4 ++-- shipit-engine.gemspec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 19e2cf230..7771312d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ PATH gemoji (~> 2.1) jquery-rails (~> 4.4) lodash-rails (~> 4.17) - octokit (~> 4.20) + octokit (~> 5.6.0) omniauth-github (~> 1.4) paquito pubsubstub (~> 0.2.0) @@ -240,7 +240,7 @@ GEM rack (>= 1.2, < 4) snaky_hash (~> 2.0) version_gem (~> 1.1) - octokit (4.25.1) + octokit (5.6.1) faraday (>= 1, < 3) sawyer (~> 0.9) omniauth (1.9.2) diff --git a/shipit-engine.gemspec b/shipit-engine.gemspec index 99ae08cea..ea7a9cfcb 100644 --- a/shipit-engine.gemspec +++ b/shipit-engine.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |s| s.add_dependency('gemoji', '~> 2.1') s.add_dependency('jquery-rails', '~> 4.4') s.add_dependency('lodash-rails', '~> 4.17') - s.add_dependency('octokit', '~> 4.20') + s.add_dependency('octokit', '~> 5.6.0') s.add_dependency('omniauth-github', '~> 1.4') s.add_dependency('pubsubstub', '~> 0.2.0') s.add_dependency('rails', '~> 7.1.1') From 8d386d0408e5c7b50c64ea52c0dbed33d4f72e4a Mon Sep 17 00:00:00 2001 From: Ruidan Date: Mon, 5 Feb 2024 16:26:02 -0500 Subject: [PATCH 60/79] Remove accept header --- app/models/shipit/commit_deployment_status.rb | 1 - lib/shipit/github_app.rb | 1 - lib/shipit/octokit_check_runs.rb | 4 +--- test/models/commit_deployment_status_test.rb | 1 - 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/app/models/shipit/commit_deployment_status.rb b/app/models/shipit/commit_deployment_status.rb index 85bde2b35..6be2693f5 100644 --- a/app/models/shipit/commit_deployment_status.rb +++ b/app/models/shipit/commit_deployment_status.rb @@ -48,7 +48,6 @@ def create_status_on_github(client) client.create_deployment_status( commit_deployment.api_url, status, - accept: 'application/vnd.github.flash-preview+json', target_url: url_helpers.stack_deploy_url(stack, task), description: description.truncate(DESCRIPTION_CHARACTER_LIMIT_ON_GITHUB), environment_url: stack.deploy_url, diff --git a/lib/shipit/github_app.rb b/lib/shipit/github_app.rb index a8ee5bfba..ae27297e0 100644 --- a/lib/shipit/github_app.rb +++ b/lib/shipit/github_app.rb @@ -103,7 +103,6 @@ def fetch_new_token ) do response = new_client(bearer_token: authentication_payload).create_app_installation_access_token( installation_id, - accept: 'application/vnd.github.machine-man-preview+json', ) token = Token.from_github(response) raise AuthenticationFailed if token.blank? diff --git a/lib/shipit/octokit_check_runs.rb b/lib/shipit/octokit_check_runs.rb index 09d75a016..4b13172b1 100644 --- a/lib/shipit/octokit_check_runs.rb +++ b/lib/shipit/octokit_check_runs.rb @@ -1,9 +1,7 @@ # frozen_string_literal: true module OctokitCheckRuns def check_runs(repo, sha, options = {}) - paginate("#{Octokit::Repository.path(repo)}/commits/#{sha}/check-runs", options.reverse_merge( - accept: 'application/vnd.github.antiope-preview+json', - )) + paginate("#{Octokit::Repository.path(repo)}/commits/#{sha}/check-runs", options) end end diff --git a/test/models/commit_deployment_status_test.rb b/test/models/commit_deployment_status_test.rb index 8bcbc5ab7..9d75fce59 100644 --- a/test/models/commit_deployment_status_test.rb +++ b/test/models/commit_deployment_status_test.rb @@ -15,7 +15,6 @@ class CommitDeploymentStatusTest < ActiveSupport::TestCase @author.github_api.class.any_instance.expects(:create_deployment_status).with( @deployment.api_url, 'in_progress', - accept: "application/vnd.github.flash-preview+json", target_url: "http://shipit.com/shopify/shipit-engine/production/deploys/#{@task.id}", description: "walrus triggered the deploy of shopify/shipit-engine/production to #{@deployment.short_sha}", environment_url: "https://shipit.shopify.com", From 9034b7b8b64591aeceebd4f9a4036dcad5b3af28 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Mon, 22 Jan 2024 17:41:00 -0500 Subject: [PATCH 61/79] Create secrets.development.json Create secrets.test.json Replace deprecated Rails.application.secrets Add ejson-rails gem Remove deprecation warning Passing the coder as positional argument is deprecated and will be removed in Rails 7.2 Remove deprecated TestFixtures.fixture_path= Remove deprecated check_pending! --- CHANGELOG.md | 6 ++++++ Gemfile | 1 + Gemfile.lock | 5 +++++ app/models/shipit/api_client.rb | 2 +- app/models/shipit/delivery.rb | 2 +- app/models/shipit/hook.rb | 2 +- app/models/shipit/pull_request.rb | 2 +- app/models/shipit/stack.rb | 2 +- app/models/shipit/task.rb | 4 ++-- app/views/shipit/missing_settings.html.erb | 2 +- lib/shipit.rb | 2 +- lib/shipit/engine.rb | 2 +- test/controllers/stacks_controller_test.rb | 2 +- .../0_load_development_secrets.rb | 4 ++-- test/dummy/config/secrets.development.json | 3 +++ test/dummy/config/secrets.test.json | 21 +++++++++++++++++++ test/test_helper.rb | 4 ++-- test/unit/github_app_test.rb | 2 +- 18 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 test/dummy/config/secrets.development.json create mode 100644 test/dummy/config/secrets.test.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f3ea8e6..ba8a009f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ # Unreleased +* Upgraded Octokit to 5.6.1 (#1327) +* Migrate from legacy Rails secrets to credentials (#1326) + * Rails secrets were [deprecated in Rails 7.1](https://github.com/rails/rails/pull/48472) + * [Guide on credentials](https://guides.rubyonrails.org/security.html#custom-credentials) + +# 0.39.0 * Upgraded to Rails 7.1.1 diff --git a/Gemfile b/Gemfile index 21ebd4a8c..b12bdc854 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source 'https://rubygems.org' gemspec gem 'sqlite3' +gem 'ejson-rails', require: 'ejson/rails/skip_secrets' group :ci do gem 'mysql2' diff --git a/Gemfile.lock b/Gemfile.lock index 19e2cf230..366772d1c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -144,6 +144,10 @@ GEM docile (1.4.0) drb (2.2.0) ruby2_keywords + ejson (1.4.1) + ejson-rails (0.2.1) + ejson + railties (>= 5.2) equalizer (0.0.11) erubi (1.12.0) execjs (2.8.1) @@ -416,6 +420,7 @@ PLATFORMS DEPENDENCIES byebug + ejson-rails faker mocha mysql2 diff --git a/app/models/shipit/api_client.rb b/app/models/shipit/api_client.rb index 27459c3ec..18f5b73c7 100644 --- a/app/models/shipit/api_client.rb +++ b/app/models/shipit/api_client.rb @@ -8,7 +8,7 @@ class ApiClient < Record validates :creator, :name, presence: true - serialize :permissions, Shipit.serialized_column(:permissions, type: Array) + serialize :permissions, coder: Shipit.serialized_column(:permissions, type: Array) PERMISSIONS = %w( read:stack write:stack diff --git a/app/models/shipit/delivery.rb b/app/models/shipit/delivery.rb index 141c87f8b..9f1fef9ae 100644 --- a/app/models/shipit/delivery.rb +++ b/app/models/shipit/delivery.rb @@ -9,7 +9,7 @@ class Delivery < Record validates :url, presence: true, url: { no_local: true, allow_blank: true } validates :content_type, presence: true - serialize :response_headers, SafeJSON + serialize :response_headers, coder: SafeJSON after_commit :purge_old_deliveries, on: :create diff --git a/app/models/shipit/hook.rb b/app/models/shipit/hook.rb index 9aa6a4e1f..5b20ddeda 100644 --- a/app/models/shipit/hook.rb +++ b/app/models/shipit/hook.rb @@ -87,7 +87,7 @@ def signature validates :content_type, presence: true, inclusion: { in: CONTENT_TYPES.keys } validates :events, presence: true, subset: { of: EVENTS } - serialize :events, Shipit::CSVSerializer + serialize :events, coder: Shipit::CSVSerializer scope :global, -> { where(stack_id: nil) } scope :scoped_to, ->(stack) { where(stack_id: stack.id) } diff --git a/app/models/shipit/pull_request.rb b/app/models/shipit/pull_request.rb index 0083ad9c0..8e993af82 100644 --- a/app/models/shipit/pull_request.rb +++ b/app/models/shipit/pull_request.rb @@ -11,7 +11,7 @@ class PullRequest < Record has_many :pull_request_assignments has_many :assignees, class_name: :User, through: :pull_request_assignments, source: :user - serialize :labels, Shipit.serialized_column(:labels, type: Array) + serialize :labels, coder: Shipit.serialized_column(:labels, type: Array) after_create_commit :emit_create_hooks after_update_commit :emit_update_hooks diff --git a/app/models/shipit/stack.rb b/app/models/shipit/stack.rb index 403f7ff82..4f2642f89 100644 --- a/app/models/shipit/stack.rb +++ b/app/models/shipit/stack.rb @@ -101,7 +101,7 @@ def sync_github_if_necessary validates :lock_reason, length: { maximum: 4096 } - serialize :cached_deploy_spec, DeploySpec + serialize :cached_deploy_spec, coder: DeploySpec delegate( :provisioning_handler_name, :find_task_definition, diff --git a/app/models/shipit/task.rb b/app/models/shipit/task.rb index 9db5e1155..c0baa4688 100644 --- a/app/models/shipit/task.rb +++ b/app/models/shipit/task.rb @@ -58,8 +58,8 @@ def new end end - serialize :definition, TaskDefinition - serialize :env, Shipit.serialized_column(:env, coder: EnvHash) + serialize :definition, coder: TaskDefinition + serialize :env, coder: Shipit.serialized_column(:env, coder: EnvHash) scope :success, -> { where(status: 'success') } scope :completed, -> { where(status: COMPLETED_STATUSES) } diff --git a/app/views/shipit/missing_settings.html.erb b/app/views/shipit/missing_settings.html.erb index 8c874f0c5..59acfb32f 100644 --- a/app/views/shipit/missing_settings.html.erb +++ b/app/views/shipit/missing_settings.html.erb @@ -22,7 +22,7 @@

Config: - <% if Rails.application.secrets.github.present? %> + <% if Rails.application.credentials.github.present? %> Success! <% else %> diff --git a/lib/shipit.rb b/lib/shipit.rb index 885f6b53f..8360dbb0a 100644 --- a/lib/shipit.rb +++ b/lib/shipit.rb @@ -291,7 +291,7 @@ def revision_file end def secrets - Rails.application.secrets + Rails.application.credentials end end diff --git a/lib/shipit/engine.rb b/lib/shipit/engine.rb index 0d90d124c..b1279137f 100644 --- a/lib/shipit/engine.rb +++ b/lib/shipit/engine.rb @@ -21,7 +21,7 @@ class Engine < ::Rails::Engine Shipit::Engine.routes.default_url_options[:host] = Shipit.host Pubsubstub.redis_url = Shipit.redis_url.to_s - Rails.application.secrets.deep_symbolize_keys! + Rails.application.credentials.deep_symbolize_keys! app.config.assets.paths << Emoji.images_path app.config.assets.precompile += %w( diff --git a/test/controllers/stacks_controller_test.rb b/test/controllers/stacks_controller_test.rb index 2a7c2fd15..7b8912937 100644 --- a/test/controllers/stacks_controller_test.rb +++ b/test/controllers/stacks_controller_test.rb @@ -10,7 +10,7 @@ class StacksControllerTest < ActionController::TestCase end test "validates that Shipit.github is present" do - Rails.application.secrets.stubs(:github).returns(nil) + Rails.application.credentials.stubs(:github).returns(nil) get :index assert_select "#github_app .missing" assert_select ".missing", count: 1 diff --git a/test/dummy/config/initializers/0_load_development_secrets.rb b/test/dummy/config/initializers/0_load_development_secrets.rb index 863be78d5..f3b83652b 100644 --- a/test/dummy/config/initializers/0_load_development_secrets.rb +++ b/test/dummy/config/initializers/0_load_development_secrets.rb @@ -2,8 +2,8 @@ if local_secrets.exist? secrets = YAML.load(local_secrets.read).deep_symbolize_keys if Rails.env.development? - Rails.application.secrets.deep_merge!(secrets) + Rails.application.credentials.deep_merge!(secrets) elsif Rails.env.test? - Rails.application.secrets.merge!(redis_url: secrets[:redis_url]) + Rails.application.credentials.merge!(redis_url: secrets[:redis_url]) end end diff --git a/test/dummy/config/secrets.development.json b/test/dummy/config/secrets.development.json new file mode 100644 index 000000000..2c22e2b66 --- /dev/null +++ b/test/dummy/config/secrets.development.json @@ -0,0 +1,3 @@ +{ + "secret_key_base": "s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t" +} \ No newline at end of file diff --git a/test/dummy/config/secrets.test.json b/test/dummy/config/secrets.test.json new file mode 100644 index 000000000..a08afdab4 --- /dev/null +++ b/test/dummy/config/secrets.test.json @@ -0,0 +1,21 @@ +{ + "host": "shipit.com", + "secret_key_base": "s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t", + "github_api": { + "token": "t0k3n" + }, + "github": { + "domain": null, + "app_id": 42, + "installation_id": 43, + "bot_login": "shipit[bot]", + "webhook_secret": null, + "private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA7iUQC2uUq/gtQg0gxtyaccuicYgmq1LUr1mOWbmwM1Cv63+S\n73qo8h87FX+YyclY5fZF6SMXIys02JOkImGgbnvEOLcHnImCYrWs03msOzEIO/pG\nM0YedAPtQ2MEiLIu4y8htosVxeqfEOPiq9kQgFxNKyETzjdIA9q1md8sofuJUmPv\nibacW1PecuAMnn+P8qf0XIDp7uh6noB751KvhCaCNTAPtVE9NZ18OmNG9GOyX/pu\npQHIrPgTpTG6KlAe3r6LWvemzwsMtuRGU+K+KhK9dFIlSE+v9rA32KScO8efOh6s\nGu3rWorV4iDu14U62rzEfdzzc63YL94sUbZxbwIDAQABAoIBADLJ8r8MxZtbhYN1\nu0zOFZ45WL6v09dsBfITvnlCUeLPzYUDIzoxxcBFittN6C744x3ARS6wjimw+EdM\nTZALlCSb/sA9wMDQzt7wchhz9Zh2H5RzDu+2f54sjDh38KqancdT8PO2fAFGxX/b\nqicOVyeZB9gv6MJtJc20olBbuXAeBNfcDABF9oxF+0i+Ssg7B4VXiqgcjtGbr/Og\nqRll7AqyTArVx2xEcVfZxeZ4zGnigzcJq4te7yYpxzwk+RxblkPh54Yt4WxZ+8DI\nRsn3r6ajlpwzpwvsJFU2Txq7xBTzGQMFmy/Pnjk83kP2cogxB2+tRyjITGqTwD8b\ngg9PFCkCgYEA+7u8A0l0Cz6p0SI6c7ftVePVRiIhpawWN7og/wEmI6zUjm/3rA+R\nhrhaVKuOD8QF/HdDsqTck5gjGAjTmJz6r33/cl1Tz+pr62znsrB4r0yMKvQbKN81\nWGaWOsi2+ZXqLNv5h5wpUF0MTKlXHeKnwP5kuEvGwVn6WURFCh6PhLMCgYEA8i5e\nJjulJVGyd5HuoY3xyO7E6DjidsqRnVRq+hYpORjnHvTmSwe4+tH4ha2p9Kv2Y6k3\nC1NYY/fSMQoYCCRaYyJleI+la/9tsZqAmtms4ZB8KhFmPHf9fW75i6G0xKWyZ8K+\nE2Ft/UaEiM282593cguV6+Kt5uExnyPxLLK4FlUCgYEAwRJ/JGI8/7bjFkTTYheq\nj5q75BufhOrU6471acAe2XPgXxLfefdC3Xodxh0CS3NESBvNL4Ikr4sbN37lk4Kq\n/th7iOKtuqUIeru/hZy2I3VpeDRbdGCmEJQ2GwYA2LKztg5Nd0Y9paaIHXAwIfrK\nQUqcQ4HTAk8ZpUeoUBeaaeMCgYANLmbjb9WiPVsYVPIHCwHA7PX8qbPxwT7BsGmO\nKQyfVfKmZa/vH4F67Vi4deZNMdrcO8aKMEQcVM2065a5QrlEsgeR00eupB1lUEJ1\nqylUsZeAdqf43JMIc7TTW77KATa/nQLZbTEeWus1wvTngztuEqFbUGAks9cOkVc8\nFpIcbQKBgQDVIL8gPLmn0f+4oLF8MBC+oxtKpz14X5iJ1saGFkzW5I+nIEskpS0S\nqtirnTCnJFGdCrFwctnxiuiCmyGwpBYdjIfHyvYAHnqAtMnESzCUyeSFZiquVW5W\nMvbMmDPoV27XOHU9kIq6NXtfrkpufiyo6/VEYWozXalxKLNuqLYfPQ==\n-----END RSA PRIVATE KEY-----\n", + "oauth": { + "id": "Iv1.bf2c2c45b449bfd9", + "secret": "ef694cd6e45223075d78d138ef014049052665f1", + "teams": null + } + }, + "redis_url": "redis://127.0.0.1:6379/7" +} \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index a5ba4068e..6c75d7f97 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -23,7 +23,7 @@ # Load fixtures from the engine if ActiveSupport::TestCase.respond_to?(:fixture_path=) - ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__) + ActiveSupport::TestCase.fixture_paths << File.expand_path("../fixtures", __FILE__) ActiveSupport::TestCase.fixtures(:all) end @@ -71,7 +71,7 @@ class TestCase end end - ActiveRecord::Migration.check_pending! + ActiveRecord::Migration.check_all_pending! # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. # diff --git a/test/unit/github_app_test.rb b/test/unit/github_app_test.rb index 5beda14d5..4e2aab2eb 100644 --- a/test/unit/github_app_test.rb +++ b/test/unit/github_app_test.rb @@ -202,7 +202,7 @@ def app(extra_config = {}) end def default_config - Rails.application.secrets.github.deep_dup + Rails.application.credentials.github.deep_dup end end end From cda478927faee56d4dff70854e3cb6494e870d6f Mon Sep 17 00:00:00 2001 From: Erik Ryhorchuk Date: Wed, 6 Mar 2024 14:39:10 -0800 Subject: [PATCH 62/79] rescue forbidden user github error --- app/models/shipit/user.rb | 2 ++ test/models/users_test.rb | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/app/models/shipit/user.rb b/app/models/shipit/user.rb index 0e283e143..c94c29dfa 100644 --- a/app/models/shipit/user.rb +++ b/app/models/shipit/user.rb @@ -95,6 +95,8 @@ def refresh_from_github! update!(github_user: Shipit.github.api.user(github_id)) rescue Octokit::NotFound identify_renamed_user! + rescue Octokit::Forbidden + Rails.logger.info("User #{name}, github_id #{github_id} has forbidden access to their GitHub, likely deleted.") end def github_user=(github_user) diff --git a/test/models/users_test.rb b/test/models/users_test.rb index 1cbe57296..b62083c05 100644 --- a/test/models/users_test.rb +++ b/test/models/users_test.rb @@ -203,6 +203,14 @@ class UsersTest < ActiveSupport::TestCase assert_equal 'george@cyclim.se', user.email end + test "#refresh_from_github! logs deleted users" do + Shipit.github.api.expects(:user).with(@user.github_id).raises(Octokit::Forbidden) + + Rails.logger.expects(:info).with("User #{@user.name}, github_id #{@user.github_id} has forbidden access to their GitHub, likely deleted.") + + @user.refresh_from_github! + end + test "#github_api uses the user's access token" do assert_equal @user.github_access_token, @user.github_api.access_token end From c2c77ea26069b6d3390b5fd60f8464efadc9c485 Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Tue, 19 Mar 2024 11:19:39 -0400 Subject: [PATCH 63/79] Stack: update `build_deploy` to pass `allow_concurrency` Add unit tests --- CHANGELOG.md | 2 ++ README.md | 5 ++++ .../shipit/api/deploys_controller.rb | 6 ++++- app/models/shipit/stack.rb | 4 ++-- .../api/deploys_controller_test.rb | 23 +++++++++++++++++++ 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba8a009f4..0a5c3c017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * Migrate from legacy Rails secrets to credentials (#1326) * Rails secrets were [deprecated in Rails 7.1](https://github.com/rails/rails/pull/48472) * [Guide on credentials](https://guides.rubyonrails.org/security.html#custom-credentials) +* For deployments, `allow_concurrency` defaults to the same value as `force`. If wanted, it can be set separately by passing the intended value for `allow_concurrency` to `build_deploy` method + # 0.39.0 diff --git a/README.md b/README.md index e8a6f17f1..a48fa65e7 100644 --- a/README.md +++ b/README.md @@ -357,6 +357,11 @@ For example: fetch: curl --silent https://app.example.com/services/ping/version ``` + +**Note:** Currently, deployments in emergency mode are configured to occur concurrently via [the `build_deploy` method](https://github.com/Shopify/shipit-engine/blob/main/app/models/shipit/stack.rb), +whose `allow_concurrency` keyword argument defaults to `force`, where `force` is true when emergency mode is enabled. +If you'd like to separate these two from one another, override this method as desired in your service. +

Kubernetes

**kubernetes** allows to specify a Kubernetes namespace and context to deploy to. diff --git a/app/controllers/shipit/api/deploys_controller.rb b/app/controllers/shipit/api/deploys_controller.rb index d80dedbfb..3ccb3f077 100644 --- a/app/controllers/shipit/api/deploys_controller.rb +++ b/app/controllers/shipit/api/deploys_controller.rb @@ -11,6 +11,7 @@ def index params do requires :sha, String, length: { in: 6..40 } accepts :force, Boolean, default: false + accepts :allow_concurrency, Boolean accepts :require_ci, Boolean, default: false accepts :env, Hash, default: {} end @@ -18,7 +19,10 @@ def create commit = stack.commits.by_sha(params.sha) || param_error!(:sha, 'Unknown revision') param_error!(:force, "Can't deploy a locked stack") if !params.force && stack.locked? param_error!(:require_ci, "Commit is not deployable") if params.require_ci && !commit.deployable? - deploy = stack.trigger_deploy(commit, current_user, env: params.env, force: params.force) + + allow_concurrency = params.allow_concurrency.nil? ? params.force : params.allow_concurrency + deploy = stack.trigger_deploy(commit, current_user, env: params.env, force: params.force, + allow_concurrency: allow_concurrency) render_resource(deploy, status: :accepted) end end diff --git a/app/models/shipit/stack.rb b/app/models/shipit/stack.rb index 4f2642f89..23767f254 100644 --- a/app/models/shipit/stack.rb +++ b/app/models/shipit/stack.rb @@ -150,14 +150,14 @@ def trigger_task(definition_id, user, env: nil, force: false) task end - def build_deploy(until_commit, user, env: nil, force: false) + def build_deploy(until_commit, user, env: nil, force: false, allow_concurrency: force) since_commit = last_deployed_commit.presence || commits.first deploys.build( user_id: user.id, until_commit: until_commit, since_commit: since_commit, env: filter_deploy_envs(env&.to_h || {}), - allow_concurrency: force, + allow_concurrency: allow_concurrency, ignored_safeties: force || !until_commit.deployable?, max_retries: retries_on_deploy, ) diff --git a/test/controllers/api/deploys_controller_test.rb b/test/controllers/api/deploys_controller_test.rb index 7a044b8ff..c7ebbf02a 100644 --- a/test/controllers/api/deploys_controller_test.rb +++ b/test/controllers/api/deploys_controller_test.rb @@ -120,6 +120,29 @@ class DeploysControllerTest < ApiControllerTestCase assert_response :accepted assert_json 'status', 'pending' end + + test "#create uses allow_concurrency param when provided" do + @stack.update!(lock_reason: 'Something broken') + + assert_difference -> { @stack.deploys.count }, 1 do + post :create, params: { stack_id: @stack.to_param, sha: @commit.sha, force: 'true', allow_concurrency: 'false' } + end + assert_response :accepted + assert_json 'status', 'pending' + refute @stack.deploys.last.allow_concurrency + end + + test "#create defaults allow_concurrency to force param when not provided" do + @stack.update!(lock_reason: 'Something broken') + expected_force = true + + assert_difference -> { @stack.deploys.count }, 1 do + post :create, params: { stack_id: @stack.to_param, sha: @commit.sha, force: expected_force } + end + assert_response :accepted + assert_json 'status', 'pending' + assert_equal expected_force, @stack.deploys.last.allow_concurrency + end end end end From 57a05ef62fd93fa761989bb0a301d3e88f99704c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 19:47:51 +0000 Subject: [PATCH 64/79] Bump rdoc from 6.6.2 to 6.6.3.1 Bumps [rdoc](https://github.com/ruby/rdoc) from 6.6.2 to 6.6.3.1. - [Release notes](https://github.com/ruby/rdoc/releases) - [Changelog](https://github.com/ruby/rdoc/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rdoc/compare/v6.6.2...v6.6.3.1) --- updated-dependencies: - dependency-name: rdoc dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8cace7f4c..ebfaad276 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -318,7 +318,7 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.1.0) - rdoc (6.6.2) + rdoc (6.6.3.1) psych (>= 4.0.0) redis (4.8.1) redis-objects (1.7.0) From 37cface5d59050015364231258a56e48f87e999b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:34:18 +0000 Subject: [PATCH 65/79] Bump rack from 2.2.8 to 2.2.9 Bumps [rack](https://github.com/rack/rack) from 2.2.8 to 2.2.9. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.8...v2.2.9) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ebfaad276..fe5e2b9c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -272,7 +272,7 @@ GEM rack redis (~> 4.0) racc (1.7.3) - rack (2.2.8) + rack (2.2.9) rack-session (1.0.2) rack (< 3) rack-test (2.1.0) From 047dbabbfec702ede1862642944661e4d0eeb9ae Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 3 Apr 2024 11:00:18 +0200 Subject: [PATCH 66/79] Release 0.39.0 --- .github/workflows/main.yml | 10 +++++----- .rubocop.yml | 2 +- CHANGELOG.md | 10 +++++----- Gemfile.lock | 17 +++++++---------- dev.yml | 2 +- lib/shipit/version.rb | 2 +- template.rb | 4 ++-- 7 files changed, 22 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6efee0c9f..1a1f81ecc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,10 +9,10 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Set up Ruby 2.7 + - name: Set up Ruby 3.0 uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.0' bundler-cache: true - name: rubocop run: | @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: ruby_version: - - '2.7' + - '3.0' services: db: @@ -68,7 +68,7 @@ jobs: fail-fast: false matrix: ruby_version: - - '2.7' + - '3.0' services: db: @@ -107,10 +107,10 @@ jobs: fail-fast: false matrix: ruby_version: - - '2.7' - '3.0' - '3.1' - '3.2' + - '3.3' services: redis: diff --git a/.rubocop.yml b/.rubocop.yml index 979b3f24a..da85c1c48 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 Exclude: - tmp/* - bin/* diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a5c3c017..679df9436 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,15 @@ # Unreleased + +# 0.39.0 + +* Minimum Ruby version is now Ruby 3.0 +* Upgraded to Rails 7.1.1 * Upgraded Octokit to 5.6.1 (#1327) * Migrate from legacy Rails secrets to credentials (#1326) * Rails secrets were [deprecated in Rails 7.1](https://github.com/rails/rails/pull/48472) * [Guide on credentials](https://guides.rubyonrails.org/security.html#custom-credentials) * For deployments, `allow_concurrency` defaults to the same value as `force`. If wanted, it can be set separately by passing the intended value for `allow_concurrency` to `build_deploy` method - -# 0.39.0 - -* Upgraded to Rails 7.1.1 - # 0.38.0 * Convert `commit_deployment_statuses.github_id` to bigint (#1312) diff --git a/Gemfile.lock b/Gemfile.lock index fe5e2b9c3..89c198c3d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - shipit-engine (0.38.0) + shipit-engine (0.39.0) active_model_serializers (~> 0.9.3) ansi_stream (~> 0.0.6) autoprefixer-rails (~> 6.4.1) @@ -231,11 +231,9 @@ GEM net-smtp (0.4.0.1) net-protocol nio4r (2.7.0) - nokogiri (1.15.5-arm64-darwin) + nokogiri (1.16.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.5-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.15.5-x86_64-linux) + nokogiri (1.16.3-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -265,7 +263,7 @@ GEM pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.2) + psych (4.0.6) stringio public_suffix (4.0.6) pubsubstub (0.2.2) @@ -377,7 +375,8 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) spy (1.0.2) - sqlite3 (1.4.2) + sqlite3 (1.7.3-arm64-darwin) + sqlite3 (1.7.3-x86_64-linux) state_machines (0.5.0) state_machines-activemodel (0.8.0) activemodel (>= 5.1) @@ -413,9 +412,7 @@ GEM zeitwerk (2.6.12) PLATFORMS - arm64-darwin-21 - arm64-darwin-22 - x86_64-darwin-20 + arm64-darwin x86_64-linux DEPENDENCIES diff --git a/dev.yml b/dev.yml index 6d9736d38..c56e7facb 100644 --- a/dev.yml +++ b/dev.yml @@ -8,7 +8,7 @@ up: - packages: - sqlite - ruby: - version: 2.7.5 + version: 3.0.3 - isogun - bundler: without: ci diff --git a/lib/shipit/version.rb b/lib/shipit/version.rb index 5e104fc24..528579f6b 100644 --- a/lib/shipit/version.rb +++ b/lib/shipit/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Shipit - VERSION = '0.38.0' + VERSION = '0.39.0' end diff --git a/template.rb b/template.rb index 7f7b2cea4..2f80764ff 100644 --- a/template.rb +++ b/template.rb @@ -1,7 +1,7 @@ # Template for rails new app # Run this like `rails new shipit -m template.rb` -if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7') - raise Thor::Error, "You need at least Ruby 2.7 to install shipit" +if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0') + raise Thor::Error, "You need at least Ruby 3.0 to install shipit" end if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('7.1') raise Thor::Error, "You need Rails 7.1 to install shipit" From c200e3069a3ad980ba2ab79b67e9002fec4605f7 Mon Sep 17 00:00:00 2001 From: Jenny Shen Date: Tue, 9 Apr 2024 11:14:06 -0400 Subject: [PATCH 67/79] Set .ruby-version to 3.0.3 dev.yml reads from .ruby-version --- .ruby-version | 1 + dev.yml | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..75a22a26a --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.0.3 diff --git a/dev.yml b/dev.yml index c56e7facb..2dfd802fa 100644 --- a/dev.yml +++ b/dev.yml @@ -7,8 +7,7 @@ type: rails up: - packages: - sqlite - - ruby: - version: 3.0.3 + - ruby - isogun - bundler: without: ci From 69e3eb9090da9d16135ee1d7d84a2202e59127bd Mon Sep 17 00:00:00 2001 From: Jenny Shen Date: Tue, 9 Apr 2024 11:15:39 -0400 Subject: [PATCH 68/79] Set required_ruby_version to >= 3.0.0 --- shipit-engine.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shipit-engine.gemspec b/shipit-engine.gemspec index ea7a9cfcb..9eed3b91d 100644 --- a/shipit-engine.gemspec +++ b/shipit-engine.gemspec @@ -17,6 +17,8 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib,vendor}/**/*", "LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] - Dir["test/dummy/tmp/**/*"] - Dir["test/dummy/log/**/*"] + s.required_ruby_version = '>= 3.0.0' + s.add_dependency('active_model_serializers', '~> 0.9.3') s.add_dependency('ansi_stream', '~> 0.0.6') s.add_dependency('autoprefixer-rails', '~> 6.4.1') From 42c242c795eedd3406697d5c0c2848e388d92f38 Mon Sep 17 00:00:00 2001 From: Jenny Shen Date: Tue, 9 Apr 2024 11:17:08 -0400 Subject: [PATCH 69/79] Remove ruby version definition in CI/CD it will be read from .ruby-version --- .github/workflows/main.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a1f81ecc..211e28835 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,10 +9,9 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Set up Ruby 3.0 + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' bundler-cache: true - name: rubocop run: | @@ -140,8 +139,6 @@ jobs: - uses: actions/checkout@v1 - name: Set up Ruby uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - name: Run setup script run: | git config --global user.email "you@example.com" From c62f05bb7d921c36d6cc3929abed4350814bcaa1 Mon Sep 17 00:00:00 2001 From: Kate Boyd Date: Thu, 11 Apr 2024 15:09:38 -0600 Subject: [PATCH 70/79] Make RefreshCheckRunsJob and RefreshStatusesJob enqueue one of themselves per commit --- app/jobs/shipit/refresh_check_runs_job.rb | 4 +++- app/jobs/shipit/refresh_statuses_job.rb | 4 +++- test/jobs/refresh_check_runs_job_test.rb | 23 +++++++++++++++++++ ...b_test.rb => refresh_statuses_job_test.rb} | 8 +++---- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 test/jobs/refresh_check_runs_job_test.rb rename test/jobs/{refresh_status_job_test.rb => refresh_statuses_job_test.rb} (67%) diff --git a/app/jobs/shipit/refresh_check_runs_job.rb b/app/jobs/shipit/refresh_check_runs_job.rb index 885783112..26cf8f31f 100644 --- a/app/jobs/shipit/refresh_check_runs_job.rb +++ b/app/jobs/shipit/refresh_check_runs_job.rb @@ -8,7 +8,9 @@ def perform(params) Commit.find(params[:commit_id]).refresh_check_runs! else stack = Stack.find(params[:stack_id]) - stack.commits.order(id: :desc).limit(30).each(&:refresh_check_runs!) + stack.commits.order(id: :desc).limit(30).each do |commit| + RefreshCheckRunsJob.perform_later(commit_id: commit.id) + end end end end diff --git a/app/jobs/shipit/refresh_statuses_job.rb b/app/jobs/shipit/refresh_statuses_job.rb index 0a94b5733..f21b609d0 100644 --- a/app/jobs/shipit/refresh_statuses_job.rb +++ b/app/jobs/shipit/refresh_statuses_job.rb @@ -8,7 +8,9 @@ def perform(params) Commit.find(params[:commit_id]).refresh_statuses! else stack = Stack.find(params[:stack_id]) - stack.commits.order(id: :desc).limit(30).each(&:refresh_statuses!) + stack.commits.order(id: :desc).limit(30).each do |commit| + RefreshStatusesJob.perform_later(commit_id: commit.id) + end end end end diff --git a/test/jobs/refresh_check_runs_job_test.rb b/test/jobs/refresh_check_runs_job_test.rb new file mode 100644 index 000000000..38f5cf3a5 --- /dev/null +++ b/test/jobs/refresh_check_runs_job_test.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true +require 'test_helper' + +module Shipit + class RefreshCheckRunsJobTest < ActiveSupport::TestCase + setup do + @stack = shipit_stacks(:shipit) + @job = RefreshCheckRunsJob.new + end + + test "#perform enqueues RefreshCheckRunsJob for the last 30 commits on the stack" do + assert_enqueued_jobs @stack.commits.count, only: RefreshCheckRunsJob do + @job.perform(stack_id: @stack.id) + end + end + + test "if :commit_id param is present only this commit is refreshed" do + Commit.any_instance.expects(:refresh_check_runs!).once + + @job.perform(stack_id: @stack.id, commit_id: shipit_commits(:first).id) + end + end +end diff --git a/test/jobs/refresh_status_job_test.rb b/test/jobs/refresh_statuses_job_test.rb similarity index 67% rename from test/jobs/refresh_status_job_test.rb rename to test/jobs/refresh_statuses_job_test.rb index d60e477f8..5ccf711eb 100644 --- a/test/jobs/refresh_status_job_test.rb +++ b/test/jobs/refresh_statuses_job_test.rb @@ -8,10 +8,10 @@ class RefreshStatusesJobTest < ActiveSupport::TestCase @job = RefreshStatusesJob.new end - test "#perform call #refresh_statuses! on the last 30 commits of the stack" do - Commit.any_instance.expects(:refresh_statuses!).times(@stack.commits.count) - - @job.perform(stack_id: @stack.id) + test "#perform enqueues RefreshStatusesJob for the last 30 commits on the stack" do + assert_enqueued_jobs @stack.commits.count, only: RefreshStatusesJob do + @job.perform(stack_id: @stack.id) + end end test "if :commit_id param is present only this commit is refreshed" do From 891d34158713dd12224155b598a540b00e56f134 Mon Sep 17 00:00:00 2001 From: Kate Boyd <77460334+kwboyd-shopify@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:48:47 -0600 Subject: [PATCH 71/79] Revert "Make RefreshCheckRunsJob and RefreshStatusesJob enqueue one of themselves per commit" --- app/jobs/shipit/refresh_check_runs_job.rb | 4 +--- app/jobs/shipit/refresh_statuses_job.rb | 4 +--- test/jobs/refresh_check_runs_job_test.rb | 23 ------------------- ...job_test.rb => refresh_status_job_test.rb} | 8 +++---- 4 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 test/jobs/refresh_check_runs_job_test.rb rename test/jobs/{refresh_statuses_job_test.rb => refresh_status_job_test.rb} (67%) diff --git a/app/jobs/shipit/refresh_check_runs_job.rb b/app/jobs/shipit/refresh_check_runs_job.rb index 26cf8f31f..885783112 100644 --- a/app/jobs/shipit/refresh_check_runs_job.rb +++ b/app/jobs/shipit/refresh_check_runs_job.rb @@ -8,9 +8,7 @@ def perform(params) Commit.find(params[:commit_id]).refresh_check_runs! else stack = Stack.find(params[:stack_id]) - stack.commits.order(id: :desc).limit(30).each do |commit| - RefreshCheckRunsJob.perform_later(commit_id: commit.id) - end + stack.commits.order(id: :desc).limit(30).each(&:refresh_check_runs!) end end end diff --git a/app/jobs/shipit/refresh_statuses_job.rb b/app/jobs/shipit/refresh_statuses_job.rb index f21b609d0..0a94b5733 100644 --- a/app/jobs/shipit/refresh_statuses_job.rb +++ b/app/jobs/shipit/refresh_statuses_job.rb @@ -8,9 +8,7 @@ def perform(params) Commit.find(params[:commit_id]).refresh_statuses! else stack = Stack.find(params[:stack_id]) - stack.commits.order(id: :desc).limit(30).each do |commit| - RefreshStatusesJob.perform_later(commit_id: commit.id) - end + stack.commits.order(id: :desc).limit(30).each(&:refresh_statuses!) end end end diff --git a/test/jobs/refresh_check_runs_job_test.rb b/test/jobs/refresh_check_runs_job_test.rb deleted file mode 100644 index 38f5cf3a5..000000000 --- a/test/jobs/refresh_check_runs_job_test.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -require 'test_helper' - -module Shipit - class RefreshCheckRunsJobTest < ActiveSupport::TestCase - setup do - @stack = shipit_stacks(:shipit) - @job = RefreshCheckRunsJob.new - end - - test "#perform enqueues RefreshCheckRunsJob for the last 30 commits on the stack" do - assert_enqueued_jobs @stack.commits.count, only: RefreshCheckRunsJob do - @job.perform(stack_id: @stack.id) - end - end - - test "if :commit_id param is present only this commit is refreshed" do - Commit.any_instance.expects(:refresh_check_runs!).once - - @job.perform(stack_id: @stack.id, commit_id: shipit_commits(:first).id) - end - end -end diff --git a/test/jobs/refresh_statuses_job_test.rb b/test/jobs/refresh_status_job_test.rb similarity index 67% rename from test/jobs/refresh_statuses_job_test.rb rename to test/jobs/refresh_status_job_test.rb index 5ccf711eb..d60e477f8 100644 --- a/test/jobs/refresh_statuses_job_test.rb +++ b/test/jobs/refresh_status_job_test.rb @@ -8,10 +8,10 @@ class RefreshStatusesJobTest < ActiveSupport::TestCase @job = RefreshStatusesJob.new end - test "#perform enqueues RefreshStatusesJob for the last 30 commits on the stack" do - assert_enqueued_jobs @stack.commits.count, only: RefreshStatusesJob do - @job.perform(stack_id: @stack.id) - end + test "#perform call #refresh_statuses! on the last 30 commits of the stack" do + Commit.any_instance.expects(:refresh_statuses!).times(@stack.commits.count) + + @job.perform(stack_id: @stack.id) end test "if :commit_id param is present only this commit is refreshed" do From ee4bab34f06bb97228e4861a0ba658c360272f01 Mon Sep 17 00:00:00 2001 From: Erik Ryhorchuk Date: Wed, 17 Apr 2024 13:37:00 -0700 Subject: [PATCH 72/79] add github secondary rate limit retries --- app/jobs/shipit/background_job.rb | 6 +++++ test/jobs/shipit/background_job_test.rb | 34 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 test/jobs/shipit/background_job_test.rb diff --git a/app/jobs/shipit/background_job.rb b/app/jobs/shipit/background_job.rb index ee7d69e91..eb86c8850 100644 --- a/app/jobs/shipit/background_job.rb +++ b/app/jobs/shipit/background_job.rb @@ -5,9 +5,15 @@ class << self attr_accessor :timeout end + DEFAULT_RETRY_TIME_IN_SECONDS = 30 + # Write actions can sometimes fail intermittently, particulary for large and/or busy repositories retry_on(Octokit::BadGateway, Octokit::InternalServerError) + rescue_from(Octokit::TooManyRequests, Octokit::AbuseDetected) do |exception| + retry_job wait: exception.response_headers.fetch("Retry-After", DEFAULT_RETRY_TIME_IN_SECONDS) + end + def perform(*) with_timeout do super diff --git a/test/jobs/shipit/background_job_test.rb b/test/jobs/shipit/background_job_test.rb new file mode 100644 index 000000000..3c8be33b6 --- /dev/null +++ b/test/jobs/shipit/background_job_test.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true +require 'test_helper' + +module Shipit + class BackgroundJobTest < ActiveSupport::TestCase + setup do + @stack = shipit_stacks(:shipit) + @last_commit = @stack.commits.last + @job = CacheDeploySpecJob.new + @user = shipit_users(:walrus) + end + + test "#perform retries on Octokit secondary rate limit exceptions" do + freeze_time do + Octokit::Forbidden.any_instance.expects(:response_headers) + .returns({ "Retry-After" => 45 }) + + Shipit.github.api.expects(:user).with(@user.github_id).raises(Octokit::TooManyRequests) + + assert_enqueued_with(job: BackgroundStubJob, at: Time.now + 45.seconds) do + BackgroundStubJob.perform_now(@user) + end + end + end + + class BackgroundStubJob < BackgroundJob + queue_as :default + + def perform(user) + Shipit.github.api.user(user.github_id) + end + end + end +end From 139b1c3b5343a3c9740c4d7f903f28063061d243 Mon Sep 17 00:00:00 2001 From: Ruidan Date: Thu, 18 Apr 2024 11:22:57 -0400 Subject: [PATCH 73/79] Convert retry-after header string to seconds --- app/jobs/shipit/background_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/shipit/background_job.rb b/app/jobs/shipit/background_job.rb index eb86c8850..f4c0a0718 100644 --- a/app/jobs/shipit/background_job.rb +++ b/app/jobs/shipit/background_job.rb @@ -11,7 +11,7 @@ class << self retry_on(Octokit::BadGateway, Octokit::InternalServerError) rescue_from(Octokit::TooManyRequests, Octokit::AbuseDetected) do |exception| - retry_job wait: exception.response_headers.fetch("Retry-After", DEFAULT_RETRY_TIME_IN_SECONDS) + retry_job wait: exception.response_headers.fetch("Retry-After", DEFAULT_RETRY_TIME_IN_SECONDS).to_i.seconds end def perform(*) From 8c7a4e4d2205f6d65d380b019705bfb62280900a Mon Sep 17 00:00:00 2001 From: Simon Jagoe Date: Mon, 29 Jan 2024 10:38:31 +0200 Subject: [PATCH 74/79] Paginate check runs refresh --- app/models/shipit/commit.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/models/shipit/commit.rb b/app/models/shipit/commit.rb index a1417cc5b..9e152b2ed 100644 --- a/app/models/shipit/commit.rb +++ b/app/models/shipit/commit.rb @@ -168,10 +168,26 @@ def create_status_from_github!(github_status) end end - def refresh_check_runs! + def paginated_check_runs response = stack.handle_github_redirections do - stack.github_api.check_runs(github_repo_name, sha) + stack.github_api.check_runs(github_repo_name, sha, per_page: 100) + end + + return response if stack.github_api.last_response.rels[:next].nil? + + loop do + page = stack.handle_github_redirections do + stack.github_api.get(stack.github_api.last_response.rels[:next].href) + end + response.check_runs.concat(page.check_runs) + break if stack.github_api.last_response.rels[:next].nil? end + + response + end + + def refresh_check_runs! + response = paginated_check_runs response.check_runs.each do |check_run| create_or_update_check_run_from_github!(check_run) end From e18a10ad32e5270af48fb49b91b1164869c18c86 Mon Sep 17 00:00:00 2001 From: Darren Worrall Date: Mon, 20 May 2024 13:49:11 +0100 Subject: [PATCH 75/79] Round the `finished in` second count --- app/models/shipit/task_execution_strategy/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/shipit/task_execution_strategy/default.rb b/app/models/shipit/task_execution_strategy/default.rb index 42af6c80a..3cd2998b9 100644 --- a/app/models/shipit/task_execution_strategy/default.rb +++ b/app/models/shipit/task_execution_strategy/default.rb @@ -94,7 +94,7 @@ def capture!(command) @task.write(line) end finished_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @task.write("pid: #{command.pid} finished in: #{finished_at - started_at} seconds\n") + @task.write("pid: #{command.pid} finished in: #{(finished_at - started_at).round(3)} seconds\n") command.success? end From 3623994fcaa3de52080558ff03ed20e6453cce79 Mon Sep 17 00:00:00 2001 From: Javier Cervantes Date: Mon, 27 May 2024 13:34:07 -0400 Subject: [PATCH 76/79] Fix tests for paginate check runs refresh --- test/models/commits_test.rb | 7 ++++--- test/models/merge_request_test.rb | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/models/commits_test.rb b/test/models/commits_test.rb index 0965167e5..55449bdc5 100644 --- a/test/models/commits_test.rb +++ b/test/models/commits_test.rb @@ -353,10 +353,11 @@ class CommitsTest < ActiveSupport::TestCase completed_at: Time.now, started_at: Time.now - 1.minute, ) - response = mock( + response = stub(rels: {}, data: mock( check_runs: [check_run], - ) - Shipit.github.api.expects(:check_runs).with(@stack.github_repo_name, @commit.sha).returns(response) + )) + Shipit.github.api.expects(:check_runs).with(@stack.github_repo_name, @commit.sha, per_page: 100).returns(response.data) + Shipit.github.api.expects(:last_response).returns(response) assert_difference -> { @commit.check_runs.count }, 1 do @commit.refresh_check_runs! diff --git a/test/models/merge_request_test.rb b/test/models/merge_request_test.rb index dc09ebcb6..a0140d4a6 100644 --- a/test/models/merge_request_test.rb +++ b/test/models/merge_request_test.rb @@ -125,7 +125,7 @@ class MergeRequestTest < ActiveSupport::TestCase created_at: 1.day.ago, )]) - Shipit.github.api.expects(:check_runs).with(@stack.github_repo_name, head_sha).returns(stub( + response = stub(rels: {}, data: stub( check_runs: [stub( id: 123456, name: 'check run', @@ -140,6 +140,8 @@ class MergeRequestTest < ActiveSupport::TestCase )] )) + Shipit.github.api.expects(:last_response).returns(response) + Shipit.github.api.expects(:check_runs).with(@stack.github_repo_name, head_sha, per_page: 100).returns(response.data) merge_request.refresh! assert_predicate merge_request, :mergeable? From 5ff2c97257280bf23fe27ad0f048508b251c0972 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 22:28:50 +0000 Subject: [PATCH 77/79] Bump the bundler group across 1 directory with 5 updates Bumps the bundler group with 2 updates in the / directory: [rails](https://github.com/rails/rails) and [rexml](https://github.com/ruby/rexml). Updates `rails` from 7.1.1 to 7.1.3.4 - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/v7.1.1...v7.1.3.4) Updates `actionpack` from 7.1.1 to 7.1.3.4 - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.1.3.4/actionpack/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.1.1...v7.1.3.4) Updates `actiontext` from 7.1.1 to 7.1.3.4 - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.1.3.4/actiontext/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.1.1...v7.1.3.4) Updates `nokogiri` from 1.16.3 to 1.16.5 - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.16.3...v1.16.5) Updates `rexml` from 3.2.5 to 3.2.8 - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.2.5...v3.2.8) --- updated-dependencies: - dependency-name: rails dependency-type: direct:production dependency-group: bundler - dependency-name: actionpack dependency-type: indirect dependency-group: bundler - dependency-name: actiontext dependency-type: indirect dependency-group: bundler - dependency-name: nokogiri dependency-type: indirect dependency-group: bundler - dependency-name: rexml dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 152 ++++++++++++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 75 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 89c198c3d..f1021ac8a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,50 +33,51 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.1.1) - actionpack (= 7.1.1) - activesupport (= 7.1.1) + actioncable (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.1) - actionpack (= 7.1.1) - activejob (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + actionmailbox (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.1) - actionpack (= 7.1.1) - actionview (= 7.1.1) - activejob (= 7.1.1) - activesupport (= 7.1.1) + actionmailer (7.1.3.4) + actionpack (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.1) - actionview (= 7.1.1) - activesupport (= 7.1.1) + actionpack (7.1.3.4) + actionview (= 7.1.3.4) + activesupport (= 7.1.3.4) nokogiri (>= 1.8.5) + racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.1) - actionpack (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + actiontext (7.1.3.4) + actionpack (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.1) - activesupport (= 7.1.1) + actionview (7.1.3.4) + activesupport (= 7.1.3.4) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -84,22 +85,22 @@ GEM active_model_serializers (0.9.9) activemodel (>= 3.2) concurrent-ruby (~> 1.0) - activejob (7.1.1) - activesupport (= 7.1.1) + activejob (7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.3.6) - activemodel (7.1.1) - activesupport (= 7.1.1) - activerecord (7.1.1) - activemodel (= 7.1.1) - activesupport (= 7.1.1) + activemodel (7.1.3.4) + activesupport (= 7.1.3.4) + activerecord (7.1.3.4) + activemodel (= 7.1.3.4) + activesupport (= 7.1.3.4) timeout (>= 0.4.0) - activestorage (7.1.1) - actionpack (= 7.1.1) - activejob (= 7.1.1) - activerecord (= 7.1.1) - activesupport (= 7.1.1) + activestorage (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activesupport (= 7.1.3.4) marcel (~> 1.0) - activesupport (7.1.1) + activesupport (7.1.3.4) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -120,7 +121,7 @@ GEM ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) base64 (0.2.0) - bigdecimal (3.1.6) + bigdecimal (3.1.8) builder (3.2.4) byebug (11.1.3) coderay (1.1.3) @@ -133,7 +134,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.1) connection_pool (2.4.1) crack (0.4.5) rexml @@ -142,8 +143,7 @@ GEM descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) docile (1.4.0) - drb (2.2.0) - ruby2_keywords + drb (2.2.1) ejson (1.4.1) ejson-rails (0.2.1) ejson @@ -188,12 +188,12 @@ GEM activesupport (>= 6.1) hashdiff (1.0.1) hashie (5.0.0) - i18n (1.14.1) + i18n (1.14.5) concurrent-ruby (~> 1.0) ice_nine (0.11.2) io-console (0.7.2) - irb (1.11.1) - rdoc + irb (1.13.1) + rdoc (>= 4.0.0) reline (>= 0.4.2) jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) @@ -210,10 +210,10 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.21.2) + minitest (5.23.1) mocha (2.1.0) ruby2_keywords (>= 0.0.5) msgpack (1.7.1) @@ -221,19 +221,19 @@ GEM multipart-post (2.3.0) mutex_m (0.2.0) mysql2 (0.5.3) - net-imap (0.4.9.1) + net-imap (0.4.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) - nokogiri (1.16.3-arm64-darwin) + nio4r (2.7.3) + nokogiri (1.16.5-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.3-x86_64-linux) + nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -263,13 +263,13 @@ GEM pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) - psych (4.0.6) + psych (5.1.2) stringio public_suffix (4.0.6) pubsubstub (0.2.2) rack redis (~> 4.0) - racc (1.7.3) + racc (1.8.0) rack (2.2.9) rack-session (1.0.2) rack (< 3) @@ -278,20 +278,20 @@ GEM rackup (1.0.0) rack (< 3) webrick - rails (7.1.1) - actioncable (= 7.1.1) - actionmailbox (= 7.1.1) - actionmailer (= 7.1.1) - actionpack (= 7.1.1) - actiontext (= 7.1.1) - actionview (= 7.1.1) - activejob (= 7.1.1) - activemodel (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + rails (7.1.3.4) + actioncable (= 7.1.3.4) + actionmailbox (= 7.1.3.4) + actionmailer (= 7.1.3.4) + actionpack (= 7.1.3.4) + actiontext (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activemodel (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) bundler (>= 1.15.0) - railties (= 7.1.1) + railties (= 7.1.3.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -306,28 +306,29 @@ GEM actionview (> 3.1) activesupport (> 3.1) railties (> 3.1) - railties (7.1.1) - actionpack (= 7.1.1) - activesupport (= 7.1.1) + railties (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) irb rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.1.0) - rdoc (6.6.3.1) + rake (13.2.1) + rdoc (6.7.0) psych (>= 4.0.0) redis (4.8.1) redis-objects (1.7.0) redis regexp_parser (2.2.1) - reline (0.4.2) + reline (0.5.8) io-console (~> 0.5) responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.5) + rexml (3.2.8) + strscan (>= 3.0.9) rubocop (1.18.3) parallel (~> 1.10) parser (>= 3.0.0.0) @@ -385,7 +386,8 @@ GEM activerecord (>= 5.1) state_machines-activemodel (>= 0.8.0) stringio (3.1.0) - thor (1.3.0) + strscan (3.1.0) + thor (1.3.1) thread_safe (0.3.6) tilt (2.2.0) timeout (0.4.1) @@ -409,7 +411,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.12) + zeitwerk (2.6.15) PLATFORMS arm64-darwin From c4b5f7ba311fd3429e62523a8edfe091ed11d20b Mon Sep 17 00:00:00 2001 From: Kartiki Sharma Date: Fri, 19 Jul 2024 12:57:12 -0400 Subject: [PATCH 78/79] Retry on Octokit::ServerError Update create_release_statuses_job.rb --- app/jobs/shipit/background_job.rb | 2 +- app/jobs/shipit/create_release_statuses_job.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/jobs/shipit/background_job.rb b/app/jobs/shipit/background_job.rb index ee7d69e91..1ddae0a7b 100644 --- a/app/jobs/shipit/background_job.rb +++ b/app/jobs/shipit/background_job.rb @@ -6,7 +6,7 @@ class << self end # Write actions can sometimes fail intermittently, particulary for large and/or busy repositories - retry_on(Octokit::BadGateway, Octokit::InternalServerError) + retry_on(Octokit::ServerError) def perform(*) with_timeout do diff --git a/app/jobs/shipit/create_release_statuses_job.rb b/app/jobs/shipit/create_release_statuses_job.rb index dbd3a681f..d632eb4ef 100644 --- a/app/jobs/shipit/create_release_statuses_job.rb +++ b/app/jobs/shipit/create_release_statuses_job.rb @@ -4,6 +4,7 @@ class CreateReleaseStatusesJob < BackgroundJob include BackgroundJob::Unique queue_as :default + on_duplicate :drop def perform(commit) commit.release_statuses.to_be_created.each(&:create_status_on_github!) From ea72ec6d7732ac1e00e64a1d26858457fb8f0460 Mon Sep 17 00:00:00 2001 From: Kate Boyd <77460334+kwboyd-shopify@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:35:18 -0600 Subject: [PATCH 79/79] Update README.md with more detailed timeout information This clarifies how the `timeout` field works, as it was ambiguous before if it was an inactivity timeout or a time limit for the task/deploy as a whole to complete. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a48fa65e7..872aee5b7 100644 --- a/README.md +++ b/README.md @@ -615,7 +615,7 @@ review:

Shell commands timeout

-All the shell commands can take an optional `timeout` parameter to limit their duration: +All the shell commands can take an optional `timeout` parameter. This is the value in seconds that a command can be inactive before Shipit will terminate the task. ```yml deploy: