Skip to content

Commit

Permalink
Fix conditional for secret
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Dec 18, 2024
1 parent 6ff9026 commit bb750c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
with:
# The Sentry auth token is only set for the production release of the frontend (on push to main or manual release).
secrets: |
"sentry_auth_token=${{ matrix.image == 'frontend' && ((github.event_name == 'push' && github.repository == 'WordPress/openverse') ||(github.event_name == 'workflow_dispatch' && inputs.perform_deploy)) && secrets.SENTRY_AUTH_TOKEN || ''}}"
${{ matrix.image == 'frontend' && ((github.event_name == 'push' && github.repository == 'WordPress/openverse') || (github.event_name == 'workflow_dispatch' && inputs.perform_deploy)) && format('sentry_auth_token={0}', secrets.SENTRY_AUTH_TOKEN) || '' }}
context: ${{ matrix.context }}
target: ${{ matrix.target }}
push: false
Expand Down
10 changes: 8 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ ENV NODE_ENV=production
ENV NODE_OPTIONS="--max_old_space_size=4096"
ENV SEMANTIC_VERSION=${SEMANTIC_VERSION}

# Use the Sentry auth token secret to send the sourcemaps to Sentry
# Use the Sentry auth token secret to send the sourcemaps to Sentry only if the secret is provided
RUN --mount=type=secret,id=sentry_auth_token,mode=0444 \
SENTRY_AUTH_TOKEN="$(cat /run/secrets/sentry_auth_token)" pnpm build
sh -c 'if [ -f /run/secrets/sentry_auth_token ]; then \
SENTRY_AUTH_TOKEN="$(cat /run/secrets/sentry_auth_token)"; \
echo "Using Sentry Auth Token: $SENTRY_AUTH_TOKEN"; \
else \
echo "No Sentry Auth Token provided"; \
fi' && pnpm build


############
# Nuxt app #
Expand Down

0 comments on commit bb750c4

Please sign in to comment.