Skip to content

Commit a8ffaa5

Browse files
authored
Make a deploy target for Euros (#1145)
* initial commit * fix PDF no being able to be emaild * add a pdf css file * fix lint
1 parent 9371d65 commit a8ffaa5

File tree

14 files changed

+49
-14
lines changed

14 files changed

+49
-14
lines changed

.github/workflows/continuous-delivery.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919
options:
2020
- csvalpha
2121
- luxadmosam
22+
- euros
2223
default: 'csvalpha'
2324

2425
concurrency:
@@ -40,9 +41,11 @@ jobs:
4041
echo 'This workflow can only be run on branches staging and master.'
4142
exit 1
4243
fi
43-
if [ "$TARGET_ENV" == 'luxadmosam' ] && [ "$GITHUB_REF_NAME" != 'master' ]; then
44-
echo 'Only the master branch can be deployed to Lux ad Mosam.'
45-
exit 1
44+
if [ "$TARGET_ENV" == 'luxadmosam' ] || [ "$TARGET_ENV" == 'euros' ]; then
45+
if [ "$GITHUB_REF_NAME" != 'master' ]; then
46+
echo 'Only the master branch can be deployed to external parties.'
47+
exit 1
48+
fi
4649
fi
4750
4851
metadata:
@@ -74,6 +77,8 @@ jobs:
7477
7578
if [ "$TARGET_ENV" == 'luxadmosam' ]; then
7679
echo 'stage=luxproduction' >> "$GITHUB_OUTPUT"
80+
elif [ "$TARGET_ENV" == 'euros' ]; then
81+
echo 'stage=euros' >> "$GITHUB_OUTPUT"
7782
else
7883
echo 'stage=production' >> "$GITHUB_OUTPUT"
7984
fi
@@ -159,6 +164,8 @@ jobs:
159164
run: |
160165
if [ "$TARGET_ENV" == 'luxadmosam' ] && [ "$GITHUB_REF_NAME" = 'master' ]; then
161166
echo 'environment_url=https://luxstreep.csvalpha.nl' >> "$GITHUB_OUTPUT"
167+
elif [ "$TARGET_ENV" == 'euros' ] && [ "$GITHUB_REF_NAME" = 'master' ]; then
168+
echo 'environment_url=https://euros.csvalpha.nl' >> "$GITHUB_OUTPUT"
162169
elif [ "$GITHUB_REF_NAME" = 'master' ]; then
163170
echo 'environment_url=https://streep.csvalpha.nl' >> "$GITHUB_OUTPUT"
164171
else

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Rails/UnknownEnv:
2424
Environments:
2525
- production
2626
- luxproduction
27+
- euros
2728
- development
2829
- test
2930
- staging

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ WORKDIR /app
2828

2929
# Pre-install gems, so that they can be cached.
3030
COPY Gemfile* /app/
31-
RUN if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ]; then \
31+
RUN if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ] || [ "$RAILS_ENV" = 'euros' ]; then \
3232
bundle config set --local without 'development test'; \
3333
else \
3434
bundle config set --local without 'development'; \
@@ -43,7 +43,7 @@ RUN yarn install --immutable
4343
COPY . /app/
4444

4545
# Precompile assets after copying app because whole Rails pipeline is needed.
46-
RUN if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ]; then \
46+
RUN if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ] || [ "$RAILS_ENV" = 'euros' ]; then \
4747
SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile; \
4848
else \
4949
echo "Skipping assets:precompile"; \

app/controllers/credit_mutations_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ def create # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
1919

2020
respond_to do |format|
2121
if @mutation.save
22-
NewCreditMutationNotificationJob.perform_later(@mutation) if Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction?
22+
if Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction? || Rails.env.euros?
23+
NewCreditMutationNotificationJob.perform_later(@mutation)
24+
end
2325
format.html { redirect_to which_redirect?, flash: { success: 'Inleg of mutatie aangemaakt' } }
2426
format.json do
2527
render json: @mutation, include: { user: { methods: User.orderscreen_json_includes } }

app/jobs/credit_insufficient_notification_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def send_notification_delivery_reports(success_count, unnotifyable_users)
3030
).deliver_later
3131
end
3232

33-
return unless Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction?
33+
return unless Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction? || Rails.env.euros?
3434

3535
HealthCheckJob.perform_later('credit_insufficient')
3636
end

app/jobs/payment_poll_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def perform
99
# it will be checked again the next time this poll job runs
1010
end
1111

12-
return unless Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction?
12+
return unless Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction? || Rails.env.euros?
1313

1414
HealthCheckJob.perform_later('payment_poll')
1515
end

app/views/layouts/pdf.html.erb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@
44
<html>
55
<head>
66
<title><%= yield(:title) %></title>
7-
<%= wicked_pdf_stylesheet_link_tag 'application' %>
8-
<%= wicked_pdf_stylesheet_link_tag 'pdf' %>
7+
<% css = '' %>
8+
<% candidates = [] %>
9+
<% candidates.concat(Dir.glob(Rails.root.join('app', 'assets', 'builds', '*.css').to_s)) %>
10+
<% candidates.concat(Dir.glob(Rails.root.join('public', 'assets', '*.css').to_s)) %>
11+
<% css = candidates.filter_map do |path|
12+
begin
13+
File.read(path)
14+
rescue => e
15+
Rails.logger.warn "Could not read compiled css from #{path}: #{e.message}"
16+
nil
17+
end
18+
end.join("\n") %>
19+
<style type="text/css">
20+
<%= css.html_safe %>
21+
</style>
922
</head>
1023
<body>
1124
<%= yield %>

app/views/partials/_footer.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<span class="text-danger text-uppercase fw-bold mx-2">
33
<% if Rails.application.config.x.sofia_host == 'stagingstreep.csvalpha.nl' %>
44
For demo and testing purposes only
5-
<% elsif Rails.application.config.x.sofia_host != 'streep.csvalpha.nl' && Rails.application.config.x.sofia_host != 'luxstreep.csvalpha.nl' %>
5+
<% elsif Rails.application.config.x.sofia_host != 'streep.csvalpha.nl' && Rails.application.config.x.sofia_host != 'luxstreep.csvalpha.nl' && Rails.application.config.x.sofia_host != 'euros.csvalpha.nl' %>
66
Development mode
77
<% end %>
88
</span>

config/cable.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ staging:
1414

1515
luxproduction:
1616
<<: *production
17+
18+
euros:
19+
<<: *production

config/database.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ staging:
2323

2424
luxproduction:
2525
<<: *production
26+
27+
euros:
28+
<<: *production

0 commit comments

Comments
 (0)