Skip to content

Commit 4fcc849

Browse files
authored
Merge branch 'main' into enable-post-scripts-process-on-failure
2 parents c940397 + 8250780 commit 4fcc849

22 files changed

Lines changed: 371 additions & 242 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
export SHIPIT_GEM_PATH="${PWD}"
147147
mkdir /tmp/new-app
148148
cd /tmp/new-app
149-
gem install rails -v '~> 8.0.2' --no-document
149+
gem install rails -v '~> 8.1.1' --no-document
150150
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"
151151
env:
152152
SHIPIT_EDGE: "1"

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@
88
* Updated README to include sections on post scripts with on_error flag
99
* Refactored README to use mostly pure markdown instead of HTML
1010

11+
# 0.44.2
12+
* Add dry-run flag for testing environments
13+
14+
# 0.44.1
15+
* (bugfix) Fix NoMethodError in continuous delivery delayed banner when `next_commit_to_deploy` is nil
16+
17+
# 0.44.0
18+
* Return 422 and log when a webhook is from an unknown (unconfigured) GitHub organization.
19+
20+
# 0.43.3
21+
* (bugfix) Ensure we always call `bundle config set without`, even if the without group is empty
22+
23+
# 0.43.0
24+
* Use `bundle config set frozen true` instead of deprecated `--frozen` flag
25+
26+
# 0.42.2
27+
* Move git ask pass to env config for improved local development (##1441)
28+
1129
# 0.42.1
1230

1331
* Fix unbounded memory usage in RefreshCheckRunsJob(#1436)

Gemfile.lock

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
shipit-engine (0.42.1)
4+
shipit-engine (0.44.2)
55
active_model_serializers (~> 0.9.3)
66
ansi_stream (~> 0.0.6)
77
autoprefixer-rails (~> 6.4.1)
@@ -16,7 +16,7 @@ PATH
1616
omniauth-github (~> 1.4)
1717
paquito
1818
pubsubstub (~> 0.2)
19-
rails (~> 8.0.1)
19+
rails (>= 8.1.1)
2020
rails-timeago (~> 2.13.0)
2121
rails_autolink (~> 1.1.6)
2222
rake
@@ -33,75 +33,78 @@ PATH
3333
GEM
3434
remote: https://rubygems.org/
3535
specs:
36-
actioncable (8.0.2)
37-
actionpack (= 8.0.2)
38-
activesupport (= 8.0.2)
36+
action_text-trix (2.1.15)
37+
railties
38+
actioncable (8.1.1)
39+
actionpack (= 8.1.1)
40+
activesupport (= 8.1.1)
3941
nio4r (~> 2.0)
4042
websocket-driver (>= 0.6.1)
4143
zeitwerk (~> 2.6)
42-
actionmailbox (8.0.2)
43-
actionpack (= 8.0.2)
44-
activejob (= 8.0.2)
45-
activerecord (= 8.0.2)
46-
activestorage (= 8.0.2)
47-
activesupport (= 8.0.2)
44+
actionmailbox (8.1.1)
45+
actionpack (= 8.1.1)
46+
activejob (= 8.1.1)
47+
activerecord (= 8.1.1)
48+
activestorage (= 8.1.1)
49+
activesupport (= 8.1.1)
4850
mail (>= 2.8.0)
49-
actionmailer (8.0.2)
50-
actionpack (= 8.0.2)
51-
actionview (= 8.0.2)
52-
activejob (= 8.0.2)
53-
activesupport (= 8.0.2)
51+
actionmailer (8.1.1)
52+
actionpack (= 8.1.1)
53+
actionview (= 8.1.1)
54+
activejob (= 8.1.1)
55+
activesupport (= 8.1.1)
5456
mail (>= 2.8.0)
5557
rails-dom-testing (~> 2.2)
56-
actionpack (8.0.2)
57-
actionview (= 8.0.2)
58-
activesupport (= 8.0.2)
58+
actionpack (8.1.1)
59+
actionview (= 8.1.1)
60+
activesupport (= 8.1.1)
5961
nokogiri (>= 1.8.5)
6062
rack (>= 2.2.4)
6163
rack-session (>= 1.0.1)
6264
rack-test (>= 0.6.3)
6365
rails-dom-testing (~> 2.2)
6466
rails-html-sanitizer (~> 1.6)
6567
useragent (~> 0.16)
66-
actiontext (8.0.2)
67-
actionpack (= 8.0.2)
68-
activerecord (= 8.0.2)
69-
activestorage (= 8.0.2)
70-
activesupport (= 8.0.2)
68+
actiontext (8.1.1)
69+
action_text-trix (~> 2.1.15)
70+
actionpack (= 8.1.1)
71+
activerecord (= 8.1.1)
72+
activestorage (= 8.1.1)
73+
activesupport (= 8.1.1)
7174
globalid (>= 0.6.0)
7275
nokogiri (>= 1.8.5)
73-
actionview (8.0.2)
74-
activesupport (= 8.0.2)
76+
actionview (8.1.1)
77+
activesupport (= 8.1.1)
7578
builder (~> 3.1)
7679
erubi (~> 1.11)
7780
rails-dom-testing (~> 2.2)
7881
rails-html-sanitizer (~> 1.6)
7982
active_model_serializers (0.9.13)
8083
activemodel (>= 3.2)
8184
concurrent-ruby (~> 1.0)
82-
activejob (8.0.2)
83-
activesupport (= 8.0.2)
85+
activejob (8.1.1)
86+
activesupport (= 8.1.1)
8487
globalid (>= 0.3.6)
85-
activemodel (8.0.2)
86-
activesupport (= 8.0.2)
87-
activerecord (8.0.2)
88-
activemodel (= 8.0.2)
89-
activesupport (= 8.0.2)
88+
activemodel (8.1.1)
89+
activesupport (= 8.1.1)
90+
activerecord (8.1.1)
91+
activemodel (= 8.1.1)
92+
activesupport (= 8.1.1)
9093
timeout (>= 0.4.0)
91-
activestorage (8.0.2)
92-
actionpack (= 8.0.2)
93-
activejob (= 8.0.2)
94-
activerecord (= 8.0.2)
95-
activesupport (= 8.0.2)
94+
activestorage (8.1.1)
95+
actionpack (= 8.1.1)
96+
activejob (= 8.1.1)
97+
activerecord (= 8.1.1)
98+
activesupport (= 8.1.1)
9699
marcel (~> 1.0)
97-
activesupport (8.0.2)
100+
activesupport (8.1.1)
98101
base64
99-
benchmark (>= 0.3)
100102
bigdecimal
101103
concurrent-ruby (~> 1.0, >= 1.3.1)
102104
connection_pool (>= 2.2.5)
103105
drb
104106
i18n (>= 1.6, < 2)
107+
json
105108
logger (>= 1.4.2)
106109
minitest (>= 5.1)
107110
securerandom (>= 0.3)
@@ -118,7 +121,6 @@ GEM
118121
ice_nine (~> 0.11.0)
119122
thread_safe (~> 0.3, >= 0.3.1)
120123
base64 (0.3.0)
121-
benchmark (0.4.1)
122124
bigdecimal (3.2.2)
123125
builder (3.3.0)
124126
byebug (11.1.3)
@@ -232,9 +234,9 @@ GEM
232234
net-smtp (0.5.0)
233235
net-protocol
234236
nio4r (2.7.3)
235-
nokogiri (1.18.8-arm64-darwin)
237+
nokogiri (1.18.9-arm64-darwin)
236238
racc (~> 1.4)
237-
nokogiri (1.18.8-x86_64-linux-gnu)
239+
nokogiri (1.18.9-x86_64-linux-gnu)
238240
racc (~> 1.4)
239241
oauth2 (2.0.9)
240242
faraday (>= 0.17.3, < 3.0)
@@ -275,28 +277,28 @@ GEM
275277
rack
276278
redis (~> 4.0)
277279
racc (1.8.1)
278-
rack (2.2.17)
280+
rack (2.2.22)
279281
rack-session (1.0.2)
280282
rack (< 3)
281283
rack-test (2.2.0)
282284
rack (>= 1.3)
283285
rackup (1.0.0)
284286
rack (< 3)
285287
webrick
286-
rails (8.0.2)
287-
actioncable (= 8.0.2)
288-
actionmailbox (= 8.0.2)
289-
actionmailer (= 8.0.2)
290-
actionpack (= 8.0.2)
291-
actiontext (= 8.0.2)
292-
actionview (= 8.0.2)
293-
activejob (= 8.0.2)
294-
activemodel (= 8.0.2)
295-
activerecord (= 8.0.2)
296-
activestorage (= 8.0.2)
297-
activesupport (= 8.0.2)
288+
rails (8.1.1)
289+
actioncable (= 8.1.1)
290+
actionmailbox (= 8.1.1)
291+
actionmailer (= 8.1.1)
292+
actionpack (= 8.1.1)
293+
actiontext (= 8.1.1)
294+
actionview (= 8.1.1)
295+
activejob (= 8.1.1)
296+
activemodel (= 8.1.1)
297+
activerecord (= 8.1.1)
298+
activestorage (= 8.1.1)
299+
activesupport (= 8.1.1)
298300
bundler (>= 1.15.0)
299-
railties (= 8.0.2)
301+
railties (= 8.1.1)
300302
rails-dom-testing (2.3.0)
301303
activesupport (>= 5.0.0)
302304
minitest
@@ -311,13 +313,14 @@ GEM
311313
actionview (> 3.1)
312314
activesupport (> 3.1)
313315
railties (> 3.1)
314-
railties (8.0.2)
315-
actionpack (= 8.0.2)
316-
activesupport (= 8.0.2)
316+
railties (8.1.1)
317+
actionpack (= 8.1.1)
318+
activesupport (= 8.1.1)
317319
irb (~> 1.13)
318320
rackup (>= 1.0.0)
319321
rake (>= 12.2)
320322
thor (~> 1.0, >= 1.2.2)
323+
tsort (>= 0.2)
321324
zeitwerk (~> 2.6)
322325
rainbow (3.1.1)
323326
rake (13.2.1)
@@ -396,6 +399,7 @@ GEM
396399
thread_safe (0.3.6)
397400
tilt (2.2.0)
398401
timeout (0.4.1)
402+
tsort (0.2.0)
399403
tzinfo (2.0.6)
400404
concurrent-ruby (~> 1.0)
401405
unicode-display_width (2.6.0)

app/controllers/shipit/webhooks_controller.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ def verify_signature
3636
"signature=#{request.headers['X-Hub-Signature']}",
3737
"status=#{status}"
3838
].join(' '))
39+
rescue Shipit::GithubOrganizationUnknown => e
40+
head(422)
41+
Rails.logger.warn([
42+
'WebhookController#verify_signature',
43+
'Webhook from unknown organization',
44+
"event=#{event}",
45+
"repository_owner=#{repository_owner}",
46+
"unknown_organization=#{e.message}",
47+
"status=#{status}"
48+
].join(' '))
3949
end
4050

