메뉴로 바로가기

Azure DevOps 통합

Capgo Live Updates를 Azure DevOps Pipelines와 통합하여 code 변경 사항을 푸시할 때마다 앱 업데이트를 자동으로 배포하세요. 이 가이드에서는 자동 빌드, 테스트 및 배포 워크플로우를 설정하는 방법을 설명합니다.

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

  • Azure DevOps 조직 및 프로젝트
  • Capgo 계정과 앱이 구성된 계정
  • 앱의 소스 code를 Azure Repos Git 저장소에 저장
  • Node.js 및 npm/yarn이 프로젝트에 구성

Azure DevOps Pipeline 설정

제목 ‘Azure DevOps Pipeline 설정’

Step 1: Pipeline 변수를 생성하세요

Step 1: Pipeline 변수를 생성하세요

먼저 Azure DevOps 프로젝트에서 필요한 변수를 설정하세요:

  1. Azure DevOps 프로젝트로 이동하세요
  2. 로 가세요 파이프라인라이브러리변수 그룹
  3. 변수 그룹을 생성하세요 Capgo-Variables
  4. 다음 변수를 추가하세요:
변수 이름안전한
CAPGO_TOKENCapgo API 토큰을 보호하세요✅ 예

기본

# Simple Azure DevOps Pipeline for Capgo Live Updates
trigger:
branches:
include:
- main
variables:
- group: Capgo-Variables
jobs:
- job: BuildAndDeploy
displayName: 'Build and Deploy to Capgo'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
displayName: 'Setup Node.js'
inputs:
versionSpec: '22.x'
- script: |
npm ci
npm run test
npm run build
displayName: 'Install, test and build'
- script: |
npm install -g @capgo/cli
npx @capgo/cli bundle upload --apikey $(CAPGO_TOKEN) --channel production
displayName: 'Deploy to Capgo'

기능 branch 배포

기능 branch 배포 섹션

기능 branch를 테스트 채널에 배포하여 검토 및 테스트를 위해:

