I'm having an issue with Pipeline deployment. This is my `yml` file:
pipelines:
branches:
staging:
- step:
name: Build an app
image: node:22.0.0
caches:
- node
size: 2x
script:
- npm install
- export NODE_OPTIONS=--max-old-space-size=6144
- npm run build:staging
artifacts:
- dist/**
- step:
name: Upload source maps to Sentry
image: getsentry/sentry-cli:2.40.0
script:
- sentry-cli sourcemaps inject --org XXX --project $SENTRY_PROJECT_NAME ./dist
- sentry-cli sourcemaps upload --org XXX --project $SENTRY_PROJECT_NAME --auth-token $SENTRY_AUTH_TOKEN ./dist
- step:
name: Deploy new build to staging droplet
deployment: staging
script:
- rsync -rzO dist/skote/ $SSH_USER@$SSH_SERVER:/home/$WEBSITE/$URL/dist/ --exclude=bitbucket-pipelines.yml
As you can see, there are few variables in there and are defined in these scopes:
- Deployments
- Repository variables
- SSH_USER
- SENTRY_AUTH_TOKEN
The problem I'm having is that all work well, except the $SENTRY_PROJECT_NAME. The variable while executing pipeline is empty and the pipeline errors out, while ALL other do work.
If I move the variable SENTRY_PROJECT_NAME into `Repository variables`, then it starts to work, but this way the variables are not that well structured, since I wanted to separate them per deployment. Right now I need to add two variables SENTRY_PROJECT_NAME and SENTRY_PROJECT_NAME_STAGING. With Deployments, I can have same variable name and two different strings in it, based on which environment is being used for deployment.
My question is: why is the SENTRY_PROJECT_NAME ignored when it's added into Deployment environment and how to properly utilize it?