I am using Cypress and Bitbucket for CI/CD. I have scheduled the run in bitbucket pipeline. I use the email notify feature in after script to get the test result via mail. it is difficult for me to understand which module failed. I have added bitbucket build number, step uuid. But, I want to include the name that I have added in the script.
I want the {BITBUCKET_STEP_NAME} to have the name of the step that is "Module 1". But, it was not working.
step: <<: default-step
name: Module 1
after-script:
pipe: atlassian/email-notify:0.13.1
variables:
USERNAME: "xxxx@gmail.com"
PASSWORD: "......"
FROM: "xxxx@gmail.com"
TO: "yyyy@gmail.com"
HOST: "smtp.gmail.com"
PORT: 587
DEBUG: "true"
SUBJECT: "${BITBUCKET_STEP_NAME} [STAGING] BUILD# ${BITBUCKET_BUILD_NUMBER} ${STATUS}: ${BITBUCKET_STEP_NAME} Notification for ${BITBUCKET_BRANCH}."
BODY_PLAIN: "The artifacts can be downloaded from the following URL: $ARTIFACTS_URL"
${BITBUCKET_STEP_NAME}
${BITBUCKET_STEP_NAME}
${BITBUCKET_STEP_NAME}
Hi Abinaya,
BITBUCKET_STEP_NAME is not a default variable that can be referred to, hence why it's not returning the expected result. We have a feature request raised with our developers to include this so that it can be referenced in builds:
In the description of the above feature request, there is a workaround for grabbing the step name within the build script by using our REST API and authenticating with App Password - for example:
BITBUCKET_STEP_NAME=$(curl --request GET --url "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_FULL_NAME}/pipelines/%7B${BITBUCKET_PIPELINE_UUID}%7D/steps/%7B${BITBUCKET_STEP_UUID}%7D?fields=name" -u $BITBUCKET_USERNAME:$BITBUCKET_APP_PASSWORD | jq -r '.name')
I hope this helps.
Cheers!
- Ben (Bitbucket Cloud Support)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.