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 설정 섹션1단계: PIPELINE 변수 생성
1단계: PIPELINE 변수 생성 섹션먼저, Azure DevOps 프로젝트에서 필요한 변수를 설정하세요.
- Azure DevOps 프로젝트로 이동하세요.
- Azure DevOps로 이동하세요. PIPELINES → 라이브러리 → 변수 그룹
- 변수 그룹 생성
Capgo-Variables - 변수 추가:
| 변수 이름 | 값 | 보안 |
|---|---|---|
CAPGO_TOKEN | Capgo API 토큰을 보유하고 있습니다. | ✅ Yes |
기본 설정: 매인 branch로 push될 때마다 프로덕션으로 배포됩니다.
# 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 “기능 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'__CAPGO_KEEP_0__ 암호화 기능을 사용 중이라면, CI/CD 환경에서 개인 키를 안전하게 저장해야 합니다. Capgo’s encryption feature터미널 창
클립보드에 복사 __CAPGO_KEEP_0__ __CAPGO_KEEP_0__
# Display your private key content (copy this output)cat .capgo_key_v2이 콘텐츠를 Azure DevOps 변수 그룹 (비밀으로 표시) 에 추가하세요, 그런 다음 pipeline에서 사용하세요: CAPGO_PRIVATE_KEY Azure DevOps 변수 그룹 (비밀으로 표시) 에 다음 콘텐츠를 추가하세요, 그런 다음 pipeline에서 사용하세요:
# 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 }})'__CAPGO_KEEP_1__
__CAPGO_KEEP_2____CAPGO_KEEP_3__
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_4__
__CAPGO_KEEP_5____CAPGO_KEEP_6__
__CAPGO_KEEP_7__- __CAPGO_KEEP_8____CAPGO_KEEP_9__
- __CAPGO_KEEP_10__: API 변수를 항상 표시하세요.
- Scope Access: 특정 pipeline 및 사용자에 한하여 변수 그룹 접근을 제한하세요.
- Rotate Keys: Capgo API 변수를 정기적으로 회전하세요.
Monitoring and Notifications
모니터링 및 알림Teams Integration
팀 통합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)문제 해결
이름: 문제 해결일반적인 문제
이름: 일반적인 문제pipeline이 “Capgo CLI not found”와 같은 오류를 발생시키면:
# 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'__CAPGO_KEEP_1__
__CAPGO_KEEP_2____CAPGO_KEEP_3__
- 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_4__
__CAPGO_KEEP_5__- __CAPGO_KEEP_6__ __CAPGO_KEEP_7__ __CAPGO_KEEP_8__
- __CAPGO_KEEP_9__ __CAPGO_KEEP_10__ 고급 배포 시나리오를 위해
- 설정 암호화 안전한 배포를 위해
- 설정 업데이트 동작 업데이트가 적용되는 방법을 커스터마이즈하기 위해
Capgo 배포를 자동화하고 안정적이고 일관된 업데이트를 모바일 앱 사용자에게 제공할 수 있습니다.
Azure DevOps 통합에서 계속
Azure DevOps 통합에서 계속하기Azure DevOps 통합을 사용하고 있다면 Azure DevOps 통합 CI/CD 자동화 계획을 수립하기 위해 연결하세요. Capgo CI/CD Capgo CI/CD에서 제품 워크플로우를 위해 Capgo 네이티브 빌드 Capgo 네이티브 빌드에서 제품 워크플로우를 위해 Capgo 통합 Capgo 통합에서 제품 워크플로우를 위해 CI/CD 통합 CI/CD 통합 구현 세부 사항에 대해 GitHub 액션 통합 GitHub 액션 통합 구현 세부 사항에 대해