Let's test deploying automatically from dev to prod

This commit is contained in:
Seth Call 2026-01-11 15:35:30 -06:00
parent b44a81feff
commit 77a47c42d9
2 changed files with 41 additions and 20 deletions

View File

@ -1,4 +1,4 @@
---
---
image: atlassian/default-image:2
definitions:
@ -74,25 +74,32 @@ pipelines:
services:
- docker
- step:
name: Deploy coturn/coturn-dns to production
name: Deploy, Verify and Test Production
deployment: production
image: node:22
script:
- pipe: atlassian/kubectl-run:1.1.2
variables:
KUBE_CONFIG: $KUBE_CONFIG_PRD
KUBECTL_COMMAND: '-n coturn rollout restart deployment/coturn'
- pipe: atlassian/kubectl-run:1.1.2
variables:
KUBE_CONFIG: $KUBE_CONFIG_PRD
KUBECTL_COMMAND: '-n coturn rollout status -w deployment/coturn'
- pipe: atlassian/kubectl-run:1.1.2
variables:
KUBE_CONFIG: $KUBE_CONFIG_PRD
KUBECTL_COMMAND: '-n coturn-dns rollout restart deployment/coturn-dns'
- pipe: atlassian/kubectl-run:1.1.2
variables:
KUBE_CONFIG: $KUBE_CONFIG_PRD
KUBECTL_COMMAND: '-n coturn-dns rollout status -w deployment/coturn-dns'
- apt-get update && apt-get install -y curl jq git
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- echo $KUBE_CONFIG_PRD | base64 -d > kubeconfig
- export KUBECONFIG=$(pwd)/kubeconfig
- kubectl -n coturn rollout restart deployment/coturn
- kubectl -n coturn rollout status -w deployment/coturn
- kubectl -n coturn-dns rollout restart deployment/coturn-dns
- kubectl -n coturn-dns rollout status -w deployment/coturn-dns
- chmod +x scripts/verify-deployment.sh
- ./scripts/verify-deployment.sh $BITBUCKET_COMMIT production
- npx playwright install-deps
- git clone --depth 1 git@bitbucket.org:jamkazam/video-e2e.git
- cd video-e2e
- npm install
- npx playwright install chromium
- ./bin/production-test
after-script:
- |
if [ $BITBUCKET_EXIT_CODE -ne 0 ]; then
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"🚨 Pipeline Failed: Production verification/tests failed for commit $BITBUCKET_COMMIT. <https://bitbucket.org/$BITBUCKET_REPO_FULL_NAME/pipelines/results/$BITBUCKET_BUILD_NUMBER|View Log>\"}" https://hooks.slack.com/services/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
fi
develop:
- parallel:
- step:
@ -177,6 +184,15 @@ pipelines:
if [ $BITBUCKET_EXIT_CODE -ne 0 ]; then
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"🚨 Pipeline Failed: Staging verification/tests failed for commit $BITBUCKET_COMMIT. <https://bitbucket.org/$BITBUCKET_REPO_FULL_NAME/pipelines/results/$BITBUCKET_BUILD_NUMBER|View Log>\"}" https://hooks.slack.com/services/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
fi
- step:
name: Promote to Production
script:
- git config --global user.email "ci-bot@jamkazam.com"
- git config --global user.name "CI Bot"
- git fetch origin main:main
- git checkout main
- git merge $BITBUCKET_COMMIT
- git push origin main
custom:
build-and-push-coturn-dns:
- variables:
@ -219,4 +235,4 @@ pipelines:
- |
if [ $BITBUCKET_EXIT_CODE -ne 0 ]; then
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"🚨 Pipeline Failed: Staging verification/tests failed for commit $BITBUCKET_COMMIT. <https://bitbucket.org/$BITBUCKET_REPO_FULL_NAME/pipelines/results/$BITBUCKET_BUILD_NUMBER|View Log>\"}" https://hooks.slack.com/services/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
fi
fi

View File

@ -3,7 +3,12 @@ set -e
COMMIT_HASH=$1
ENV=$2 # staging or production
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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"
if [ "$ENV" == "production" ]; then
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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"
else
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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"
fi
if [ -z "$COMMIT_HASH" ]; then
echo "Usage: $0 <commit-hash> <env>"