# Feature branch deployment
trigger:
branches:
include:
- feature/*
variables:
- group: Capgo-Variables
jobs:
- job: DeployFeature
displayName: 'Deploy Feature Branch'
pool:
vmImage: 'ubuntu-latest'
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/feature/')
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- script: |
npm ci
npm run test
npm run build
displayName: 'Install, test and build'
- script: |
BRANCH_NAME=$(echo "$(Build.SourceBranchName)" | 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
displayName: 'Deploy to Feature Channel'

__CAPGO_KEEP_0__ 암호화 기능을 사용 중이라면

암호화 기능 사용에 대한 섹션

__CAPGO_KEEP_0__ 암호화 기능을 사용 중이라면 Capgo의 암호화 기능을 사용 중이라면암호화 키를 안전하게 CI/CD 환경에 저장해야 합니다.

암호화 키를 설정한 후 로컬에서 암호화 키를 설정한 후 Azure DevOps 변수에 개인 키를 추가하십시오. 터미널 창

클립보드에 복사
# Display your private key content (copy this output)
cat .capgo_key_v2

pipeline에서 사용하십시오. CAPGO_PRIVATE_KEY Azure DevOps 변수 그룹에 다음 내용을 추가하십시오 (비밀으로 표시).

# Deploy with encryption
- script: |
npm install -g @capgo/cli
npx @capgo/cli bundle upload --apikey $(CAPGO_TOKEN) --key-data-v2 "$(CAPGO_PRIVATE_KEY)" --channel production
displayName: 'Deploy to Capgo with Encryption'

__CAPGO_KEEP_6__ 문서를 참조하세요. __CAPGO_KEEP_7__.

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

# Advanced Azure DevOps Pipeline with Multiple Channels
trigger:
branches:
include:
- main
- develop
pr:
branches:
include:
- main
- develop
variables:
- group: Capgo-Variables
stages:
# Build stage
- stage: Build
jobs:
- job: BuildApp
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- script: |
npm ci
npm run test
npm run build
displayName: 'Install, test and build'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: 'dist'
artifactName: 'app-build'
# Deploy to development
- stage: DeployDev
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
jobs:
- deployment: DeployDevelopment
environment: development
pool:
vmImage: 'ubuntu-latest'
strategy:
runOnce:
deploy:
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'app-build'
downloadPath: '$(Pipeline.Workspace)'
- script: |
npm install -g @capgo/cli
npx @capgo/cli bundle upload --apikey $(CAPGO_TOKEN) --channel development --path $(Pipeline.Workspace)/app-build
displayName: 'Deploy to Development'
# Deploy PR to test channel
- stage: DeployPR
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
jobs:
- job: DeployPRChannel
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'app-build'
downloadPath: '$(Pipeline.Workspace)'
- script: |
CHANNEL_NAME="pr-$(System.PullRequest.PullRequestNumber)"
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 --path $(Pipeline.Workspace)/app-build
displayName: 'Deploy to PR Channel'
# Deploy to production
- stage: DeployProd
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- deployment: DeployProduction
environment: production
pool:
vmImage: 'ubuntu-latest'
strategy:
runOnce:
deploy:
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'app-build'
downloadPath: '$(Pipeline.Workspace)'
- script: |
npm install -g @capgo/cli
npx @capgo/cli bundle upload --apikey $(CAPGO_TOKEN) --channel production --path $(Pipeline.Workspace)/app-build
displayName: 'Deploy to Production'

다중 환경 배포

다중 환경 배포 섹션

복잡한 시나리오에 여러 환경이 필요한 경우:

# Extended pipeline with multiple environments
parameters:
- name: deployEnvironment
displayName: 'Deploy Environment'
type: string
default: 'staging'
values:
- staging
- production
variables:
- group: Capgo-Variables
- name: channelName
${{ if eq(parameters.deployEnvironment, 'production') }}:
value: 'production'
${{ else }}:
value: 'staging'
stages:
# Build stage
- stage: Build
jobs:
- job: BuildApp
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- script: |
npm ci
npm run test
npm run build
displayName: 'Install, test and build'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: 'dist'
artifactName: 'app-build'
- stage: DeployStaging
displayName: 'Deploy to Staging'
dependsOn: Build
condition: and(succeeded(), eq('${{ parameters.deployEnvironment }}', 'staging'))
jobs:
- deployment: DeployStaging
displayName: 'Deploy to Staging Channel'
pool:
vmImage: 'ubuntu-latest'
environment: 'staging'
strategy:
runOnce:
deploy:
steps:
- template: deploy-steps.yml
parameters:
channel: 'staging'
- stage: DeployProduction
displayName: 'Deploy to Production'
dependsOn: Build
condition: and(succeeded(), eq('${{ parameters.deployEnvironment }}', 'production'))
jobs:
- deployment: DeployProduction
displayName: 'Deploy to Production Channel'
pool:
vmImage: 'ubuntu-latest'
environment: 'production'
strategy:
runOnce:
deploy:
steps:
- template: deploy-steps.yml
parameters:
channel: 'production'

배포 템플릿 (deploy-steps.yml)

deploy-steps.yml 배포 템플릿 섹션

재사용 가능한 템플릿 파일을 생성합니다. deploy-steps.yml:

deploy-steps.yml
parameters:
- name: channel
type: string
steps:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '22.x'
- task: DownloadBuildArtifacts@0
displayName: 'Download build artifacts'
inputs:
artifactName: 'app-build'
downloadPath: '$(System.ArtifactsDirectory)'
- script: |
npm install -g @capgo/cli
displayName: 'Install Capgo CLI'
- script: |
npx @capgo/cli bundle upload \
--apikey $(CAPGO_TOKEN) \
--channel ${{ parameters.channel }} \
--path $(System.ArtifactsDirectory)/app-build
displayName: 'Upload to Capgo (${{ parameters.channel }})'

Git branch에 따라 다양한 배포 전략을 구성합니다.

trigger:
branches:
include:
- main
- develop
- feature/*
variables:
- group: Capgo-Variables
- name: targetChannel
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
value: 'production'
${{ elseif eq(variables['Build.SourceBranch'], 'refs/heads/develop') }}:
value: 'staging'
${{ else }}:
value: 'development'
stages:
- stage: Build
jobs:
- job: BuildApp
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- script: |
npm ci
npm run test
npm run build
displayName: 'Install, test and build'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: 'dist'
artifactName: 'app-build'
- stage: Deploy
displayName: 'Deploy to $(targetChannel)'
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeployJob
displayName: 'Deploy to $(targetChannel) Channel'
pool:
vmImage: 'ubuntu-latest'
environment: '$(targetChannel)'
strategy:
runOnce:
deploy:
steps:
- template: deploy-steps.yml
parameters:
channel: '$(targetChannel)'
  1. 변수 그룹 사용Azure DevOps 변수 그룹에서 sensitive 데이터를 저장합니다.
  2. __CAPGO_KEEP_0__ 토큰과 키를 항상 secret 변수로 표시합니다.: Always mark API tokens and keys as secret variables
  3. Scope Access를 지정합니다.변수 그룹에 대한 접근을 특정 pipe라인과 사용자에게 제한합니다.
  4. 키 회전: 정기적으로 Capgo API 토큰을 회전합니다.

모니터링 및 알림

모니터링 및 알림

팀 통합

팀 통합

pipe라인에 대한 Microsoft Teams 알림을 추가합니다.

- task: ms-teams-deploy-card@1.4.1
displayName: 'Notify Teams on Success'
condition: succeeded()
inputs:
webhookUri: '$(TEAMS_WEBHOOK_URL)'
title: 'Capgo Deployment Successful'
text: 'App deployed to $(targetChannel) channel'
themeColor: '00FF00'
- task: ms-teams-deploy-card@1.4.1
displayName: 'Notify Teams on Failure'
condition: failed()
inputs:
webhookUri: '$(TEAMS_WEBHOOK_URL)'
title: 'Capgo Deployment Failed'
text: 'Deployment to $(targetChannel) failed'
themeColor: 'FF0000'

이메일 알림

이메일 알림

배포 상태에 대한 이메일 알림을 구성합니다.

- task: EmailReport@1
displayName: 'Send Email Report'
condition: always()
inputs:
sendMailConditionConfig: 'Always'
subject: 'Capgo Deployment Report - $(Build.BuildNumber)'
to: 'team@yourcompany.com'
body: |
Deployment Status: $(Agent.JobStatus)
Channel: $(targetChannel)
Build: $(Build.BuildNumber)
Commit: $(Build.SourceVersion)

일반적인 문제

제목: 일반적인 문제

Capgo CLI이(가) 없습니다.: pipeline이 실패합니다.

# Ensure global installation
- script: |
npm install -g @capgo/cli
which capgo || echo "Capgo CLI not found in PATH"
displayName: 'Install and verify Capgo CLI'

인증 오류:

# Verify token is correctly set
- script: |
echo "Token length: ${#CAPGO_TOKEN}"
if [ -z "$CAPGO_TOKEN" ]; then
echo "CAPGO_TOKEN is not set"
exit 1
fi
displayName: 'Verify Capgo token'
env:
CAPGO_TOKEN: $(CAPGO_TOKEN)

빌드 아티팩트가 없습니다.:

# List available artifacts for debugging
- script: |
ls -la $(System.ArtifactsDirectory)
find $(System.ArtifactsDirectory) -name "*.js" -o -name "*.html"
displayName: 'Debug artifacts'

Debug Pipeline

Debug Pipeline

문제를 해결하기 위해 디버깅 단계를 추가하세요:

- script: |
echo "Build.SourceBranch: $(Build.SourceBranch)"
echo "Build.BuildNumber: $(Build.BuildNumber)"
echo "Target Channel: $(targetChannel)"
displayName: 'Debug Pipeline Variables'
- script: |
npx @capgo/cli app debug --apikey $(CAPGO_TOKEN)
displayName: 'Debug Capgo App Status'

다음 단계

Next Steps

With Azure DevOps integration, you can automate your Capgo deployments and ensure consistent, reliable updates to your mobile app users.

__CAPGO_KEEP_5__

__CAPGO_KEEP_6__

__CAPGO_KEEP_7__ __CAPGO_KEEP_8__ __CAPGO_KEEP_9__ Capgo CI/CD 제품 워크플로우에 대한 Capgo CI/CD에 대한 Capgo 네이티브 빌드 Capgo CI/CD에 대한 제품 워크플로우 Capgo 통합 Capgo 통합에 대한 제품 워크플로우 CI/CD 통합 CI/CD 통합에 대한 구현 세부 사항, 및 GitHub 액션 통합 GitHub 액션 통합에 대한 구현 세부 사항