메뉴로 이동

Bitbucket Pipelines 통합

Bitbucket Pipelines와 Capgo Live Updates를 통합하여 앱 업데이트를 자동으로 배포하세요. 변경 사항이 code 푸시될 때마다.

Bitbucket Pipelines 통합을 설정하기 전에 다음을 확인하세요:

  • Bitbucket 계정과 저장소가 필요합니다.
  • Capgo 계정과 앱을 설정한 상태여야 합니다.
  • Node.js와 npm/yarn이 프로젝트에 설치되어 있어야 합니다.

Bitbucket Pipelines 설정

Bitbucket Pipelines 설정

1단계: 저장소 변수 설정

1단계: 저장소 변수 설정

먼저 Bitbucket 저장소에서 필요한 변수를 설정하세요:

  1. Bitbucket 저장소로 이동하세요.
  2. 다음으로 저장소 설정pipelinerepository 변수
  3. __CAPGO_KEEP_0__ 변수 이름을 __CAPGO_KEEP_1__ 값으로 추가하세요.
변수 이름보안
CAPGO_TOKENCapgo API 토큰을 입력하세요.✅ Yes

프로덕션으로 배포하는 기본 설정: 주로 메인 branch에 푸시할 때

# bitbucket-pipelines.yml - Simple Configuration
image: 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 deployment
pipelines:
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/**

설정 후 Capgo’s encryption feature__CAPGO_KEEP_0__'s encryption feature

__CAPGO_KEEP_0__'s encryption feature __CAPGO_KEEP_0__'s encryption feature 지역에서, Bitbucket 변수에 개인 키를 추가하세요:

터미널 창
# Display your private key content (copy this output)
cat .capgo_key_v2

Bitbucket 저장소 변수에 이 내용을 추가하세요 (보안으로 표시) CAPGO_PRIVATE_KEY 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 production

다중 채널 구성

다중 채널 구성

다중 배포 채널을 설정하고 관리하는 데 대한 자세한 정보는 채널 문서.

다중 환경 및 Pull Request 배포와 함께 완전한 구성:

# bitbucket-pipelines.yml - Advanced Multi-Channel Configuration
image: 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/**

클립보드 복사

# Multi-environment pipeline
image: 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를 적절한 채널로 자동 배포합니다.

# Dynamic channel deployment
image: 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 실행

Parallel Pipeline Execution

병렬 단계를 통해 빌드 시간을 최적화합니다.

# Parallel execution pipeline
image: 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

보안 최적화

보안 최적화

Repository Variables

Repository Variables
  1. Secured VariablesAPI를 항상 보안 토큰으로 표시하세요.
  2. 환경 변수__CAPGO_KEEP_0__가 필요할 때 사용하는 배포 환경 변수를 사용하세요.
  3. 액세스 제어권한이 있는 팀원만에게 리포지토리 접근을 제한하세요.
  4. 토큰 회전Capgo와 API 토큰을 정기적으로 회전하세요.

클립보드에 복사

# Deployment with environment restrictions
pipelines:
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

배포 환경을 위한 보안을 향상하세요:

Monitoring and Notifications

Slack 연동

Slack Integration

pipeline에 Slack 알림을 추가하세요:

# Pipeline with Slack notifications
pipelines:
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

이메일 알림

Email Notifications

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]

문제 해결

Troubleshooting

일반적인 문제

일반 문제

Capgo CLI이(가) 없습니다.

# 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

디버그 PIPELINE 섹션

문제를 해결하기 위해 디버깅 정보를 추가하세요.

# Debug pipeline
pipelines:
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 production

PIPELINE 유효성 검사

Pipeline Validation 섹션 제목

설정 오류를 잡기 위해 pipeline 검증을 활성화하세요.

# Enable pipeline validation
options:
docker: true
size: 2x
pipelines:
branches:
main:
- step:
name: Validate Pipeline
script:
- echo "Pipeline validation successful"
- step:
name: Build and Deploy
script:
# ... deployment steps
  • 에 대해 알아보세요. 채널 다양한 배포 환경을 관리하기 위해
  • Explore 고급 배포 시나리오를 위해 Custom Storage 설정하기']} (Note: The translation is based on the provided source text and may not be perfect. It's always recommended to have a native speaker review the translation for accuracy and cultural context.) The protected tokens were left unchanged as per the request. The target language is Korean. The translations are in the same order as the input. The JSON object has exactly one key named
  • translations __CAPGO_KEEP_0__ 보안 배포를 위한 암호화
  • 설정 업데이트 동작을 설정하여 업데이트가 적용되는 방식을 커스터마이즈하세요 Bitbucket Pipelines와의 통합을 통해 __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 __CAPGO_KEEP_0__ CI/CD Capgo CI/CD 제품 워크플로우에서 Capgo CI/CD를 위해 Capgo 네이티브 빌드 제품 워크플로우에서 Capgo 네이티브 빌드를 위해 Capgo 통합 제품 워크플로우에서 Capgo 통합을 위해 CI/CD 통합 CI/CD 통합 구현 세부 사항, 그리고 GitHub 액션 통합 구현 세부 사항 for the implementation detail in GitHub Actions Integration.