Fix version reporting ACME-122

This commit is contained in:
Daniel Schädler 2026-04-27 11:49:14 +02:00
parent 10f1a56734
commit 2bc39ad692
3 changed files with 6 additions and 10 deletions

View File

@ -57,7 +57,7 @@ FROM runtime-base AS production
ARG GIT_COMMIT_SHA=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ENV RAILS_ENV=production
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA}
ENV GIT_COMMIT_SHA=${base_commit}
COPY --from=bundle-production /usr/local/bundle /usr/local/bundle
COPY --from=bundle-production /app/vendor/bundle /app/vendor/bundle
@ -81,7 +81,7 @@ FROM runtime-base AS test
ARG GIT_COMMIT_SHA=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ENV RAILS_ENV=test
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA}
ENV GIT_COMMIT_SHA=${base_commit}
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \

View File

@ -8,12 +8,6 @@ class VersionController < ApplicationController
private
def git_commit_sha
ENV['GIT_COMMIT_SHA'].presence || local_git_commit_sha || 'unknown'
end
def local_git_commit_sha
Rails.root.join('.git').exist? ? `git rev-parse HEAD`.strip.presence : nil
rescue StandardError
nil
ENV['GIT_COMMIT_SHA'].presence || 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
end
end

View File

@ -33,7 +33,9 @@ RSpec.describe 'Backend API surface HTTP E2E' do
response = anonymous_client.get('/version')
expect(response[:status]).to eq(200)
expect(response.dig(:json, :git_commit_sha)).to match(/\A[0-9a-f]{40}\z/)
sha = response.dig(:json, :git_commit_sha)
expect(sha).to match(/\A[0-9a-f]{40}\z/)
expect(sha).not_to eq("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
end
it 'supports registration for new users and still requires confirmation for login' do