__CAPGO_KEEP_10__
이 플러그인의 설치 단계와 전체 마크다운 가이드를 포함한 설정 명령어를 복사하세요.
Integrate Capgo Live Updates with Azure DevOps Pipelines to automatically deploy your app updates whenever you push code changes. This guide covers setting up automated builds, testing, and deployment workflows.
Azure DevOps Pipelines와 __CAPGO_KEEP_0__ Live Updates를 통합하여 __CAPGO_KEEP_1__ 변경 사항을 푸시할 때마다 자동으로 앱 업데이트를 배포하세요. 이 가이드는 자동화된 빌드, 테스트 및 배포 워크플로우를 설정하는 방법을 다룹니다.
기본 조건Azure DevOps 통합을 설정하기 전에 다음을 확인하세요:
- Azure DevOps 조직 및 프로젝트
- A Capgo account with an app configured
- Your app’s source code in an Azure Repos Git repository
- Node.js and npm/yarn configured in your project
Azure DevOps Pipeline 설정
Azure DevOps Pipeline 설정1단계: Pipeline 변수 설정
1단계: Azure DevOps 프로젝트에서 필요한 변수를 설정하세요:Azure DevOps 프로젝트로 이동하세요
- Navigate to your Azure DevOps project
- Go to Pipeline → 라이브러리 → 변수 그룹
- Create a new variable group named
Capgo-Variables - Add the following variables:
| 변수 이름 | 값 | 보안 |
|---|---|---|
CAPGO_TOKEN | Your Capgo API token | ✅ Yes |
클립보드에 복사
# Simple Azure DevOps Pipeline for Capgo Live Updatestrigger: 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 배포
Section titled “Advanced”기능 branch 배포
기능 branch 배포기능 branch를 테스트 채널에 배포하여 검토 및 테스트:
# Feature branch deploymenttrigger: 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'기능 제목 “Using Encryption”
만약 __CAPGO_KEEP_0__의 암호화 기능을 사용 중이라면만약 __CAPGO_KEEP_0__의 암호화 기능을 사용 중이라면 Capgo’s encryption feature__CAPGO_KEEP_0__
설정 후 로컬에서 암호화 키를 설정한 후 Azure DevOps 변수에 개인 키를 추가하세요:
# Display your private key content (copy this output)cat .capgo_key_v2변수 그룹에 다음 내용을 추가하세요 (비밀으로 표시) 및 PIPELINES에서 사용하세요: CAPGO_PRIVATE_KEY 클립보드에 복사
# 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'다중 채널 구성
다중 채널 구성다중 채널을 설정하고 관리하는 데 대한 자세한 정보는 채널 문서.
다중 환경과 pull request 배포를 포함한 완전한 구성:
# Advanced Azure DevOps Pipeline with Multiple Channelstrigger: 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 environmentsparameters: - 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:
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 }})'Branch-Based 배포 전략
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)'클립보드 복사
보안 최적화 방법보안 변수 관리
보안 변수 관리- 변수 그룹 사용__CAPGO_KEEP_0__ 변수를 Azure DevOps 변수 그룹에 저장
- __CAPGO_KEEP_0__ 토큰과 키를 항상 비밀 변수로 표시: Always mark API tokens and keys as secret variables
- __CAPGO_KEEP_0__ 변수 그룹의 접근 범위를 특정 PIPELINES 및 사용자에게 제한키 회전
- __CAPGO_KEEP_0__ __CAPGO_KEEP_1__ 토큰을 정기적으로 회전: Regularly rotate your Capgo API tokens
보안 최적화 방법
모니터링 및 알림팀 통합
팀 통합pipeline에 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이(가) 없습니다.
# 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'디버그 PIPELINE
디버그 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'다음 단계
다음 단계- 알아보기 채널 다양한 배포 환경을 관리하기 위해
- 탐색 고급 배포 시나리오를위한 사용자 정의 저장소 설정
- 보안 배포를위한 암호화 설정 업데이트 동작
- __CAPGO_KEEP_0__ __CAPGO_KEEP_0__ 업데이트를 적용하는 방법을 맞춤화 하기 위해
Capgo 배포를 자동화하고 Azure DevOps 통합을 통해 안정적이고 신뢰할 수 있는 업데이트를 모바일 앱 사용자에게 제공할 수 있습니다.