You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
i have written a yml for that just configured ec2 details after that i need to send an email to developers that depolyment is done with the status failed r sucess.
image: atlassian/default-image:3
pipelines:
default:
- parallel:
- step:
name: 'Build and Test'
script:
- echo "Your build and test goes here.."
- step:
name: 'Lint'
script:
- echo "Your linting goes here..."
- step:
name: 'Security scan'
script:
- echo "Your security scan goes here..."
# The following deployment steps will be executed for each pipeline run. To configure your steps and conditionally deploy see https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/
- step:
name: 'Deployment to Staging'
deployment: staging
script:
- pipe: atlassian/ssh-run:0.4.0
variables :
SSH_USER: '******'
SERVER: '*************'
COMMAND: 'mkdir test21'
- step :
name: 'email notifications'
script:
- ALERT_TYPE="success"
- if [[ $BITBUCKET_EXIT_CODE -ne 0 ]]; then ALERT_TYPE="error" ; fi
- pipe: 'atlassian/email-notify:0.5.0'
variables :
USERNAME: '$SOME_USERNAME'
PASSWORD: $PASSWORD
FROM: 'noreply@atlassian.com'
TO: '$SOME_EMAIL_TO'
HOST: 'smtp.gmail.com'
PORT: '25'
SUBJECT: '${ALERT_TYPE}:Bitbucket Pipe Notification for ${BITBUCKET_BRANCH}'
Hi @amol funde
Welcome to the community.
For you to be able to run scripts on Pipelines regardless if the build is failed or successful, you can use the configuration called "after-script".
After-script will allow you to run commands at the end of a step execution.
For your current YAML configuration, you'll just need to add the step "email notifications" as an after-script of the step "Deployment to Staging".
Your "Deployment to Staging" step, should look like below:
- step: name: 'Deployment to Staging' deployment: staging script: - pipe: atlassian/ssh-run:0.4.0 variables : SSH_USER: '******' SERVER: '*************' COMMAND: 'mkdir test21' after-script: - ALERT_TYPE="success" - if [[ $BITBUCKET_EXIT_CODE -ne 0 ]]; then ALERT_TYPE="error" ; fi - pipe: 'atlassian/email-notify:0.5.0' variables : USERNAME: '$SOME_USERNAME' PASSWORD: $PASSWORD FROM: '$SOME_EMAIL_FROM' TO: '$SOME_EMAIL_TO' HOST: 'smtp.gmail.com' PORT: '25' SUBJECT: '${ALERT_TYPE}:Bitbucket Pipe Notification for ${BITBUCKET_BRANCH}'
Hope it helps and let me know how it goes.
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.