Kelola Kredensial
Salin prompt setup yang berisi langkah install dan panduan markdown lengkap untuk plugin ini.
Kelola kredensial build iOS dan Android Anda secara lokal untuk kemudahan cloud build.
Ikhtisar
Bagian berjudul “Ringkasan”Capgo CLI menyimpan kredensial build Anda di mesin Anda — tidak pernah di server Capgo. Secara default, kredensial disimpan dalam satu global file, ~/.capgo-credentials/credentials.json, yang digunakan untuk semua proyek Anda. Gunakan --local untuk menyimpannya secara per-proyek di .capgo-credentials.json sebagai gantinya. Saat Anda menjalankan build, kredensial yang tersimpan akan digunakan secara otomatis dan dikirim dengan aman ke Capgo, lalu dihapus setelah build selesai.
Perintah
Bagian berjudul “Commands”Kelola Kredensial secara Interaktif
Bagian berjudul “Kelola Kredensial secara Interaktif”Cara tercepat untuk mengelola kredensial tersimpan adalah lewat interactive manager. Ini membuka TUI (yang sama dengan yang build init Anda gunakan) untuk menelusuri apa yang tersimpan, melihat konfigurasi per app dan platform, mengekspor file siap CI/CD, .env atau menghapus kredensial sebuah platform:
bunx @capgo/cli@latest build credentials manage| Opsi | Deskripsi |
|---|---|
--appId <appId> | App yang dikelola (diminta memilih jika tidak diisi) |
--platform <ios|android> | Platform yang dikelola (diminta memilih jika tidak diisi) |
--local | Gunakan pengaturan per-project .capgo-credentials.json alih-alih menggunakan file global |
Lebih suka perintah satu kali yang bisa di-script? Gunakan perintah individual di bawah ini.
Simpan Kredensial
Bagian berjudul “Simpan Credentials”Simpan build credentials Anda secara lokal untuk penggunaan otomatis:
bunx @capgo/cli@latest build credentials save --platform <ios|android> [options]Perbarui Kredensial
Bagian berjudul “Update Credentials”Perbarui sebagian kredensial yang ada tanpa harus memasukkan semuanya kembali:
bunx @capgo/cli@latest build credentials update --platform <ios|android> [options]Panduan update penggunaan command Penggabungan aditif untuk provisioning profile — profil baru digabungkan dengan yang sudah ada. Untuk mengganti seluruh provisioning map, tambahkan --overwrite-ios-provisioning-map.
Contoh — tambahkan extension profile ke credentials yang sudah ada:
bunx @capgo/cli@latest build credentials update \ --platform ios \ --ios-provisioning-profile "com.example.app.widget=./widget_profile.mobileprovision"Perintah update menerima opsi yang sama dengan save tapi semuanya opsional — hanya field yang Anda isi yang akan di-update.
Daftar credentials
Bagian berjudul “Daftar credentials”Lihat credentials yang tersimpan saat ini (password disamarkan):
bunx @capgo/cli@latest build credentials list
# List credentials for a specific appbunx @capgo/cli@latest build credentials list --appId com.example.appHapus Kredensial
Bagian berjudul “Hapus Kredensial”Hapus kredensial yang tersimpan dari mesin lokal Anda:
# Clear all credentialsbunx @capgo/cli@latest build credentials clear
# Clear credentials for a specific app + platformbunx @capgo/cli@latest build credentials clear --appId com.example.app --platform iosMigrasi Kredensial
Bagian berjudul “Migrasi Kredensial”Konversi format single-profile lama ke format multi-target baru:
bunx @capgo/cli@latest build credentials migrate --platform iosPerintah migrate mendeteksi BUILD_PROVISION_PROFILE_BASE64 kredensial lama, mengonversinya ke format baru CAPGO_IOS_PROVISIONING_MAP, lalu menghapus kunci lama. Lihat Migrasi dari Single Profile detailnya.
Menyimpan Kredensial iOS
Bagian berjudul “Menyimpan Kredensial iOS”Contoh lengkap
Bagian berjudul “Contoh Lengkap”bunx @capgo/cli@latest build credentials save \ --platform ios \ --certificate ./cert.p12 \ --p12-password "YourP12Password" \ --ios-provisioning-profile "com.example.app=./profile.mobileprovision" \ --apple-key ./AuthKey_ABC1234567.p8 \ --apple-key-id "ABC1234567" \ --apple-issuer-id "00000000-0000-0000-0000-000000000000" \ --apple-team-id "TEAM123456"Opsi iOS
Bagian berjudul “Opsi iOS”| Opsi | Deskripsi | Wajib |
|---|---|---|
--certificate <path> | Path ke file sertifikat .p12 | Ya (release) |
--p12-password <password> | Password untuk sertifikat .p12 | Ya (release) |
--ios-provisioning-profile <mapping> | Mapping provisioning profile (bundleId=path). Dapat diulang untuk aplikasi multi-target. Jika hanya ada satu profil dan tanpa awalan bundleId, CLI akan terdeteksi otomatis dari profil tersebut. | Ya (release) |
--apple-key <path> | Path ke kunci .p8 App Store Connect API | Lihat catatan¹ |
--apple-key-id <id> | ID Kunci App Store Connect API | Lihat catatan¹ |
--apple-issuer-id <id> | App Store Connect API Issuer ID (UUID) | Lihat catatan¹ |
--apple-team-id <id> | Team ID App Store Connect | Ya |
--apple-id <email> | Email Apple ID untuk upload app-specific password (alternatif untuk kunci API) | Lihat catatan² |
--apple-app-specific-password <password> | Kata sandi khusus aplikasi (xxxx-xxxx-xxxx-xxxx) | Lihat catatan² |
--apple-app-id <id> | ID aplikasi App Store Connect numerik (misal. 1234567890) | Lihat catatan² |
--ios-distribution <mode> | Mode distribusi: app_store (default) atau ad_hoc | Tidak |
--output-upload | Aktifkan link download Capgo berbatas waktu untuk build artifact | Tidak (default: false) |
--output-retention <seconds> | Berapa lama output build disimpan (misal. 3600s) | Tidak (default: 3600s) |
--skip-build-number-bump | Lewati penambahan nomor build otomatis | Tidak |
Data yang Disimpan
Bagian berjudul “Apa yang Disimpan”Saat Anda menyimpan kredensial iOS, CLI:
- Membaca file sertifikat dan provisioning profile
- Mengonversinya ke encoding base64
- Menyimpannya ke
~/.capgo-credentials/credentials.json(atau.capgo-credentials.jsondengan--local) - Menyimpan password dan ID sebagai plain text (hanya file lokal)
Struktur file yang disimpan:
{ "ios": { "BUILD_CERTIFICATE_BASE64": "...", "CAPGO_IOS_PROVISIONING_MAP": "{\"com.example.app\":{\"profile\":\"...\",\"name\":\"match AppStore com.example.app\"}}", "APPLE_KEY_CONTENT": "...", "P12_PASSWORD": "...", "APPLE_KEY_ID": "ABC1234567", "APPLE_ISSUER_ID": "...", "APP_STORE_CONNECT_TEAM_ID": "TEAM123456", "CAPGO_IOS_DISTRIBUTION": "app_store" }}Menyimpan Kredensial Android
Bagian berjudul “Menyimpan Kredensial Android”Contoh lengkap
Bagian berjudul “Contoh Lengkap”bunx @capgo/cli@latest build credentials save \ --platform android \ --keystore ./release.keystore \ --keystore-alias "my-key-alias" \ --keystore-key-password "KeyPassword123" \ --keystore-store-password "StorePassword123" \ --play-config ./play-store-service-account.jsonOpsi Android
Bagian berjudul “Opsi Android”| Opsi | Deskripsi | Wajib |
|---|---|---|
--keystore <path> | Path ke file .keystore atau .jks | Ya (release) |
--keystore-alias <alias> | Alias key di dalam keystore | Ya (release) |
--keystore-key-password <password> | Password untuk alias key | Ya (release) |
--keystore-store-password <password> | Password untuk keystore | Ya (release) |
--play-config <path> | Path ke JSON service account Play Store | Ya (submission) |
Data yang Disimpan
Bagian berjudul “What Gets Stored”Saat Anda menyimpan kredensial Android, CLI:
- Membaca file keystore dan JSON service account
- Mengonversinya ke encoding base64
- Menyimpannya ke
~/.capgo-credentials/credentials.json(atau.capgo-credentials.jsondengan--local) - Menyimpan password dan alias sebagai teks biasa (hanya file lokal)
Struktur file yang disimpan:
{ "android": { "ANDROID_KEYSTORE_FILE": "...", "PLAY_CONFIG_JSON": "...", "KEYSTORE_KEY_ALIAS": "my-key-alias", "KEYSTORE_KEY_PASSWORD": "...", "KEYSTORE_STORE_PASSWORD": "..." }}Menggunakan Kredensial Tersimpan
Bagian berjudul “Menggunakan Kredensial Tersimpan”Setelah kredensial disimpan, mereka akan otomatis digunakan saat Anda melakukan build:
# Credentials automatically loaded from ~/.capgo-credentials/credentials.jsonbunx @capgo/cli@latest build request com.example.app --platform iosAnda juga bisa menimpa kredensial tersimpan menggunakan environment variables:
# Environment variables take precedence over saved credentialsBUILD_CERTIFICATE_BASE64="..." \P12_PASSWORD="different-password" \bunx @capgo/cli@latest build request com.example.app --platform iosUrutan prioritas:
- Variabel lingkungan (prioritas tertinggi)
- Kredensial tersimpan (
~/.capgo-credentials/credentials.json, atau lokal.capgo-credentials.json) - Tanpa kredensial (prioritas terendah)
Melihat Kredensial Tersimpan
Bagian berjudul “Melihat Kredensial Tersimpan”Tampilkan kredensial yang telah Anda simpan:
bunx @capgo/cli@latest build credentials listContoh output:
📋 Saved Build Credentials:
iOS Credentials: ✓ Certificate (base64) ✓ Provisioning Map (JSON) ✓ Apple Key Content (base64) ✓ P12 Password: ******** ✓ Apple Key ID: ABC1234567 ✓ Apple Issuer ID: 00000000-0000-0000-0000-000000000000 ✓ Team ID: TEAM123456
Android Credentials: ✓ Keystore (base64) ✓ Play Store Config (base64) ✓ Keystore Alias: my-key-alias ✓ Key Password: ******** ✓ Store Password: ********
Location: ~/.capgo-credentials/credentials.json
🔒 These credentials are stored locally on your machine only. When building, they are sent to Capgo but NEVER stored there. They are auto-deleted after build completion.Praktik Terbaik Keamanan
Bagian berjudul “Praktik Terbaik Keamanan”Keamanan Local Storage
Bagian berjudul “Keamanan Local Storage”-
Permission File
Jendela terminal # Global credentials directory + filechmod 700 ~/.capgo-credentialschmod 600 ~/.capgo-credentials/credentials.json# Local (per-project) credentials, if you use --localchmod 600 .capgo-credentials.json -
Jangan Pernah Commit Credentials
Jendela terminal # Ignore the per-project credentials file (used with --local)echo ".capgo-credentials.json" >> .gitignoreFile global berada di direktori home Anda, di luar repo.
-
Pisahkan Credentials
- Gunakan credentials berbeda untuk development lokal vs CI/CD
- Rotasi kredensial secara berkala
- Jangan berbagi kredensial antar anggota tim
Penggunaan CI/CD
Bagian berjudul “Penggunaan CI/CD”Untuk lingkungan CI/CD, utamakan environment variables daripada kredensial yang tersimpan.
Ekspor .env yang siap pakai .env (direkomendasikan)
Bagian berjudul “Ekspor .env yang siap pakai (direkomendasikan)”Daripada melakukan base64-encoding pada setiap file kredensial secara manual (lihat di bawah), biarkan build credentials manage membuatkan filenya untuk Anda:
bunx @capgo/cli@latest build credentials manage# pick your app → choose "Export to .env"Ini menulis sebuah .env.capgo.<appId>.<platform> file (izin akses) 0600) yang berisi setiap kredensial tersimpan sebagai environment variable — setiap baris adalah satu secret untuk ditambahkan ke provider CI/CD Anda. Kedua platform digabungkan secara default; tambahkan --platform ios atau --platform android untuk membatasinya ke satu platform saja.
Referensi Lengkap Environment Variables
Bagian berjudul “Referensi Lengkap Environment Variables”CLI membaca environment variables berikut untuk kredensial:
Kredensial iOS:
| Variabel | Deskripsi | Format | Wajib |
|---|---|---|---|
BUILD_CERTIFICATE_BASE64 | Sertifikat P12/PKCS12 untuk signing code | Base64 | Ya (release) |
CAPGO_IOS_PROVISIONING_MAP | Map JSON dari bundle ID ke data provisioning profile | String JSON | Ya (release) |
P12_PASSWORD | Password untuk sertifikat P12 | Teks biasa | Opsional |
APPLE_KEY_ID | ID Kunci App Store Connect API | String (contoh: “ABC1234567”) | Lihat catatan¹ |
APPLE_ISSUER_ID | API Issuer ID App Store Connect | String UUID | Lihat catatan¹ |
APPLE_KEY_CONTENT | Key App Store Connect API (.isi file .p8) | Base64 | Lihat catatan¹ |
APP_STORE_CONNECT_TEAM_ID | Apple Developer Team ID | String (contoh: “XXXXXXXXXX”) | Ya |
CAPGO_IOS_DISTRIBUTION | Mode distribusi: app_store (default) atau ad_hoc | String | Tidak |
Kredensial Android:
| Variabel | Deskripsi | Format | Wajib |
|---|---|---|---|
ANDROID_KEYSTORE_FILE | File keystore untuk signing APK/AAB | Base64 | Ya (release) |
KEYSTORE_KEY_ALIAS | Alias key di dalam keystore | String | Ya (release) |
KEYSTORE_KEY_PASSWORD | Password untuk alias key | Teks biasa | Ya* |
KEYSTORE_STORE_PASSWORD | Password untuk file keystore | Teks biasa | Ya* |
PLAY_CONFIG_JSON | JSON Google Play service account | Base64 | Ya (submission) |
*Jika hanya satu password yang diberikan, akan digunakan untuk keduanya KEYSTORE_KEY_PASSWORD dan KEYSTORE_STORE_PASSWORD.
Contoh GitHub Actions
Bagian berjudul “Contoh GitHub Actions”name: Cloud Build
on: push: branches: [main]
jobs: build-ios: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: oven-sh/setup-bun@v2 - run: bun install - run: bunx @capgo/cli@latest build request com.example.app --platform ios env: CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }} BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} CAPGO_IOS_PROVISIONING_MAP: ${{ secrets.CAPGO_IOS_PROVISIONING_MAP }} P12_PASSWORD: ${{ secrets.P12_PASSWORD }} APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
build-android: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: oven-sh/setup-bun@v2 - run: bun install - run: bunx @capgo/cli@latest build request com.example.app --platform android env: CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }} ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE_FILE }} KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }} PLAY_CONFIG_JSON: ${{ secrets.PLAY_CONFIG_JSON }}Menyiapkan Nilai Base64
Bagian berjudul “Menyiapkan Nilai Base64”Untuk mengonversi file kredensial Anda ke base64 untuk secret CI/CD:
# iOS Certificate (.p12)base64 -i certificate.p12 | tr -d '\n' > certificate_base64.txt
# iOS Provisioning Profiles — use the CLI to generate CAPGO_IOS_PROVISIONING_MAP:bunx @capgo/cli@latest build credentials save --platform ios \ --ios-provisioning-profile "com.example.app=./profile.mobileprovision" \ # ... other options# Then copy CAPGO_IOS_PROVISIONING_MAP from ~/.capgo-credentials/credentials.json to your CI secrets
# iOS App Store Connect Key (.p8)base64 -i AuthKey_XXXXXX.p8 | tr -d '\n' > apple_key_base64.txt
# Android Keystore (.keystore or .jks)base64 -i release.keystore | tr -d '\n' > keystore_base64.txt
# Google Play Service Account JSONbase64 -i play-store-service-account.json | tr -d '\n' > play_config_base64.txtMengapa Environment Variable Lebih Aman
Bagian berjudul “Mengapa Environment Variable Lebih Aman”Pendekatan ini lebih aman karena:
- Secrets dikelola oleh platform CI/CD Anda
- Tidak ada file kredensial di runner
- Rotasi dan kontrol akses yang mudah
- Audit trail untuk penggunaan secret
Rotasi Kredensial
Bagian berjudul “Rotasi Kredensial”Rotasi kredensial Anda secara berkala:
- iOS: Generate sertifikat dan kunci API baru setiap tahun
- Android: Ubah password keystore setiap tahun
- Setelah ada perubahan tim: Rotasi saat anggota tim keluar
Update kredensial yang tersimpan:
# Re-run save command with new credentialsbunx @capgo/cli@latest build credentials save --platform ios --certificate ./new-cert.p12 ...Pemecahan Masalah
Bagian berjudul “Troubleshooting”“Kredensial tidak ditemukan”
Bagian berjudul ““Kredensial tidak ditemukan””Jika build menyatakan kredensial tidak ditemukan:
-
Cek apakah kredensial sudah tersimpan:
Jendela terminal bunx @capgo/cli@latest build credentials list -
Simpan kredensial jika belum ada:
Jendela terminal bunx @capgo/cli@latest build credentials save --platform ios ... -
Pastikan file kredensial ada:
Jendela terminal ls -la ~/.capgo-credentials/credentials.json # globalls -la .capgo-credentials.json # local (--local)
“Permission denied” saat membaca kredensial
Bagian berjudul ““Permission denied” saat membaca kredensial”Perbaiki izin file:
chmod 600 ~/.capgo-credentials/credentials.json # globalchmod 600 .capgo-credentials.json # localKredensial tidak digunakan
Bagian berjudul “Credentials tidak digunakan”Pastikan platform yang ditentukan sudah benar:
# Make sure --platform matches saved credentialsbunx @capgo/cli@latest build request com.example.app --platform ios # Uses ios credentialsbunx @capgo/cli@latest build request com.example.app --platform android # Uses android credentialsHapus dan simpan ulang credentials
Bagian berjudul “Hapus dan simpan ulang credentials”Jika credentials tampak rusak:
# Clear all credentialsbunx @capgo/cli@latest build credentials clear
# Save againbunx @capgo/cli@latest build credentials save --platform ios ...Migrasi dari environment variables
Bagian berjudul “Migrasi dari environment variables”Jika Anda saat ini menggunakan environment variables, Anda dapat bermigrasi ke credentials yang tersimpan:
-
Ekstrak variabel lingkungan Anda saat ini
Jendela terminal echo $BUILD_CERTIFICATE_BASE64 # Verify they exist -
Dekode file base64 kembali ke file asli (jika perlu)
Jendela terminal echo "$BUILD_CERTIFICATE_BASE64" | base64 -d > cert.p12echo "$BUILD_PROVISION_PROFILE_BASE64" | base64 -d > profile.mobileprovision -
Simpan menggunakan CLI
Jendela terminal bunx @capgo/cli@latest build credentials save \--platform ios \--certificate ./cert.p12 \--ios-provisioning-profile ./profile.mobileprovision \--p12-password "$P12_PASSWORD" \--apple-key-id "$APPLE_KEY_ID" \--apple-issuer-id "$APPLE_ISSUER_ID" \--apple-team-id "$APP_STORE_CONNECT_TEAM_ID"Jika Anda memiliki kredensial lama yang tersimpan (format tunggal
BUILD_PROVISION_PROFILE_BASE64), jalankan:Jendela terminal bunx @capgo/cli@latest build credentials migrate --platform iosIni mengubah profil tunggal lama menjadi
CAPGO_IOS_PROVISIONING_MAPdan menghapus yang lamaBUILD_PROVISION_PROFILE_BASE64danAPPLE_PROFILE_NAMEkey lama. -
Uji coba build
Jendela terminal bunx @capgo/cli@latest build request com.example.app --platform ios -
Hapus environment variables (opsional)
Jendela terminal unset BUILD_CERTIFICATE_BASE64 BUILD_PROVISION_PROFILE_BASE64
Lokasi File
Bagian berjudul “Lokasi File”Credentials disimpan dalam satu file JSON:
- Global (default):
~/.capgo-credentials/credentials.json— digunakan di semua proyek Anda - Lokal (dengan
--local):.capgo-credentials.jsondi root proyek — menimpa file global untuk proyek tersebut
File akan dibuat otomatis saat pertama kali Anda menyimpan credentials. Tambahkan .capgo-credentials.json ke .gitignore sehingga kredensial per-proyek tidak akan pernah ter-commit.
Langkah Berikutnya
Bagian berjudul “Langkah Selanjutnya”- Panduan Memulai - Buat build pertama Anda
- Build iOS - Konfigurasi build khusus iOS
- Build Android - Konfigurasi build khusus Android
- Pemecahan Masalah - Masalah umum dan solusinya
Butuh bantuan?
Bagian berjudul “Butuh bantuan?”Lanjutkan dari Mengelola Kredensial
Bagian berjudul “Lanjutkan dari Managing Credentials”Jika Anda menggunakan Kelola Kredensial untuk merencanakan otomatisasi CI/CD, hubungkan dengan CI/CD Capgo untuk workflow produk di Capgo CI/CD, Capgo Native Build untuk workflow produk di Capgo Native Builds, Integrasi Capgo untuk alur kerja produk di Integrasi Capgo, Integrasi CI/CD untuk detail implementasi di Integrasi CI/CD, dan Integrasi GitHub Actions untuk detail implementasi di Integrasi GitHub Actions.