Skip to content

Commit

Permalink
Make the Sentry release conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Dec 18, 2024
1 parent 17db1a1 commit 8a95b6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
uses: docker/build-push-action@v6
with:
secrets: |
"sentry_auth_token=${{ secrets.SENTRY_AUTH_TOKEN }}"
"sentry_auth_token=${{ matrix.image == 'frontend' && secrets.SENTRY_AUTH_TOKEN }}"
context: ${{ matrix.context }}
target: ${{ matrix.target }}
push: false
Expand All @@ -203,6 +203,7 @@ jobs:
FRONTEND_NODE_VERSION=${{ steps.prepare-build-args.outputs.frontend_node_version }}
FRONTEND_PNPM_VERSION=${{ steps.prepare-build-args.outputs.frontend_pnpm_version }}
PGCLI_VERSION=${{ steps.prepare-build-args.outputs.pgcli_version }}
ADD_SENTRY_RELEASE=${{ ((github.event_name == 'push' && github.repository == 'WordPress/openverse') || (github.event_name == 'workflow_dispatch' && inputs.perform_deploy)) }}
${{ matrix.build-args || '' }}
- name: Upload image `${{ matrix.image }}`
Expand Down
10 changes: 8 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARG FRONTEND_NODE_VERSION
FROM docker.io/node:${FRONTEND_NODE_VERSION}-alpine AS builder

ARG SEMANTIC_VERSION
ARG ADD_SENTRY_RELEASE

# Install system packages needed to build on macOS
RUN apk add --no-cache --virtual .gyp python3 make g++ \
Expand Down Expand Up @@ -46,11 +47,16 @@ ENV NODE_ENV=production
# Increase memory limit for the build process (necessary for i18n routes)
ENV NODE_OPTIONS="--max_old_space_size=4096"
ENV SEMANTIC_VERSION=${SEMANTIC_VERSION}
ENV ADD_SENTRY_RELEASE=${ADD_SENTRY_RELEASE}


RUN --mount=type=secret,id=sentry_auth_token,mode=0444 \
sh -c 'SENTRY_AUTH_TOKEN="$(cat /run/secrets/sentry_auth_token)" && \
echo "SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN" >> .env.sentry-build-plugin'
sh -c 'if [ "$ADD_SENTRY_RELEASE" = "true" ]; then \
SENTRY_AUTH_TOKEN="$(cat /run/secrets/sentry_auth_token)" && \
echo "SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN" >> .env.sentry-build-plugin; \
fi' \

RUN printenv

Check warning on line 59 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Build Docker images (frontend)

Empty continuation lines will become errors in a future release

NoEmptyContinuation: Empty continuation line More info: https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/

RUN pnpm build
############
Expand Down

0 comments on commit 8a95b6a

Please sign in to comment.