Skip to content

Commit 6559f51

Browse files
authored
Merge pull request #1466 from Shopify/handle-github-org-unknown-in-sync-job
v0.44.3: Handle GithubOrganizationUnknown in GithubSyncJob
2 parents 8250780 + ebc1a33 commit 6559f51

5 files changed

Lines changed: 16 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Unreleased
22

3+
# 0.44.3
4+
* Handle GithubOrganizationUnknown in GithubSyncJob by logging a warning and marking the stack as inaccessible.
5+
36
# 0.44.2
47
* Add dry-run flag for testing environments
58

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
shipit-engine (0.44.2)
4+
shipit-engine (0.44.3)
55
active_model_serializers (~> 0.9.3)
66
ansi_stream (~> 0.0.6)
77
autoprefixer-rails (~> 6.4.1)

app/jobs/shipit/github_sync_job.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def handle_github_errors
6767
yield
6868
rescue Octokit::NotFound
6969
stack.mark_as_inaccessible!
70+
rescue Shipit::GithubOrganizationUnknown => e
71+
Rails.logger.warn("GithubSyncJob: unknown GitHub organization #{e.message} for stack #{stack.id}")
72+
stack.mark_as_inaccessible!
7073
else
7174
stack.mark_as_accessible!
7275
end

lib/shipit/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Shipit
4-
VERSION = '0.44.2'
4+
VERSION = '0.44.3'
55
end

test/jobs/github_sync_job_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ class GithubSyncJobTest < ActiveSupport::TestCase
119119
assert_equal true, @stack.reload.inaccessible_since?
120120
end
121121

122+
test "if the GitHub organization is unknown, the stack is marked as inaccessible and a warning is logged" do
123+
@job.expects(:fetch_missing_commits).raises(Shipit::GithubOrganizationUnknown.new("shopify-playgrounds"))
124+
Rails.logger.expects(:warn).with("GithubSyncJob: unknown GitHub organization shopify-playgrounds for stack #{@stack.id}")
125+
@job.perform(stack_id: @stack.id)
126+
127+
assert_equal true, @stack.reload.inaccessible_since?
128+
end
129+
122130
test "#perform retries when expected_head_sha is not found in the github response" do
123131
expected_sha = "abcd1234"
124132
Stack.any_instance.expects(:github_commits).returns(@github_commits)

0 commit comments

Comments
 (0)