Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): add GitOps landing page (#19434)
rebelice55cc903edfbd
diff --git a/frontend/src/assets/gitops-workflow.svg b/frontend/src/assets/gitops-workflow.svgnew file mode 100644index 0000000000..6695e403cb--- /dev/null+++ b/frontend/src/assets/gitops-workflow.svg@@ -0,0 +1,163 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1020 290" fill="none">+ <style>+ .phase { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; }+ .title { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 13px; font-weight: 600; }+ .desc { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 11px; fill: #6B7280; }+ .badge { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.05em; }+ .trans { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 9px; font-weight: 600; }+ .db-label { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 10px; font-weight: 500; fill: #374151; }+ .connector { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 9px; fill: #9CA3AF; }+ </style>++ <!-- Reusable logos -->+ <defs>+ <!-- GitHub logo (viewBox 0 0 26 26, scaled to fit 16x16) -->+ <symbol id="github" viewBox="0 0 26 26">+ <path fill-rule="evenodd" clip-rule="evenodd" d="M13 0.324219C5.85 0.324219 0 6.17422 0 13.3242C0 19.093 3.7375 23.968 8.85625 25.6742C9.50625 25.7555 9.75 25.4305 9.75 25.0242C9.75 24.6992 9.75 23.8867 9.75 22.8305C6.09375 23.643 5.3625 21.1242 5.3625 21.1242C4.79375 19.6617 3.9 19.2555 3.9 19.2555C2.68125 18.443 3.98125 18.443 3.98125 18.443C5.28125 18.5242 6.0125 19.743 6.0125 19.743C7.15 21.693 9.01875 21.1242 9.83125 20.7992C9.9125 19.9867 10.3188 19.418 10.6438 19.093C7.71875 18.768 4.7125 17.6305 4.7125 12.6742C4.7125 11.293 5.2 10.0742 6.0125 9.18047C5.85 8.85547 5.44375 7.55547 6.175 5.76797C6.175 5.76797 7.23125 5.44297 9.75 7.06797C10.8062 6.74297 11.8625 6.66172 13 6.66172C14.1375 6.66172 15.1938 6.82422 16.25 7.06797C18.7687 5.36172 19.825 5.68672 19.825 5.68672C20.5562 7.47422 20.0688 8.77422 19.9875 9.09922C20.8 9.99297 21.2875 11.1305 21.2875 12.593C21.2875 17.5492 18.2812 18.6867 15.3562 19.0117C15.8438 19.418 16.25 20.2305 16.25 21.4492C16.25 23.1555 16.25 24.618 16.25 25.0242C16.25 25.3492 16.4937 25.7555 17.1438 25.6742C22.2625 23.968 26 19.093 26 13.3242C26 6.17422 20.15 0.324219 13 0.324219Z" fill="currentColor"/>+ </symbol>+ <!-- Bytebase logo (viewBox 0 0 160 160, scaled to fit) -->+ <symbol id="bytebase" viewBox="0 0 160 160">+ <path d="M46.1905 152.505C29.9046 144.91 16.6497 132.054 8.56169 116.008C0.473633 99.9615 -1.97652 81.6593 1.60602 64.0506C5.18857 46.4418 14.5952 30.5519 28.3101 18.9414C42.025 7.33087 59.2495 0.675864 77.208 0.0487342C95.1666 -0.578395 112.813 4.85888 127.305 15.4844C141.796 26.11 152.288 41.3049 157.09 58.6209C161.893 75.9369 160.725 94.3654 153.776 110.937C146.827 127.508 134.501 141.258 118.785 149.97L80 80L46.1905 152.505Z" fill="#111827"/>+ <path d="M118.708 150.012C107.686 156.106 95.3806 159.511 82.7937 159.951C70.2068 160.391 57.694 157.853 46.2734 152.543L80 80L118.708 150.012Z" fill="white"/>+ <path d="M35 47.0375L125.88 47.0375L125.88 85.4375C125.88 95.4215 123.533 102.931 118.84 107.965C114.232 113.086 108.259 115.646 100.92 115.646C96.2267 115.646 92.1307 114.494 88.632 112.19C85.2187 109.971 82.616 106.899 80.824 102.974C79.2027 107.24 76.6427 110.611 73.144 113.086C69.6453 115.646 65.5067 116.926 60.728 116.926C52.7067 116.926 46.392 114.366 41.784 109.246C37.2613 104.126 35 96.7442 35 87.1015L35 47.0375ZM109.112 65.2135L89.4 65.2135V85.3095C89.4 88.9788 90.2107 91.7948 91.832 93.7575C93.5387 95.8055 96.0133 96.8295 99.256 96.8295C102.157 96.8295 104.504 95.8482 106.296 93.8855C108.173 92.0082 109.112 89.1495 109.112 85.3095L109.112 65.2135ZM72.504 65.2135H51.768V86.5895C51.768 90.4295 52.664 93.2882 54.456 95.1655C56.248 97.1282 58.808 98.1095 62.136 98.1095C65.2933 98.1095 67.8107 97.1282 69.688 95.1655C71.5653 93.2882 72.504 90.4295 72.504 86.5895V65.2135Z" fill="white"/>+ </symbol>+ </defs>++ <!-- Background -->+ <rect width="1020" height="290" rx="12" fill="#FAFAFA" stroke="#E5E7EB" stroke-width="1"/>++ <!-- ═══════════════════════════════ -->+ <!-- COL 1: DEVELOP (18–178) -->+ <!-- ═══════════════════════════════ -->++ <text x="98" y="28" text-anchor="middle" class="phase" fill="#374151">DEVELOP</text>++ <g transform="translate(18, 42)">+ <rect x="0" y="0" width="160" height="68" rx="8" fill="white" stroke="#E5E7EB" stroke-width="1.5"/>+ <!-- GitHub icon -->+ <g transform="translate(12, 12)">+ <use href="#github" width="16" height="16" color="#24292f"/>+ </g>+ <text x="36" y="24" class="badge" fill="#24292f">GITHUB</text>+ <text x="10" y="44" class="title" fill="#111827">Write SQL files</text>+ <text x="10" y="60" class="desc">migration or schema</text>+ </g>++ <!-- ═══════════════════════════════ -->+ <!-- TRANSITION 1 (178–296) -->+ <!-- ═══════════════════════════════ -->++ <line x1="178" y1="76" x2="294" y2="76" stroke="#D1D5DB" stroke-width="1.5"/>+ <polygon points="290,71 300,76 290,81" fill="#D1D5DB"/>+ <rect x="200" y="82" width="72" height="18" rx="9" fill="#EEF2FF" stroke="#C7D2FE" stroke-width="1"/>+ <text x="236" y="94" text-anchor="middle" class="trans" fill="#4F46E5">PR created</text>++ <!-- ═══════════════════════════════ -->+ <!-- COL 2: CI (302–572) -->+ <!-- ═══════════════════════════════ -->++ <text x="437" y="28" text-anchor="middle" class="phase" fill="#4F46E5">CI</text>++ <rect x="302" y="38" width="270" height="160" rx="10" fill="white" stroke="#C7D2FE" stroke-width="1.5" stroke-dasharray="6 3"/>++ <!-- GitHub row: Create PR -->+ <g transform="translate(316, 52)">+ <rect x="0" y="0" width="242" height="48" rx="8" fill="#F9FAFB" stroke="#E5E7EB" stroke-width="1"/>+ <g transform="translate(12, 14)">+ <use href="#github" width="16" height="16" color="#24292f"/>+ </g>+ <text x="36" y="24" class="title" fill="#111827" font-size="12">Create Pull Request</text>+ <text x="36" y="39" class="desc">Open PR with SQL changes</text>+ </g>++ <!-- Arrow down: triggers -->+ <line x1="437" y1="100" x2="437" y2="130" stroke="#D1D5DB" stroke-width="1.5"/>+ <polygon points="432,127 437,136 442,127" fill="#D1D5DB"/>+ <text x="457" y="120" class="connector">triggers</text>++ <!-- Bytebase row: SQL Review -->+ <g transform="translate(316, 138)">+ <rect x="0" y="0" width="242" height="48" rx="8" fill="#EEF2FF" stroke="#C7D2FE" stroke-width="1"/>+ <g transform="translate(10, 10)">+ <use href="#bytebase" width="22" height="22"/>+ </g>+ <text x="40" y="24" class="title" fill="#312E81" font-size="12">SQL Review</text>+ <text x="40" y="39" class="desc" fill="#4338CA">Check syntax, lint, enforce policy</text>+ </g>++ <!-- Arrow up-left from Bytebase back to GitHub: post review -->+ <path d="M316 162 L286 162 L286 88 L316 88" stroke="#D1D5DB" stroke-width="1.5" fill="none" stroke-dasharray="4 2"/>+ <polygon points="313,83 323,88 313,93" fill="#D1D5DB"/>+ <text x="284" y="132" text-anchor="end" class="connector" font-size="8">post</text>+ <text x="284" y="142" text-anchor="end" class="connector" font-size="8">review</text>++ <!-- ═══════════════════════════════ -->+ <!-- TRANSITION 2 (572–708) -->+ <!-- ═══════════════════════════════ -->++ <line x1="572" y1="76" x2="706" y2="76" stroke="#D1D5DB" stroke-width="1.5"/>+ <polygon points="702,71 712,76 702,81" fill="#D1D5DB"/>+ <rect x="601" y="82" width="72" height="18" rx="9" fill="#DCFCE7" stroke="#86EFAC" stroke-width="1"/>+ <text x="637" y="94" text-anchor="middle" class="trans" fill="#166534">PR merged</text>++ <!-- ═══════════════════════════════ -->+ <!-- COL 3: CD (714–1002) -->+ <!-- ═══════════════════════════════ -->++ <text x="858" y="28" text-anchor="middle" class="phase" fill="#059669">CD</text>++ <rect x="714" y="38" width="288" height="242" rx="10" fill="white" stroke="#A7F3D0" stroke-width="1.5" stroke-dasharray="6 3"/>++ <!-- GitHub row: Merge to branch -->+ <g transform="translate(728, 52)">+ <rect x="0" y="0" width="260" height="48" rx="8" fill="#F9FAFB" stroke="#E5E7EB" stroke-width="1"/>+ <g transform="translate(12, 14)">+ <use href="#github" width="16" height="16" color="#24292f"/>+ </g>+ <text x="36" y="24" class="title" fill="#111827" font-size="12">Merge to branch</text>+ <text x="36" y="39" class="desc">Webhook notifies Bytebase</text>+ </g>++ <!-- Arrow down: triggers -->+ <line x1="858" y1="100" x2="858" y2="130" stroke="#D1D5DB" stroke-width="1.5"/>+ <polygon points="853,127 858,136 863,127" fill="#D1D5DB"/>+ <text x="878" y="120" class="connector">triggers</text>++ <!-- Bytebase row: Create Rollout -->+ <g transform="translate(728, 138)">+ <rect x="0" y="0" width="260" height="48" rx="8" fill="#EEF2FF" stroke="#C7D2FE" stroke-width="1"/>+ <g transform="translate(10, 10)">+ <use href="#bytebase" width="22" height="22"/>+ </g>+ <text x="40" y="24" class="title" fill="#312E81" font-size="12">Create Rollout</text>+ <text x="40" y="39" class="desc" fill="#4338CA">Plan and stage changes</text>+ </g>++ <!-- Arrow down: apply -->+ <line x1="858" y1="186" x2="858" y2="216" stroke="#D1D5DB" stroke-width="1.5"/>+ <polygon points="853,213 858,222 863,213" fill="#D1D5DB"/>+ <text x="878" y="208" class="connector">apply</text>++ <!-- Databases section -->+ <g transform="translate(728, 224)">+ <rect x="0" y="0" width="260" height="46" rx="8" fill="#F9FAFB" stroke="#D1D5DB" stroke-width="1"/>++ <!-- Test DB -->+ <g transform="translate(20, 8)">+ <rect x="0" y="0" width="100" height="30" rx="6" fill="white" stroke="#E5E7EB" stroke-width="1"/>+ <path d="M14,11 C14,8.5 18,6 24,6 C30,6 34,8.5 34,11" stroke="#9CA3AF" stroke-width="0.8" fill="#E5E7EB"/>+ <path d="M14,11 L14,20 C14,22.5 18,25 24,25 C30,25 34,22.5 34,20 L34,11" stroke="#9CA3AF" stroke-width="0.8" fill="#F3F4F6"/>+ <path d="M14,11 C14,13.5 18,16 24,16 C30,16 34,13.5 34,11" stroke="#9CA3AF" stroke-width="0.8" fill="none"/>+ <text x="44" y="19" class="db-label">Test</text>+ </g>++ <!-- Prod DB -->+ <g transform="translate(140, 8)">+ <rect x="0" y="0" width="100" height="30" rx="6" fill="white" stroke="#E5E7EB" stroke-width="1"/>+ <path d="M14,11 C14,8.5 18,6 24,6 C30,6 34,8.5 34,11" stroke="#9CA3AF" stroke-width="0.8" fill="#E5E7EB"/>+ <path d="M14,11 L14,20 C14,22.5 18,25 24,25 C30,25 34,22.5 34,20 L34,11" stroke="#9CA3AF" stroke-width="0.8" fill="#F3F4F6"/>+ <path d="M14,11 C14,13.5 18,16 24,16 C30,16 34,13.5 34,11" stroke="#9CA3AF" stroke-width="0.8" fill="none"/>+ <text x="44" y="19" class="db-label">Prod</text>+ </g>+ </g>+</svg>diff --git a/frontend/src/components/Project/useProjectSidebar.ts b/frontend/src/components/Project/useProjectSidebar.tsindex 87a570611a..04553ccc3c 100644--- a/frontend/src/components/Project/useProjectSidebar.ts+++ b/frontend/src/components/Project/useProjectSidebar.ts@@ -16,6 +16,7 @@ import {PROJECT_V1_ROUTE_DATABASE_GROUPS,PROJECT_V1_ROUTE_DATABASES,PROJECT_V1_ROUTE_EXPORT_CENTER,+ PROJECT_V1_ROUTE_GITOPS,PROJECT_V1_ROUTE_ISSUES,PROJECT_V1_ROUTE_MASKING_EXEMPTION,PROJECT_V1_ROUTE_MEMBERS,@@ -54,6 +55,11 @@ export const useProjectSidebar = (project: MaybeRef<Project>) => {expand: true,hide: isDefaultProject.value,children: [+ {+ title: t("gitops.self"),+ path: PROJECT_V1_ROUTE_GITOPS,+ type: "div",+ },{title: t("plan.plans"),path: PROJECT_V1_ROUTE_PLANS,diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 14eed0d271..6286b0b22a 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2815,6 +2815,39 @@"usage-description": "A release is a versioned application artifact whose deployment to an environment is triggered by a GitOps workflow.","filter-by-category": "Filter by category"},+ "gitops": {+ "self": "GitOps",+ "overview": {+ "description": "Bytebase GitOps lets you manage Database as Code by integrating database schema changes into your CI/CD pipeline.",+ "description-git": "Your database schema lives in Git alongside your application code. Pull requests trigger SQL review, and merging to the target branch automatically creates rollouts."+ },+ "checklist": {+ "title": "Checklist",+ "external-url": "External URL",+ "external-url-missing": "External URL is not configured.",+ "configure": "Configure",+ "workload-identity": "Workload Identity",+ "target-databases": "Target Databases"+ },+ "workload-identity": {+ "select-placeholder": "Select a workload identity",+ "no-identity": "No workload identity found. Create one to get started."+ },+ "workflow": {+ "title": "Workflow File",+ "description": "Copy the workflow files into your repository to automate SQL review and database rollouts.",+ "file-hint": "Save as {filePath} in your repository"+ },+ "test-setup": {+ "title": "Test Your Setup",+ "description": "Verify the workflow is working end-to-end with a sample migration file.",+ "step-create-branch": "Create a new branch, add the file above, and open a pull request targeting {branch}.",+ "step-sql-review": "SQL Review runs automatically on the pull request and posts review comments.",+ "step-merge": "Once the review passes, merge the PR. Bytebase will automatically create a rollout and deploy to the target environments.",+ "naming-convention": "Migration files are applied in lexicographic order. Use a timestamp or sequence prefix, e.g. 20240101000000_create_table.sql. Append _ddl or _dml to indicate the change type."+ },+ "documentation": "View Documentation"+ },"export-data": {"export-rows": "Export rows","error": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 8227d10ebc..07bacc6aeb 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2815,6 +2815,39 @@"usage-description": "Un lanzamiento es un artefacto de aplicación versionado cuyo despliegue a un entorno es activado por un flujo de trabajo GitOps.","filter-by-category": "Filtrar por categoría"},+ "gitops": {+ "self": "GitOps",+ "overview": {+ "description": "Bytebase GitOps le permite gestionar Database as Code integrando los cambios de esquema de base de datos en su pipeline de CI/CD.",+ "description-git": "El esquema de su base de datos se almacena en Git junto con el código de su aplicación. Las pull requests activan la revisión de SQL, y la fusión en la rama de destino crea automáticamente los despliegues."+ },+ "checklist": {+ "title": "Lista de verificación",+ "external-url": "URL externa",+ "external-url-missing": "La URL externa no está configurada.",+ "configure": "Configurar",+ "workload-identity": "Identidad de carga de trabajo",+ "target-databases": "Bases de datos de destino"+ },+ "workload-identity": {+ "select-placeholder": "Seleccionar una identidad de carga de trabajo",+ "no-identity": "No se encontró ninguna identidad de carga de trabajo. Cree una para comenzar."+ },+ "workflow": {+ "title": "Archivo de flujo de trabajo",+ "description": "Copie los archivos de flujo de trabajo en su repositorio para automatizar la revisión de SQL y los despliegues de base de datos.",+ "file-hint": "Guardar como {filePath} en su repositorio"+ },+ "test-setup": {+ "title": "Pruebe su configuración",+ "description": "Verifique que el flujo de trabajo funciona de extremo a extremo con un archivo de migración de ejemplo.",+ "step-create-branch": "Cree una nueva rama, agregue el archivo anterior y abra una pull request dirigida a {branch}.",+ "step-sql-review": "SQL Review se ejecuta automáticamente en la pull request y publica comentarios de revisión.",+ "step-merge": "Una vez que la revisión pase, fusione el PR. Bytebase creará automáticamente un despliegue y lo implementará en los entornos de destino.",+ "naming-convention": "Los archivos de migración se aplican en orden lexicográfico. Use un prefijo de marca de tiempo o secuencia, p. ej. 20240101000000_create_table.sql. Agregue _ddl o _dml para indicar el tipo de cambio."+ },+ "documentation": "Ver documentación"+ },"export-data": {"export-rows": "Exportar filas","error": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 9be2e81c04..4654862ce9 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -2815,6 +2815,39 @@"usage-description": "リリースは、GitOpsワークフローによって環境へのデプロイがトリガーされるバージョン管理されたアプリケーションアーティファクトです。","filter-by-category": "カテゴリでフィルタリング"},+ "gitops": {+ "self": "GitOps",+ "overview": {+ "description": "Bytebase GitOps は、データベーススキーマの変更を CI/CD パイプラインに統合し、Database as Code として管理できます。",+ "description-git": "データベーススキーマはアプリケーションコードと一緒に Git で管理されます。プルリクエストで SQL レビューがトリガーされ、ターゲットブランチへのマージで自動的にロールアウトが作成されます。"+ },+ "checklist": {+ "title": "チェックリスト",+ "external-url": "外部URL",+ "external-url-missing": "外部URLが設定されていません。",+ "configure": "設定",+ "workload-identity": "ワークロードアイデンティティ",+ "target-databases": "ターゲットデータベース"+ },+ "workload-identity": {+ "select-placeholder": "ワークロードアイデンティティを選択",+ "no-identity": "ワークロードアイデンティティが見つかりません。作成して始めましょう。"+ },+ "workflow": {+ "title": "ワークフローファイル",+ "description": "ワークフローファイルをリポジトリにコピーして、SQL レビューとデータベースロールアウトを自動化します。",+ "file-hint": "リポジトリ内に {filePath} として保存"+ },+ "test-setup": {+ "title": "セットアップのテスト",+ "description": "サンプルマイグレーションファイルでワークフロー全体が正常に動作するか確認します。",+ "step-create-branch": "新しいブランチを作成し、上記のファイルを追加して、{branch} へのプルリクエストを作成します。",+ "step-sql-review": "SQL Review がプルリクエストで自動的に実行され、レビューコメントが投稿されます。",+ "step-merge": "レビューが通過したら PR をマージします。Bytebase が自動的にロールアウトを作成し、ターゲット環境にデプロイします。",+ "naming-convention": "マイグレーションファイルは辞書順に適用されます。タイムスタンプまたはシーケンス番号のプレフィックスを使用してください(例: 20240101000000_create_table.sql)。変更タイプを示すために _ddl または _dml を末尾に追加してください。"+ },+ "documentation": "ドキュメントを見る"+ },"export-data": {"export-rows": "エクスポート行数","error": {diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 69f9f61f42..7db0a7b16a 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -2815,6 +2815,39 @@"usage-description": "Bản phát hành là một artifact ứng dụng có phiên bản mà việc triển khai vào môi trường được kích hoạt bởi quy trình GitOps.","filter-by-category": "Lọc theo danh mục"},+ "gitops": {+ "self": "GitOps",+ "overview": {+ "description": "Bytebase GitOps cho phép bạn quản lý Database as Code bằng cách tích hợp các thay đổi schema cơ sở dữ liệu vào pipeline CI/CD.",+ "description-git": "Schema cơ sở dữ liệu của bạn được lưu trữ trong Git cùng với mã nguồn ứng dụng. Pull request sẽ kích hoạt SQL review, và việc merge vào nhánh đích sẽ tự động tạo rollout."+ },+ "checklist": {+ "title": "Danh sách kiểm tra",+ "external-url": "URL bên ngoài",+ "external-url-missing": "URL bên ngoài chưa được cấu hình.",+ "configure": "Cấu hình",+ "workload-identity": "Workload Identity",+ "target-databases": "Cơ sở dữ liệu đích"+ },+ "workload-identity": {+ "select-placeholder": "Chọn một workload identity",+ "no-identity": "Không tìm thấy workload identity. Tạo một cái để bắt đầu."+ },+ "workflow": {+ "title": "Tệp workflow",+ "description": "Sao chép các tệp workflow vào kho lưu trữ của bạn để tự động hóa SQL review và triển khai cơ sở dữ liệu.",+ "file-hint": "Lưu dưới dạng {filePath} trong kho lưu trữ của bạn"+ },+ "test-setup": {+ "title": "Kiểm tra cấu hình",+ "description": "Xác minh workflow hoạt động đầy đủ với một tệp migration mẫu.",+ "step-create-branch": "Tạo nhánh mới, thêm tệp ở trên và mở pull request nhắm đến {branch}.",+ "step-sql-review": "SQL Review tự động chạy trên pull request và đăng nhận xét review.",+ "step-merge": "Sau khi review thông qua, merge PR. Bytebase sẽ tự động tạo rollout và triển khai đến các môi trường đích.",+ "naming-convention": "Các tệp migration được áp dụng theo thứ tự từ điển. Sử dụng tiền tố timestamp hoặc số thứ tự, ví dụ: 20240101000000_create_table.sql. Thêm _ddl hoặc _dml để chỉ loại thay đổi."+ },+ "documentation": "Xem tài liệu"+ },"export-data": {"export-rows": "Xuất số dòng","error": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 43f5346329..ef679af2e2 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2815,6 +2815,39 @@"usage-description": "发布包是版本化的应用制品。GitOps 工作流将发布包部署到环境。","filter-by-category": "按类别过滤"},+ "gitops": {+ "self": "GitOps",+ "overview": {+ "description": "Bytebase GitOps 让您通过将数据库架构变更集成到 CI/CD 流水线中,以 Database as Code 的方式管理数据库。",+ "description-git": "数据库架构与应用代码一起存储在 Git 中。拉取请求会触发 SQL 审查,合并到目标分支后会自动创建变更发布。"+ },+ "checklist": {+ "title": "检查清单",+ "external-url": "外部访问地址",+ "external-url-missing": "尚未配置外部访问地址。",+ "configure": "去配置",+ "workload-identity": "工作负载身份",+ "target-databases": "目标数据库"+ },+ "workload-identity": {+ "select-placeholder": "选择工作负载身份",+ "no-identity": "未找到工作负载身份,请创建一个以开始使用。"+ },+ "workflow": {+ "title": "工作流文件",+ "description": "将工作流文件复制到您的代码仓库中,以自动化 SQL 审查和数据库变更发布。",+ "file-hint": "保存为仓库中的 {filePath}"+ },+ "test-setup": {+ "title": "测试您的配置",+ "description": "使用示例迁移文件验证整个工作流是否正常运行。",+ "step-create-branch": "创建新分支,添加上面的文件,然后向 {branch} 提交拉取请求。",+ "step-sql-review": "SQL Review 会自动在拉取请求上运行并发布审查评论。",+ "step-merge": "审查通过后,合并 PR。Bytebase 将自动创建 rollout 并部署到目标环境。",+ "naming-convention": "迁移文件按字典顺序执行。请使用时间戳或序号前缀,例如 20240101000000_create_table.sql。在文件名末尾添加 _ddl 或 _dml 来标识变更类型。"+ },+ "documentation": "查看文档"+ },"export-data": {"export-rows": "导出行数","error": {diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.tsindex 4a1c89c584..2443ac7dbc 100644--- a/frontend/src/router/dashboard/projectV1.ts+++ b/frontend/src/router/dashboard/projectV1.ts@@ -36,6 +36,7 @@ export const PROJECT_V1_ROUTE_ROLLOUTS = `${PROJECT_V1_ROUTE_DASHBOARD}.rolloutsexport const PROJECT_V1_ROUTE_PLAN_ROLLOUT = `${PROJECT_V1_ROUTE_ROLLOUTS}.rollout`;export const PROJECT_V1_ROUTE_PLAN_ROLLOUT_STAGE = `${PROJECT_V1_ROUTE_PLAN_ROLLOUT}.stage`;export const PROJECT_V1_ROUTE_PLAN_ROLLOUT_TASK = `${PROJECT_V1_ROUTE_PLAN_ROLLOUT_STAGE}.task`;+export const PROJECT_V1_ROUTE_GITOPS = `${PROJECT_V1_ROUTE_DASHBOARD}.gitops`;const issueRoutes: RouteRecordRaw[] = [{@@ -463,6 +464,15 @@ const projectV1Routes: RouteRecordRaw[] = [},],},+ {+ path: "gitops",+ name: PROJECT_V1_ROUTE_GITOPS,+ meta: {+ title: () => t("gitops.self"),+ },+ component: () => import("@/views/project/ProjectGitOpsDashboard.vue"),+ props: true,+ },...issueRoutes,...rolloutRoutes,],diff --git a/frontend/src/views/project/ProjectGitOpsDashboard.vue b/frontend/src/views/project/ProjectGitOpsDashboard.vuenew file mode 100644index 0000000000..e8982675f6--- /dev/null+++ b/frontend/src/views/project/ProjectGitOpsDashboard.vue@@ -0,0 +1,771 @@+<template>+ <div class="w-full px-4 flex flex-col gap-y-6 py-4">+ <!-- Header -->+ <div>+ <h2 class="text-lg font-medium">{{ $t("gitops.self") }}</h2>+ <p class="textinfolabel mt-1">+ {{ $t("gitops.overview.description") }}+ </p>+ <p class="textinfolabel mt-1">+ {{ $t("gitops.overview.description-git") }}+ </p>+ </div>++ <!-- Workflow diagram -->+ <img+ :src="gitopsWorkflowImage"+ alt="GitOps Workflow"+ class="w-full max-w-4xl"+ />++ <!-- Part 1: Checklist -->+ <div class="flex flex-col gap-y-1">+ <h2 class="text-lg font-medium mb-2">+ {{ $t("gitops.checklist.title") }}+ </h2>++ <!-- Check 1: External URL -->+ <div class="flex items-start gap-x-3 py-3">+ <CheckIcon+ v-if="hasExternalUrl"+ class="w-5 h-5 text-success shrink-0 mt-0.5"+ />+ <MinusCircleIcon+ v-else+ class="w-5 h-5 text-warning shrink-0 mt-0.5"+ />+ <div class="flex flex-col gap-y-1">+ <span class="text-sm font-medium">{{+ $t("gitops.checklist.external-url")+ }}</span>+ <span v-if="hasExternalUrl" class="text-sm text-control-light">+ {{ bytebaseUrl }}+ </span>+ <div v-else class="flex items-center gap-x-2">+ <span class="text-sm text-warning">+ {{ $t("gitops.checklist.external-url-missing") }}+ </span>+ <NButton+ v-if="hasSettingPermission"+ size="small"+ @click="goToGeneralSettings"+ >+ {{ $t("gitops.checklist.configure") }}+ </NButton>+ </div>+ </div>+ </div>++ <!-- Check 2: Workload Identity -->+ <div class="flex items-start gap-x-3 py-3">+ <CheckIcon+ v-if="selectedIdentityEmail"+ class="w-5 h-5 text-success shrink-0 mt-0.5"+ />+ <MinusCircleIcon+ v-else+ class="w-5 h-5 text-warning shrink-0 mt-0.5"+ />+ <div class="flex flex-col gap-y-2 flex-1">+ <span class="text-sm font-medium">{{+ $t("gitops.checklist.workload-identity")+ }}</span>+ <div class="flex items-center gap-x-3">+ <NSelect+ v-model:value="selectedIdentityEmail"+ :options="identityOptions"+ :placeholder="+ $t('gitops.workload-identity.select-placeholder')+ "+ clearable+ class="max-w-md"+ />+ <NButton @click="showCreateDrawer = true">+ {{ $t("common.create") }}+ </NButton>+ </div>+ <p+ v-if="identityOptions.length === 0 && !isLoading"+ class="text-sm text-control-light"+ >+ {{ $t("gitops.workload-identity.no-identity") }}+ </p>+ <a+ v-if="repoUrl"+ :href="repoUrl"+ target="_blank"+ class="text-sm text-accent hover:underline"+ >+ {{ repoUrl }} →+ </a>+ </div>+ </div>++ <!-- Check 3: Target Databases -->+ <div class="flex items-start gap-x-3 py-3">+ <CheckIcon+ v-if="selectedDatabaseNames.length > 0"+ class="w-5 h-5 text-success shrink-0 mt-0.5"+ />+ <MinusCircleIcon+ v-else+ class="w-5 h-5 text-warning shrink-0 mt-0.5"+ />+ <div class="flex flex-col gap-y-2 flex-1">+ <span class="text-sm font-medium">{{+ $t("gitops.checklist.target-databases")+ }}</span>+ <div class="max-w-md">+ <DatabaseSelect+ v-model:value="selectedDatabaseNames"+ :project-name="projectName"+ :multiple="true"+ />+ </div>+ <p+ v-if="targetsString"+ class="text-sm text-control-light"+ >+ <span class="font-medium">targets:</span>+ <code class="text-xs bg-gray-100 px-1 py-0.5 rounded">{{+ targetsString+ }}</code>+ </p>+ </div>+ </div>+ </div>++ <!-- Part 2: Workflow File -->+ <div class="flex flex-col gap-y-3">+ <h2 class="text-lg font-medium">+ {{ $t("gitops.workflow.title") }}+ </h2>+ <p class="text-sm text-control-light">+ {{ $t("gitops.workflow.description") }}+ </p>++ <!-- Runner type toggle -->+ <div class="flex items-center gap-x-3">+ <span class="text-sm font-medium">Runner:</span>+ <NRadioGroup v-model:value="runnerType" size="small">+ <NRadioButton value="self-hosted">Self-hosted</NRadioButton>+ <NRadioButton value="cloud">GitHub / GitLab hosted</NRadioButton>+ </NRadioGroup>+ </div>++ <NTabs v-model:value="activeTab" type="line" animated>+ <NTabPane name="github-actions" tab="GitHub Actions">+ <!-- sql-review.yml -->+ <div class="flex flex-col gap-y-2 mt-3">+ <div class="flex items-center gap-x-2">+ <button+ class="flex items-center gap-x-1 text-sm text-control-light hover:text-control cursor-pointer"+ @click="showSqlReviewYaml = !showSqlReviewYaml"+ >+ <ChevronRightIcon+ v-if="!showSqlReviewYaml"+ class="w-4 h-4"+ />+ <ChevronDownIcon v-else class="w-4 h-4" />+ {{+ $t("gitops.workflow.file-hint", {+ filePath: ".github/workflows/sql-review.yml",+ })+ }}+ </button>+ <CopyButton :content="githubSqlReviewYaml" />+ </div>+ <NInput+ v-show="showSqlReviewYaml"+ :value="githubSqlReviewYaml"+ type="textarea"+ readonly+ :autosize="{ minRows: 10, maxRows: 30 }"+ class="font-mono text-sm"+ />+ </div>+ <!-- release.yml -->+ <div class="flex flex-col gap-y-2 mt-4">+ <div class="flex items-center gap-x-2">+ <button+ class="flex items-center gap-x-1 text-sm text-control-light hover:text-control cursor-pointer"+ @click="showReleaseYaml = !showReleaseYaml"+ >+ <ChevronRightIcon+ v-if="!showReleaseYaml"+ class="w-4 h-4"+ />+ <ChevronDownIcon v-else class="w-4 h-4" />+ {{+ $t("gitops.workflow.file-hint", {+ filePath: ".github/workflows/release.yml",+ })+ }}+ </button>+ <CopyButton :content="githubReleaseYaml" />+ </div>+ <NInput+ v-show="showReleaseYaml"+ :value="githubReleaseYaml"+ type="textarea"+ readonly+ :autosize="{ minRows: 10, maxRows: 30 }"+ class="font-mono text-sm"+ />+ </div>+ </NTabPane>+ <NTabPane name="gitlab-ci" tab="GitLab CI">+ <div class="flex flex-col gap-y-2 mt-3">+ <div class="flex items-center gap-x-2">+ <button+ class="flex items-center gap-x-1 text-sm text-control-light hover:text-control cursor-pointer"+ @click="showGitlabCiYaml = !showGitlabCiYaml"+ >+ <ChevronRightIcon+ v-if="!showGitlabCiYaml"+ class="w-4 h-4"+ />+ <ChevronDownIcon v-else class="w-4 h-4" />+ {{+ $t("gitops.workflow.file-hint", {+ filePath: ".gitlab-ci.yml",+ })+ }}+ </button>+ <CopyButton :content="gitlabCiYaml" />+ </div>+ <NInput+ v-show="showGitlabCiYaml"+ :value="gitlabCiYaml"+ type="textarea"+ readonly+ :autosize="{ minRows: 10, maxRows: 30 }"+ class="font-mono text-sm"+ />+ </div>+ </NTabPane>+ </NTabs>+ </div>++ <!-- Part 3: Test Your Setup -->+ <div class="flex flex-col gap-y-4">+ <h2 class="text-lg font-medium">+ {{ $t("gitops.test-setup.title") }}+ </h2>+ <p class="text-sm text-control-light">+ {{ $t("gitops.test-setup.description") }}+ </p>++ <!-- Sample migration file -->+ <div class="flex flex-col gap-y-2">+ <div class="flex items-center gap-x-2">+ <span class="text-sm text-control-light">{{ sampleFilePath }}</span>+ <CopyButton :content="sampleSql" />+ </div>+ <NInput+ :value="sampleSql"+ type="textarea"+ readonly+ :autosize="{ minRows: 5, maxRows: 15 }"+ class="font-mono text-sm"+ />+ </div>++ <!-- Step-by-step instructions -->+ <div class="flex flex-col gap-y-3">+ <div class="flex items-start gap-x-3">+ <span+ class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-gray-200 text-gray-600 text-xs shrink-0 mt-0.5"+ >+ 1+ </span>+ <p class="text-sm text-control-light">+ {{+ $t("gitops.test-setup.step-create-branch", {+ branch: branch,+ })+ }}+ </p>+ </div>+ <div class="flex items-start gap-x-3">+ <span+ class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-gray-200 text-gray-600 text-xs shrink-0 mt-0.5"+ >+ 2+ </span>+ <p class="text-sm text-control-light">+ {{ $t("gitops.test-setup.step-sql-review") }}+ </p>+ </div>+ <div class="flex items-start gap-x-3">+ <span+ class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-gray-200 text-gray-600 text-xs shrink-0 mt-0.5"+ >+ 3+ </span>+ <p class="text-sm text-control-light">+ {{ $t("gitops.test-setup.step-merge") }}+ </p>+ </div>+ </div>++ <!-- Naming convention hint -->+ <p class="text-sm text-control-light">+ {{ $t("gitops.test-setup.naming-convention") }}+ </p>+ </div>++ <!-- Documentation link -->+ <div>+ <a+ href="https://docs.bytebase.com/vcs-integration/overview?source=console"+ target="_blank"+ class="text-accent hover:underline"+ >+ {{ $t("gitops.documentation") }} →+ </a>+ </div>+ </div>++ <CreateWorkloadIdentityDrawer+ v-if="showCreateDrawer"+ :project="projectName"+ @close="showCreateDrawer = false"+ @created="handleWorkloadIdentityCreated"+ />+</template>++<script lang="ts" setup>+import {+ CheckIcon,+ ChevronDownIcon,+ ChevronRightIcon,+ MinusCircleIcon,+} from "lucide-vue-next";+import {+ NButton,+ NInput,+ NRadioButton,+ NRadioGroup,+ NSelect,+ NTabPane,+ NTabs,+} from "naive-ui";+import { computed, onMounted, ref, watch } from "vue";+import { useRouter } from "vue-router";+import gitopsWorkflowImage from "@/assets/gitops-workflow.svg";+import CreateWorkloadIdentityDrawer from "@/components/User/Settings/CreateWorkloadIdentityDrawer.vue";+import { CopyButton, DatabaseSelect } from "@/components/v2";+import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetting";+import { useActuatorV1Store, useProjectByName } from "@/store";+import { projectNamePrefix } from "@/store/modules/v1/common";+import { useWorkloadIdentityStore } from "@/store/modules/workloadIdentity";+import type { User } from "@/types/proto-es/v1/user_service_pb";+import { WorkloadIdentityConfig_ProviderType } from "@/types/proto-es/v1/user_service_pb";+import type { WorkloadIdentity } from "@/types/proto-es/v1/workload_identity_service_pb";+import { hasWorkspacePermissionV2 } from "@/utils";++const props = defineProps<{+ projectId: string;+}>();++const router = useRouter();+const actuatorStore = useActuatorV1Store();+const workloadIdentityStore = useWorkloadIdentityStore();++const projectName = computed(() => `${projectNamePrefix}${props.projectId}`);+const { project: _project } = useProjectByName(projectName);++const showCreateDrawer = ref(false);+const selectedIdentityEmail = ref<string | null>(null);+const selectedDatabaseNames = ref<string[]>([]);+const isLoading = ref(false);+const identityOptions = ref<{ label: string; value: string }[]>([]);+const identityMap = ref<Map<string, WorkloadIdentity>>(new Map());+const activeTab = ref("github-actions");+const runnerType = ref<"self-hosted" | "cloud">("self-hosted");+const showSqlReviewYaml = ref(false);+const showReleaseYaml = ref(false);+const showGitlabCiYaml = ref(false);++const hasExternalUrl = computed(() => {+ const url = actuatorStore.serverInfo?.externalUrl ?? "";+ return url.length > 0;+});++const hasSettingPermission = computed(() =>+ hasWorkspacePermissionV2("bb.settings.set")+);++const goToGeneralSettings = () => {+ router.push({ name: SETTING_ROUTE_WORKSPACE_GENERAL });+};++const selectedIdentity = computed(() => {+ if (!selectedIdentityEmail.value) return undefined;+ return identityMap.value.get(selectedIdentityEmail.value);+});++const selectedConfig = computed(+ () => selectedIdentity.value?.workloadIdentityConfig+);++// Parse subject pattern to extract owner/repo/branch.+const parsedSubject = computed(() => {+ const pattern = selectedConfig.value?.subjectPattern;+ if (!pattern) return undefined;++ const providerType = selectedConfig.value?.providerType;++ if (providerType === WorkloadIdentityConfig_ProviderType.GITHUB) {+ const match = pattern.match(/^repo:([^/]+)\/(.*)$/);+ if (!match) return undefined;+ const owner = match[1];+ const rest = match[2];+ if (rest === "*") return { owner, repo: "", branch: "" };+ const repoMatch = rest.match(/^([^:]+):(.*)$/);+ if (!repoMatch) return undefined;+ const repo = repoMatch[1];+ const refPart = repoMatch[2];+ if (refPart === "*") return { owner, repo, branch: "" };+ const branchMatch = refPart.match(/^ref:refs\/heads\/(.+)$/);+ return { owner, repo, branch: branchMatch?.[1] ?? "" };+ }++ if (providerType === WorkloadIdentityConfig_ProviderType.GITLAB) {+ const match = pattern.match(/^project_path:([^/]+)\/(.*)$/);+ if (!match) return undefined;+ const owner = match[1];+ const rest = match[2];+ if (rest === "*") return { owner, repo: "", branch: "" };+ const projectMatch = rest.match(/^([^:]+):(.*)$/);+ if (!projectMatch) return undefined;+ const repo = projectMatch[1];+ const refPart = projectMatch[2];+ if (refPart === "*") return { owner, repo, branch: "" };+ const refTypeMatch = refPart.match(/^ref_type:(?:branch|tag):ref:(.+)$/);+ return { owner, repo, branch: refTypeMatch?.[1] ?? "" };+ }++ return undefined;+});++// Build a clickable repository URL from the identity.+const repoUrl = computed(() => {+ const parsed = parsedSubject.value;+ if (!parsed?.owner || !parsed.repo) return "";++ const providerType = selectedConfig.value?.providerType;+ if (providerType === WorkloadIdentityConfig_ProviderType.GITHUB) {+ return `https://github.com/${parsed.owner}/${parsed.repo}`;+ }+ if (providerType === WorkloadIdentityConfig_ProviderType.GITLAB) {+ const issuer = selectedConfig.value?.issuerUrl ?? "https://gitlab.com";+ const base = issuer.replace(/\/$/, "");+ return `${base}/${parsed.owner}/${parsed.repo}`;+ }+ return "";+});++// Branch from the identity, fallback to "main".+const branch = computed(() => parsedSubject.value?.branch || "main");++// Auto-switch tab when identity changes.+watch(selectedConfig, (config) => {+ if (!config) return;+ if (config.providerType === WorkloadIdentityConfig_ProviderType.GITLAB) {+ activeTab.value = "gitlab-ci";+ } else {+ activeTab.value = "github-actions";+ }+});++const bytebaseUrl = computed(() => {+ const url = actuatorStore.serverInfo?.externalUrl ?? "";+ if (!url) {+ return "{BYTEBASE_URL}";+ }+ return url.replace(/\/$/, "");+});++const workloadIdentityEmail = computed(() => {+ if (!selectedIdentityEmail.value) {+ return "{WORKLOAD_IDENTITY_EMAIL}";+ }+ return selectedIdentityEmail.value;+});++const targetsString = computed(() => {+ if (selectedDatabaseNames.value.length === 0) {+ return "";+ }+ return selectedDatabaseNames.value.join(",");+});++const targetsPlaceholder = computed(() => {+ return targetsString.value || "instances/{instance}/databases/{database}";+});++const runsOn = computed(() => {+ return runnerType.value === "self-hosted" ? "self-hosted" : "ubuntu-latest";+});++const sampleFilePath = "migrations/20240101000000_create_sample_table.sql";++const sampleSql = `CREATE TABLE sample (+ id SERIAL PRIMARY KEY,+ name VARCHAR(255) NOT NULL,+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP+);`;++const githubSqlReviewYaml = computed(() => {+ return `name: SQL Review+on:+ pull_request:+ branches: ["${branch.value}"]+ paths: ["migrations/*.sql"]+jobs:+ sql-review:+ permissions:+ id-token: write+ pull-requests: write+ runs-on: ${runsOn.value}+ container:+ image: bytebase/bytebase-action+ env:+ BYTEBASE_URL: ${bytebaseUrl.value}+ BYTEBASE_WORKLOAD_IDENTITY: ${workloadIdentityEmail.value}+ steps:+ - uses: actions/checkout@v4+ - name: Exchange token+ id: bytebase-auth+ run: |+ OIDC_TOKEN=$(curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \\+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=bytebase" | jq -r '.value')+ ACCESS_TOKEN=$(curl -s -X POST "$BYTEBASE_URL/v1/auth:exchangeToken" \\+ -H "Content-Type: application/json" \\+ -d "{\\"token\\":\\"$OIDC_TOKEN\\",\\"email\\":\\"$BYTEBASE_WORKLOAD_IDENTITY\\"}" \\+ | jq -r '.accessToken')+ echo "access-token=$ACCESS_TOKEN" >> $GITHUB_OUTPUT+ - name: SQL Review+ env:+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}+ run: |+ bytebase-action check \\+ --url=$BYTEBASE_URL \\+ --access-token=\${{ steps.bytebase-auth.outputs.access-token }} \\+ --project=projects/${props.projectId} \\+ --targets=${targetsPlaceholder.value} \\+ --file-pattern=migrations/*.sql`;+});++const exchangeTokenStep = ` - name: Exchange token+ id: bytebase-auth+ run: |+ OIDC_TOKEN=$(curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \\+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=bytebase" | jq -r '.value')+ ACCESS_TOKEN=$(curl -s -X POST "$BYTEBASE_URL/v1/auth:exchangeToken" \\+ -H "Content-Type: application/json" \\+ -d "{\\"token\\":\\"$OIDC_TOKEN\\",\\"email\\":\\"$BYTEBASE_WORKLOAD_IDENTITY\\"}" \\+ | jq -r '.accessToken')+ echo "access-token=$ACCESS_TOKEN" >> $GITHUB_OUTPUT`;++const accessTokenFlag =+ "--access-token=${{ steps.bytebase-auth.outputs.access-token }}";++const githubReleaseYaml = computed(() => {+ return `name: Rollout+on:+ push:+ branches: ["${branch.value}"]+ paths: ["migrations/*.sql"]+env:+ BYTEBASE_URL: ${bytebaseUrl.value}+ BYTEBASE_WORKLOAD_IDENTITY: ${workloadIdentityEmail.value}+ BYTEBASE_PROJECT: projects/${props.projectId}+jobs:+ build:+ runs-on: ${runsOn.value}+ steps:+ - uses: actions/checkout@v4+ - name: Build+ run: echo "Building..."+ create-rollout:+ needs: build+ permissions:+ id-token: write+ runs-on: ${runsOn.value}+ container:+ image: bytebase/bytebase-action+ outputs:+ bytebase-plan: \${{ steps.set-output.outputs.plan }}+ steps:+ - uses: actions/checkout@v4+${exchangeTokenStep}+ - name: Create rollout+ run: |+ bytebase-action rollout \\+ --url=$BYTEBASE_URL \\+ ${accessTokenFlag} \\+ --project=$BYTEBASE_PROJECT \\+ --targets=${targetsPlaceholder.value} \\+ --file-pattern=migrations/*.sql \\+ --output=\${{ runner.temp }}/bytebase-metadata.json+ - name: Set output+ id: set-output+ run: |+ PLAN=$(jq -r .plan \${{ runner.temp }}/bytebase-metadata.json)+ echo "plan=$PLAN" >> $GITHUB_OUTPUT+ deploy-to-test:+ needs: create-rollout+ permissions:+ id-token: write+ runs-on: ${runsOn.value}+ environment: test+ container:+ image: bytebase/bytebase-action+ steps:+ - uses: actions/checkout@v4+${exchangeTokenStep}+ - name: Deploy to test+ run: |+ bytebase-action rollout \\+ --url=$BYTEBASE_URL \\+ ${accessTokenFlag} \\+ --project=$BYTEBASE_PROJECT \\+ --target-stage=environments/test \\+ --plan=\${{ needs.create-rollout.outputs.bytebase-plan }}+ deploy-to-prod:+ needs: [deploy-to-test, create-rollout]+ permissions:+ id-token: write+ runs-on: ${runsOn.value}+ environment: prod+ container:+ image: bytebase/bytebase-action+ steps:+ - uses: actions/checkout@v4+${exchangeTokenStep}+ - name: Deploy to prod+ run: |+ bytebase-action rollout \\+ --url=$BYTEBASE_URL \\+ ${accessTokenFlag} \\+ --project=$BYTEBASE_PROJECT \\+ --target-stage=environments/prod \\+ --plan=\${{ needs.create-rollout.outputs.bytebase-plan }}`;+});++const gitlabExchangeScript = ` - |+ ACCESS_TOKEN=$(curl -s -X POST "$BYTEBASE_URL/v1/auth:exchangeToken" \\+ -H "Content-Type: application/json" \\+ -d "{\\"token\\":\\"$CI_JOB_JWT_V2\\",\\"email\\":\\"$BYTEBASE_WORKLOAD_IDENTITY\\"}" \\+ | jq -r '.accessToken')+ export BYTEBASE_ACCESS_TOKEN=$ACCESS_TOKEN`;++const gitlabCiYaml = computed(() => {+ return `stages:+ - sql-review+ - create-rollout+ - deploy-to-test+ - deploy-to-prod++variables:+ BYTEBASE_URL: ${bytebaseUrl.value}+ BYTEBASE_WORKLOAD_IDENTITY: ${workloadIdentityEmail.value}+ BYTEBASE_PROJECT: projects/${props.projectId}+ BYTEBASE_TARGETS: ${targetsPlaceholder.value}+ FILE_PATTERN: "migrations/*.sql"++sql-review:+ stage: sql-review+ image: bytebase/bytebase-action+ id_tokens:+ GITLAB_OIDC_TOKEN:+ aud: bytebase+ rules:+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"+ script:+${gitlabExchangeScript}+ - bytebase-action check --url=$BYTEBASE_URL --access-token=$BYTEBASE_ACCESS_TOKEN --project=$BYTEBASE_PROJECT --targets=$BYTEBASE_TARGETS --file-pattern=$FILE_PATTERN++create-rollout:+ stage: create-rollout+ image: bytebase/bytebase-action+ id_tokens:+ GITLAB_OIDC_TOKEN:+ aud: bytebase+ rules:+ - if: $CI_COMMIT_BRANCH == "${branch.value}"+ script:+${gitlabExchangeScript}+ - bytebase-action rollout --url=$BYTEBASE_URL --access-token=$BYTEBASE_ACCESS_TOKEN --project=$BYTEBASE_PROJECT --targets=$BYTEBASE_TARGETS --file-pattern=$FILE_PATTERN --output=bytebase-metadata.json+ artifacts:+ paths: [bytebase-metadata.json]++deploy-to-test:+ stage: deploy-to-test+ image: bytebase/bytebase-action+ needs: [create-rollout]+ id_tokens:+ GITLAB_OIDC_TOKEN:+ aud: bytebase+ rules:+ - if: $CI_COMMIT_BRANCH == "${branch.value}"+ environment: test+ script:+${gitlabExchangeScript}+ - PLAN=$(jq -r .plan bytebase-metadata.json)+ - bytebase-action rollout --url=$BYTEBASE_URL --access-token=$BYTEBASE_ACCESS_TOKEN --project=$BYTEBASE_PROJECT --target-stage=environments/test --plan=$PLAN++deploy-to-prod:+ stage: deploy-to-prod+ image: bytebase/bytebase-action+ needs: [deploy-to-test]+ id_tokens:+ GITLAB_OIDC_TOKEN:+ aud: bytebase+ rules:+ - if: $CI_COMMIT_BRANCH == "${branch.value}"+ environment: prod+ when: manual+ script:+${gitlabExchangeScript}+ - PLAN=$(jq -r .plan bytebase-metadata.json)+ - bytebase-action rollout --url=$BYTEBASE_URL --access-token=$BYTEBASE_ACCESS_TOKEN --project=$BYTEBASE_PROJECT --target-stage=environments/prod --plan=$PLAN`;+});++const fetchWorkloadIdentities = async () => {+ isLoading.value = true;+ try {+ const response = await workloadIdentityStore.listWorkloadIdentities({+ parent: projectName.value,+ pageSize: 100,+ pageToken: undefined,+ showDeleted: false,+ });+ const map = new Map<string, WorkloadIdentity>();+ const options: { label: string; value: string }[] = [];+ for (const wi of response.workloadIdentities) {+ map.set(wi.email, wi);+ options.push({+ label: `${wi.title} (${wi.email})`,+ value: wi.email,+ });+ }+ identityMap.value = map;+ identityOptions.value = options;+ } finally {+ isLoading.value = false;+ }+};++const handleWorkloadIdentityCreated = async (user: User) => {+ await fetchWorkloadIdentities();+ selectedIdentityEmail.value = user.email;+};++onMounted(() => {+ fetchWorkloadIdentities();+});+</script>