페이지 복사 옵션
Bitbucket Pipeline와 통합하여 __CAPGO_KEEP_0__ 업데이트를 자동으로 배포할 수 있습니다. __CAPGO_KEEP_1__ 변경 사항이 푸시될 때마다.
Bitbucket Pipeline와 Capgo Live Updates를 통합하여 Capgo 업데이트를 자동으로 배포할 수 있습니다. code 변경 사항이 푸시될 때마다.
Bitbucket 계정과 저장소가 필요합니다.
- 설치하기 전에
- A Capgo 계정에 앱이 구성된 경우
- Node.js 및 npm/yarn이 프로젝트에 구성된 경우
Bitbucket Pipelines 설정
Bitbucket Pipelines 설정1단계: 저장소 변수 설정
1단계: 저장소 변수 설정먼저 Bitbucket 저장소에서 필요한 변수를 설정하세요:
- Bitbucket 저장소로 이동하세요
- 다음 저장소 설정 → Pipeline → 저장소 변수
- 다음 변수를 추가하세요:
| 변수 이름 | 값 | 보안 |
|---|---|---|
CAPGO_TOKEN | 당신의 Capgo API 토큰 | ✅ Yes |
간단한
간단한 섹션기본 설정: 메인 branch로 push할 때마다 프로덕션으로 배포:
# bitbucket-pipelines.yml - Simple Configurationimage: node:22
pipelines: branches: main: - step: name: Build and Deploy to Production script: - npm ci - npm run test - npm run build - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel production artifacts: - dist/**고급
고급 섹션기능 branch 배포
기능 branch 배포 섹션기능 branch를 테스트 채널에 배포하여 검토 및 테스트:
# Feature branch deploymentpipelines: branches: feature/*: - step: name: Deploy Feature Branch script: - npm ci - npm run test - npm run build - BRANCH_NAME=$(echo $BITBUCKET_BRANCH | sed 's/[^a-zA-Z0-9-]/-/g') - CHANNEL_NAME="feature-$BRANCH_NAME" - npm install -g @capgo/cli - npx @capgo/cli channel create $CHANNEL_NAME --apikey $CAPGO_TOKEN || true - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel $CHANNEL_NAME artifacts: - dist/**, CI/CD 환경에서 개인 키를 안전하게 저장해야 합니다. Capgo’s encryption feature개인 키를 Bitbucket 변수에 추가하세요:
터미널 창 setting up encryption keys locally, add your private key to Bitbucket variables:
# Display your private key content (copy this output)cat .capgo_key_v2Bitbucket 저장소 변수에 이 콘텐츠를 추가하세요 (보안으로 표시) CAPGO_PRIVATE_KEY Bitbucket Pipelines에서 사용하기 위해 변수를 설정하세요:
# Deploy with encryption- step: name: Deploy to Capgo with Encryption script: - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --key-data-v2 "$CAPGO_PRIVATE_KEY" --channel productionMulti-Channel Configuration
다채널 구성다채널 구성에 대한 자세한 정보는 채널 문서.
다중 환경 및 Pull Request 배포와 함께 완전한 구성:
# bitbucket-pipelines.yml - Advanced Multi-Channel Configurationimage: node:22
definitions: steps: - step: &build-step name: Build Application script: - npm ci - npm run test - npm run build artifacts: - dist/**
- step: &deploy-step name: Deploy to Capgo script: - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel $CHANNEL_NAME
pipelines: branches: main: - step: <<: *build-step - step: <<: *deploy-step name: Deploy to Production deployment: production trigger: manual script: - export CHANNEL_NAME=production - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel $CHANNEL_NAME
develop: - step: <<: *build-step - step: <<: *deploy-step name: Deploy to Development deployment: development script: - export CHANNEL_NAME=development - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel $CHANNEL_NAME
pull-requests: '**': - step: <<: *build-step - step: name: Deploy PR to Test Channel script: - CHANNEL_NAME="pr-$BITBUCKET_PR_ID" - npm install -g @capgo/cli - npx @capgo/cli channel create $CHANNEL_NAME --apikey $CAPGO_TOKEN || true - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel $CHANNEL_NAME artifacts: - dist/**다중 환경 pipeline
제목: 다중 환경 pipeline제품 출시 시나리오에 대한 복잡한 배포:
# Multi-environment pipelineimage: node:22
pipelines: branches: main: - step: name: Build script: - npm ci - npm run test - npm run build artifacts: - dist/** - step: name: Deploy to Staging deployment: staging script: - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel staging - step: name: Deploy to Production deployment: production trigger: manual script: - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel production
develop: - step: name: Build and Deploy to Development script: - npm ci - npm run test - npm run build - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel development artifacts: - dist/**Branch-Based 배포 전략
제목: Branch-Based 배포 전략자동으로 다른 Branch를 적절한 채널로 배포:
# Dynamic channel deploymentimage: node:22
definitions: scripts: - script: &determine-channel | if [ "$BITBUCKET_BRANCH" = "main" ]; then export CHANNEL_NAME="production" elif [ "$BITBUCKET_BRANCH" = "develop" ]; then export CHANNEL_NAME="staging" else export CHANNEL_NAME="development" fi echo "Deploying to channel: $CHANNEL_NAME"
pipelines: default: - step: name: Build and Deploy script: - npm ci - npm run test - npm run build - *determine-channel - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel $CHANNEL_NAME artifacts: - dist/**병렬_PIPELINE_실행
병렬_PIPELINE_실행 섹션병렬 단계를 사용하여 빌드 시간을 최적화:
# Parallel execution pipelineimage: node:22
pipelines: branches: main: - parallel: - step: name: Run Tests script: - npm ci - npm run test - step: name: Lint Code script: - npm ci - npm run lint - step: name: Build Application script: - npm ci - npm run build artifacts: - dist/** - step: name: Deploy to Production deployment: production script: - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel production보안 최선의 방법
보안 최선의 방법 섹션저장소 변수
저장소 변수 섹션- 보안 변수API 변수는 항상 보안 변수로 표시해야 함
- 환경 변수: 필요시 배포 특정 변수를 사용하세요
- 접근 제어: 권한이 있는 팀원만에게 저장소에 대한 접근을 제한하세요
- 토큰 회전: 정기적으로 Capgo API 토큰을 회전하세요
배포 환경
배포 환경배포 환경을 더 안전하게 구성하세요:
# Deployment with environment restrictionspipelines: branches: main: - step: name: Deploy to Production deployment: production trigger: manual script: - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel production모니터링 및 알림
모니터링 및 알림슬랙 통합
Slack 통합pipeline에 Slack 알림을 추가하세요:
# Pipeline with Slack notificationspipelines: branches: main: - step: name: Build and Deploy script: - npm ci - npm run test - npm run build - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel production after-script: - | if [ $BITBUCKET_EXIT_CODE -eq 0 ]; then curl -X POST -H 'Content-type: application/json' \ --data '{"text":"✅ Capgo deployment successful for '$BITBUCKET_BRANCH'"}' \ $SLACK_WEBHOOK_URL else curl -X POST -H 'Content-type: application/json' \ --data '{"text":"❌ Capgo deployment failed for '$BITBUCKET_BRANCH'"}' \ $SLACK_WEBHOOK_URL fi이메일 알림
Section titled “이메일 알림”Bitbucket 내장 기능을 통해 이메일 알림을 구성하거나 외부 서비스를 사용하세요:
# Email notification step- step: name: Send Notification script: - | curl -X POST \ -H "Content-Type: application/json" \ -d '{ "to": "team@yourcompany.com", "subject": "Capgo Deployment Status", "body": "Deployment of '$BITBUCKET_BRANCH' completed with status: '$BITBUCKET_EXIT_CODE'" }' \ $EMAIL_SERVICE_URL condition: result: [successful, failed]일반적인 문제
Section titled “일반적인 문제”pipeline이 “Capgo CLI not found”로 실패합니다:
# Debug CLI installation- step: name: Debug CLI script: - npm install -g @capgo/cli - which capgo || echo "Capgo CLI not found" - npx @capgo/cli --version인증 오류:
# Verify token configuration- step: name: Debug Auth script: - | if [ -z "$CAPGO_TOKEN" ]; then echo "CAPGO_TOKEN is not set" exit 1 fi echo "Token length: ${#CAPGO_TOKEN}"빌드 아티팩트 찾을 수 없음:
# List build outputs- step: name: Debug Build script: - ls -la dist/ - find dist/ -type f -name "*.js" -o -name "*.html"디버그 PIPELINE
디버그 정보를 추가하여 문제를 해결하기 위해:클립보드 복사
# Debug pipelinepipelines: branches: main: - step: name: Debug Information script: - echo "Branch: $BITBUCKET_BRANCH" - echo "Commit: $BITBUCKET_COMMIT" - echo "Build: $BITBUCKET_BUILD_NUMBER" - env | grep BITBUCKET_ | sort - step: name: Build and Deploy script: - npm ci - npm run test - npm run build - npm install -g @capgo/cli - npx @capgo/cli bundle upload --apikey $CAPGO_TOKEN --channel productionPIPELINE 검증을 활성화하여 구성 오류를 잡아내세요:
Section titled “Debug Pipeline”Section titled “Pipeline Validation”
# Enable pipeline validationoptions: docker: true size: 2x
pipelines: branches: main: - step: name: Validate Pipeline script: - echo "Pipeline validation successful" - step: name: Build and Deploy script: # ... deployment steps다음 단계
다음 단계- 알아보기 채널 다양한 배포 환경을 관리하기 위해
- 탐색 고급 배포 시나리오를 위해 설정
- 암호화 안전한 배포를 위해 __CAPGO_KEEP_0__
- 설정 업데이트 동작 업데이트를 적용하는 방법을 커스터마이즈하세요
With Bitbucket Pipelines integration, you can automate your Capgo deployments and ensure consistent, reliable updates to your mobile app users.
Bitbucket Pipelines 통합을 통해 Bitbucket Pipelines 통합을 사용하여 모바일 앱 사용자에게 일관되고 신뢰할 수 있는 업데이트를 보장하는 자동화된 배포를 수행할 수 있습니다.
Bitbucket Pipelines 통합에서 계속Bitbucket Pipelines 통합에서 계속 Bitbucket Pipelines 통합을 사용 중이라면 Bitbucket Pipelines 통합 CI/CD 자동화 계획을 위해 Bitbucket Pipelines 통합을 사용하고 Capgo CI/CD와 연결하세요. Capgo CI/CD에서 제품 워크플로우를 Capgo CI/CD와 Capgo Native Builds와 연결하세요. Capgo CI/CD for the product workflow in Capgo Native Builds, Capgo Integrations for the product workflow in Capgo Integrations, CI/CD Integration CI/CD Integration GitHub Actions Integration for the implementation detail in GitHub Actions Integration.