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

@ -74,25 +74,32 @@ pipelines:
services: services:
- docker - docker
- step: - step:
name: Deploy coturn/coturn-dns to production name: Deploy, Verify and Test Production
deployment: production deployment: production
image: node:22
script: script:
- pipe: atlassian/kubectl-run:1.1.2 - apt-get update && apt-get install -y curl jq git
variables: - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
KUBE_CONFIG: $KUBE_CONFIG_PRD - install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
KUBECTL_COMMAND: '-n coturn rollout restart deployment/coturn' - echo $KUBE_CONFIG_PRD | base64 -d > kubeconfig
- pipe: atlassian/kubectl-run:1.1.2 - export KUBECONFIG=$(pwd)/kubeconfig
variables: - kubectl -n coturn rollout restart deployment/coturn
KUBE_CONFIG: $KUBE_CONFIG_PRD - kubectl -n coturn rollout status -w deployment/coturn
KUBECTL_COMMAND: '-n coturn rollout status -w deployment/coturn' - kubectl -n coturn-dns rollout restart deployment/coturn-dns
- pipe: atlassian/kubectl-run:1.1.2 - kubectl -n coturn-dns rollout status -w deployment/coturn-dns
variables: - chmod +x scripts/verify-deployment.sh
KUBE_CONFIG: $KUBE_CONFIG_PRD - ./scripts/verify-deployment.sh $BITBUCKET_COMMIT production
KUBECTL_COMMAND: '-n coturn-dns rollout restart deployment/coturn-dns' - npx playwright install-deps
- pipe: atlassian/kubectl-run:1.1.2 - git clone --depth 1 git@bitbucket.org:jamkazam/video-e2e.git
variables: - cd video-e2e
KUBE_CONFIG: $KUBE_CONFIG_PRD - npm install
KUBECTL_COMMAND: '-n coturn-dns rollout status -w deployment/coturn-dns' - 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: develop:
- parallel: - parallel:
- step: - step:
@ -177,6 +184,15 @@ pipelines:
if [ $BITBUCKET_EXIT_CODE -ne 0 ]; then 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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 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
- 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: custom:
build-and-push-coturn-dns: build-and-push-coturn-dns:
- variables: - variables:

View File

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