Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove RAILS_MASTER_KEY from CI & upgrade to rails 7.1 #890

Open
wants to merge 27 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
253c513
refactor: remove RAILS_MASTER_KEY from ci
guidojw Oct 11, 2023
30fd4cc
fix(ci): update indentation
guidojw Oct 11, 2023
b9c0efc
test: precompile assets on test too
guidojw Oct 11, 2023
a7dba8a
fix(ci): update indentation
guidojw Oct 11, 2023
8e1feea
chore: bundle update bullet
guidojw Oct 11, 2023
764b898
fix: comment bundle config
guidojw Oct 11, 2023
6f17a4b
revert: test: precompile assets on test too
guidojw Oct 11, 2023
6d53ea7
fix: revert env changes in continuous-integration.yml
guidojw Oct 11, 2023
4f9205b
fix: indentation
guidojw Oct 11, 2023
ab3e193
fix: indentation
guidojw Oct 11, 2023
3cd2bfb
fix: readd POSTGRES_HOST
guidojw Oct 11, 2023
3fda67a
Merge branch 'staging' into refactor/no-ci-secrets
lodewiges Nov 19, 2024
0dd8b9f
fix: pass RAILS_MASTER_KEY to ci step
guidojw Nov 21, 2024
d894a75
chore: trigger build
guidojw Nov 21, 2024
793d79d
Merge branch 'staging' into refactor/no-ci-secrets
guidojw Nov 21, 2024
5786b9c
chore: fix lint
guidojw Nov 21, 2024
9a5300b
Merge branch 'refactor/no-ci-secrets' of https://github.com/csvalpha/…
guidojw Nov 21, 2024
dc18867
chore: remove unnecessary secret mount
guidojw Nov 22, 2024
39065e8
Merge branch 'staging' into refactor/no-ci-secrets
lodewiges Dec 13, 2024
c809036
remove spaces continuous-integration.yml
lodewiges Dec 31, 2024
614fc70
Merge branch 'staging' into refactor/no-ci-secrets
lodewiges Dec 31, 2024
4c1fa3a
Update continuous-integration.yml
lodewiges Dec 31, 2024
4946b3c
Update continuous-integration.yml
lodewiges Dec 31, 2024
99fce79
Fix?
lodewiges Dec 31, 2024
758f2e7
Update continuous-integration.yml
lodewiges Dec 31, 2024
8cc5d31
Merge branch 'staging' into refactor/no-ci-secrets
lodewiges Jan 8, 2025
8bfdf35
updated gemfile
lodewiges Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ jobs:
with:
sha: ${{ needs.merge.outputs.sha }}
secrets:
rails_master_key: ${{ secrets.RAILS_MASTER_KEY }}
sentry_auth_token: ${{ secrets.SENTRY_AUTH_TOKEN }}

deploy:
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,20 @@ jobs:
name: app

- name: Lint
env:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: |
EXIT_STATUS=0
./actionlint -ignore 'SC2153:' -ignore 'property "sha" is not defined in object type {}' || \
EXIT_STATUS=$?
docker run -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_HOST=localhost -e \
RAILS_MASTER_KEY --network=host app bin/ci.sh lint || EXIT_STATUS=$?
./actionlint \
-ignore 'property "gh_app_private_key" is not defined' \
-ignore 'SC2153:' \
-ignore 'property "sha" is not defined in object type {}' || \
EXIT_STATUS=$?
docker run \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_HOST=localhost \
--network=host \
app bin/ci.sh lint || \
EXIT_STATUS=$?
exit $EXIT_STATUS

test:
Expand Down Expand Up @@ -123,8 +129,15 @@ jobs:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: |
mkdir coverage
docker run -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_HOST=localhost -e \
RAILS_MASTER_KEY --network=host -v "$(pwd)"'/coverage:/app/coverage' app bin/ci.sh spec
docker run \
-e RAILS_MASTER_KEY \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_HOST=localhost \
--network=host \
-v "$(pwd)"'/coverage:/app/coverage' \
app bin/ci.sh spec


- name: Upload coverage report to Codecov
if: ${{ !cancelled() }}
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
required: false
type: string
secrets:
rails_master_key:
description: The Rails master key
required: true
sentry_auth_token:
description: The Sentry integration's token
required: true
Expand Down Expand Up @@ -73,8 +70,6 @@ jobs:
push: true
context: .
build-args: ${{ needs.metadata.outputs.build_args }}
secrets: |
rails_master_key=${{ secrets.RAILS_MASTER_KEY }}
cache-from: type=gha,scope=main
cache-to: type=gha,scope=main
tags: |
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require:
- rubocop-performance

AllCops:
TargetRailsVersion: 7.0
TargetRailsVersion: 7.1
TargetRubyVersion: 3.2
Exclude:
- 'bin/**/*'
Expand Down
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ARG BUILD_HASH='unknown'
ENV BUILD_HASH=$BUILD_HASH
ARG RAILS_ENV='production'
ARG NODE_ENV='production'
ARG RAILS_MASTER_KEY

# Pre-install gems, so that they can be cached.
COPY Gemfile* /app/
Expand All @@ -43,10 +42,8 @@ RUN yarn install --immutable
COPY . /app/

# Precompile assets after copying app because whole Rails pipeline is needed.
RUN --mount=type=secret,id=rails_master_key \
if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ]; then \
# Use secret if RAILS_MASTER_KEY build arg is not set.
RAILS_MASTER_KEY="${RAILS_MASTER_KEY:-$(cat /run/secrets/rails_master_key)}" bundle exec rails assets:precompile; \
RUN if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ]; then \
SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile; \
else \
echo "Skipping assets:precompile"; \
fi
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ gem 'http', '~> 5.2.0'
gem 'jbuilder', '~> 2.13.0'
gem 'jquery-rails', '~> 4.6.0'
gem 'kaminari', '~> 1.2.2'
gem 'mini_racer', '~> 0.16.0'
gem 'mollie-api-ruby', '~> 4.15.0'
gem 'net-imap', require: false
gem 'net-pop', require: false
Expand All @@ -26,7 +25,7 @@ gem 'pg', '~> 1.5.9'
gem 'puma', '~> 6.5.0'
gem 'pundit', '~> 2.4.0'
gem 'rack-attack', '~> 6.7.0'
gem 'rails', '~> 7.0.4', '>= 7.0.4.3'
gem 'rails', '~> 7.1.0'
gem 'rails-i18n', '~> 7.0.10'
gem 'redis-rails', '~> 5.0.2'
gem 'rest-client', '~> 2.1.0'
Expand Down
Loading
Loading