4151
def check_if_ping

app/models/shipit/deploy_spec/bundler_discovery.rb

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,18 @@ def discover_machine_env
2626
end
2727

2828
def bundle_install
29-
bundle = %(bundle install #{frozen_flag} --jobs 4 --path #{bundle_path} --retry 2)
30-
bundle += " --without=#{bundler_without.join(':')}" unless bundler_without.empty?
31-
[remove_ruby_version_from_gemfile, bundle]
29+
install_command = %(bundle install --jobs 4 --retry 2)
30+
[
31+
remove_ruby_version_from_gemfile,
32+
(bundle_config_frozen if frozen_mode?),
33+
bundle_config_path,
34+
bundle_without_groups,
35+
install_command
36+
].compact
37+
end
38+
39+
def bundle_config_path
40+
"bundle config set --local path #{bundle_path}"
3241
end
3342

3443
def remove_ruby_version_from_gemfile
@@ -41,11 +50,18 @@ def remove_ruby_version_from_gemfile
4150
end
4251
end
4352

44-
def frozen_flag
45-
return unless gemfile_lock_exists?
46-
return if config('dependencies', 'bundler', 'frozen') == false
53+
def bundle_config_frozen
54+
'bundle config set --local frozen true'
55+
end
56+
57+
def bundle_without_groups
58+
"bundle config set --local without '#{bundler_without.join(':')}'"
59+
end
60+
61+
def frozen_mode?
62+
return false unless gemfile_lock_exists?
4763

48-
'--frozen'
64+
config('dependencies', 'bundler', 'frozen') != false
4965
end
5066

5167
def bundler_without

app/models/shipit/task_execution_strategy/default.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ def check_for_abort
6262

6363
def perform_task
6464
capture_all!(@commands.install_dependencies)
65-
capture_all!(@commands.perform)
65+
if ENV['SHIPIT_DRY_RUN'].present?
66+
@task.write("\nSkipping deploy steps (dry run mode)\n")
67+
else
68+
capture_all!(@commands.perform)
69+
end
6670
end
6771

6872
def checkout_repository

app/views/shipit/stacks/_banners.html.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@
7070
<p class="banner__text">
7171
Continuous Delivery for this stack is currently paused because
7272

73-
<%= link_to_if stack.deployment_checks_passed?, 'the pre-deploy checks failed', stack_commit_checks_path(stack, sha: stack.next_commit_to_deploy.sha) %>.
73+
<% if stack.next_commit_to_deploy %>
74+
<%= link_to_if stack.deployment_checks_passed?, 'the pre-deploy checks failed', stack_commit_checks_path(stack, sha: stack.next_commit_to_deploy.sha) %>.
75+
<% else %>
76+
the pre-deploy checks failed.
77+
<% end %>
7478
You can either wait for them to pass, or trigger a deploy manually.
7579
</p>
7680
</div>

config/secrets.development.shopify.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
host: 'shipit-engine.myshopify.io'
2-
redis_url: 'redis://shipit-engine.railgun:6379'
32

43
# For creating an app see: https://github.com/Shopify/shipit-engine/blob/main/docs/setup.md#creating-the-github-app
54

@@ -21,4 +20,4 @@ github:
2120
oauth:
2221
id:
2322
secret:
24-
teams:
23+
teams:

dev.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ type: rails
66

77
up:
88
- packages:
9-
- sqlite
9+
- sqlite
1010
- ruby
11-
- isogun
1211
- nginx
1312
- redis
1413
- mysql
1514
- bundler:
1615
without: ci
16+
- custom:
17+
name: Check for secrets file
18+
met?: test -f config/secrets.development.yml
19+
meet: "echo \"Run 'dev bootstrap' first (WARNING: drops database)\" && exit 1"
1720

1821
server:
1922
root: test/dummy

lib/shipit.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ module Shipit
7171
:internal_hook_receivers,
7272
:preferred_org_emails,
7373
:task_execution_strategy,
74-
:task_logger
74+
:task_logger,
75+
:use_git_askpass
7576
)
7677

7778
def task_execution_strategy
@@ -297,6 +298,10 @@ def task_logger
297298
@task_logger ||= Logger.new(nil)
298299
end
299300

301+
def use_git_askpass?
302+
@use_git_askpass.nil? ? true : @use_git_askpass
303+
end
304+
300305
protected
301306

302307
def revision_file

0 commit comments

Comments
 (0)