This repository was archived by the owner on Jan 29, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
736 lines (637 loc) · 26.5 KB
/
google-services-deployment.yml
File metadata and controls
736 lines (637 loc) · 26.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
name: Google Services Integration Deployment
on:
push:
branches: [main, develop]
paths:
- 'src/**'
- 'infrastructure/**'
- 'package.json'
- 'Dockerfile'
pull_request:
branches: [main, develop]
paths:
- 'src/**'
- 'infrastructure/**'
- 'package.json'
- 'Dockerfile'
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
default: 'staging'
type: choice
options:
- development
- staging
- production
deployment_type:
description: 'Deployment type'
required: true
default: 'rolling'
type: choice
options:
- rolling
- blue-green
- canary
skip_tests:
description: 'Skip tests (NOT recommended)'
required: false
default: false
type: boolean
feature_flags:
description: 'Comma-separated feature flags to enable'
required: false
default: 'vertexAi,multimodalStreaming,veo3,imagen4,lyria,chirp'
type: string
google_services_mode:
description: 'Google services activation mode'
required: false
default: 'gradual'
type: choice
options:
- gradual
- immediate
- testing-only
env:
NODE_VERSION: '20'
DOCKER_BUILDKIT: 1
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
REGISTRY: gcr.io
IMAGE_NAME: gemini-flow
CACHE_VERSION: 'v4'
concurrency:
group: deployment-${{ github.ref }}-${{ github.event.inputs.environment || 'auto' }}
cancel-in-progress: false
jobs:
# Environment Detection and Validation
detect-environment:
name: Detect Environment & Validate
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.env-detection.outputs.environment }}
deployment-type: ${{ steps.env-detection.outputs.deployment-type }}
should-deploy: ${{ steps.env-detection.outputs.should-deploy }}
feature-flags: ${{ steps.env-detection.outputs.feature-flags }}
image-tag: ${{ steps.env-detection.outputs.image-tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Environment Detection
id: env-detection
run: |
# Determine environment
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
ENVIRONMENT="${{ github.event.inputs.environment }}"
DEPLOYMENT_TYPE="${{ github.event.inputs.deployment_type }}"
FEATURE_FLAGS="${{ github.event.inputs.feature_flags }}"
SHOULD_DEPLOY="true"
elif [ "${{ github.ref }}" == "refs/heads/main" ]; then
ENVIRONMENT="production"
DEPLOYMENT_TYPE="canary"
FEATURE_FLAGS="vertexAi,multimodalStreaming,agentSpace,veo3,imagen4,lyria,chirp"
SHOULD_DEPLOY="true"
elif [ "${{ github.ref }}" == "refs/heads/develop" ]; then
ENVIRONMENT="staging"
DEPLOYMENT_TYPE="rolling"
FEATURE_FLAGS="vertexAi,multimodalStreaming,agentSpace,projectMariner,veo3,imagen4,lyria,chirp"
SHOULD_DEPLOY="true"
else
ENVIRONMENT="development"
DEPLOYMENT_TYPE="rolling"
FEATURE_FLAGS="vertexAi,multimodalStreaming,veo3,imagen4"
SHOULD_DEPLOY="false"
fi
# Generate image tag
SHORT_SHA=$(git rev-parse --short HEAD)
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
IMAGE_TAG="${ENVIRONMENT}-${SHORT_SHA}-${TIMESTAMP}"
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT
echo "deployment-type=$DEPLOYMENT_TYPE" >> $GITHUB_OUTPUT
echo "should-deploy=$SHOULD_DEPLOY" >> $GITHUB_OUTPUT
echo "feature-flags=$FEATURE_FLAGS" >> $GITHUB_OUTPUT
echo "image-tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "🎯 Target Environment: $ENVIRONMENT"
echo "🚀 Deployment Type: $DEPLOYMENT_TYPE"
echo "🏷️ Image Tag: $IMAGE_TAG"
echo "🚩 Feature Flags: $FEATURE_FLAGS"
# Security and Compliance Scanning
security-scan:
name: Security & Compliance Scan
runs-on: ubuntu-latest
needs: detect-environment
if: needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'
- name: Dependency audit
run: |
npm audit --audit-level moderate --json > audit-results.json || true
if npm audit --audit-level high --json | jq -e '.vulnerabilities | length > 0' > /dev/null; then
echo "❌ High severity vulnerabilities found!"
npm audit --audit-level high
exit 1
fi
echo "✅ Security audit passed"
# Build and Test Matrix
build-test-matrix:
name: Build & Test Matrix
runs-on: ${{ matrix.os }}
needs: [detect-environment, security-scan]
if: needs.detect-environment.outputs.should-deploy == 'true'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [20]
test-suite: [unit, integration, e2e]
include:
- os: ubuntu-latest
node-version: 20
test-suite: unit
upload-coverage: true
env:
NODE_OPTIONS: '--experimental-vm-modules --max-old-space-size=4096'
ENVIRONMENT: ${{ needs.detect-environment.outputs.environment }}
FEATURE_FLAGS: ${{ needs.detect-environment.outputs.feature-flags }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ env.CACHE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-${{ env.CACHE_VERSION }}-
- name: Install dependencies
run: |
npm ci
# Install environment-specific dependencies
if [ "${{ needs.detect-environment.outputs.environment }}" == "production" ]; then
npm run install:enterprise
fi
- name: Setup test environment
run: |
# Create test configuration
echo '{}' > test-config.json
# Setup feature flags for testing
echo "FEATURE_FLAGS=${{ needs.detect-environment.outputs.feature-flags }}" >> $GITHUB_ENV
- name: Run ${{ matrix.test-suite }} tests
if: github.event.inputs.skip_tests != 'true'
run: |
case "${{ matrix.test-suite }}" in
"unit")
npm run test:unit -- --coverage --coverageReporters=json-summary --coverageReporters=lcov
;;
"integration")
npm run test:integration
;;
"e2e")
npm run test:protocols
;;
esac
- name: Type checking
run: npm run typecheck
- name: Lint code
run: npm run lint
- name: Build application
run: npm run build
- name: Upload coverage
if: matrix.upload-coverage == true && github.event.inputs.skip_tests != 'true'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: false
# Docker Build and Push
docker-build:
name: Docker Build & Push
runs-on: ubuntu-latest
needs: [detect-environment, build-test-matrix]
if: needs.detect-environment.outputs.should-deploy == 'true'
outputs:
image-digest: ${{ steps.build.outputs.digest }}
image-full-name: ${{ steps.build.outputs.image-full-name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:v0.12.0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Configure Docker for GCR
run: |
gcloud auth configure-docker
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,value=${{ needs.detect-environment.outputs.image-tag }}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
NODE_VERSION=${{ env.NODE_VERSION }}
ENVIRONMENT=${{ needs.detect-environment.outputs.environment }}
FEATURE_FLAGS=${{ needs.detect-environment.outputs.feature-flags }}
BUILD_VERSION=${{ needs.detect-environment.outputs.image-tag }}
- name: Output image details
run: |
IMAGE_FULL_NAME="${{ env.REGISTRY }}/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ needs.detect-environment.outputs.image-tag }}"
echo "image-full-name=$IMAGE_FULL_NAME" >> $GITHUB_OUTPUT
echo "🐳 Built and pushed: $IMAGE_FULL_NAME"
echo "📋 Digest: ${{ steps.build.outputs.digest }}"
# Infrastructure Provisioning
infrastructure-deploy:
name: Infrastructure Deployment
runs-on: ubuntu-latest
needs: [detect-environment, docker-build]
environment: ${{ needs.detect-environment.outputs.environment }}
if: needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.5.7
- name: Terraform Format Check
run: |
cd infrastructure/terraform/environments/${{ needs.detect-environment.outputs.environment }}
terraform fmt -check
- name: Terraform Init
run: |
cd infrastructure/terraform/environments/${{ needs.detect-environment.outputs.environment }}
terraform init
- name: Terraform Plan
run: |
cd infrastructure/terraform/environments/${{ needs.detect-environment.outputs.environment }}
terraform plan -var="image_tag=${{ needs.detect-environment.outputs.image-tag }}" -out=tfplan
- name: Terraform Apply
if: needs.detect-environment.outputs.environment != 'production' || github.event_name == 'workflow_dispatch'
run: |
cd infrastructure/terraform/environments/${{ needs.detect-environment.outputs.environment }}
terraform apply -auto-approve tfplan
# Kubernetes Deployment
kubernetes-deploy:
name: Kubernetes Deployment (${{ needs.detect-environment.outputs.deployment-type }})
runs-on: ubuntu-latest
needs: [detect-environment, docker-build, infrastructure-deploy]
environment: ${{ needs.detect-environment.outputs.environment }}
if: needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Get GKE credentials
run: |
gcloud container clusters get-credentials \
${{ needs.detect-environment.outputs.environment }}-gemini-flow-gke \
--region us-central1 \
--project ${{ env.GCP_PROJECT_ID }}
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: '3.12.0'
- name: Add Helm repositories
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo update
- name: Deploy with Helm (${{ needs.detect-environment.outputs.deployment-type }})
run: |
cd infrastructure/helm
# Set deployment-specific values
DEPLOYMENT_TYPE="${{ needs.detect-environment.outputs.deployment-type }}"
IMAGE_FULL_NAME="${{ needs.docker-build.outputs.image-full-name }}"
FEATURE_FLAGS="${{ needs.detect-environment.outputs.feature-flags }}"
case "$DEPLOYMENT_TYPE" in
"rolling")
helm upgrade --install gemini-flow ./gemini-flow \
--namespace gemini-flow \
--create-namespace \
--values ./gemini-flow/values.yaml \
--values ./gemini-flow/values-${{ needs.detect-environment.outputs.environment }}.yaml \
--set image.repository="${{ env.REGISTRY }}/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}" \
--set image.tag="${{ needs.detect-environment.outputs.image-tag }}" \
--set environment="${{ needs.detect-environment.outputs.environment }}" \
--set featureFlags.enabled="$FEATURE_FLAGS" \
--wait --timeout=10m
;;
"blue-green")
# Blue-Green deployment using Argo Rollouts
helm upgrade --install gemini-flow ./gemini-flow \
--namespace gemini-flow \
--create-namespace \
--values ./gemini-flow/values.yaml \
--values ./gemini-flow/values-${{ needs.detect-environment.outputs.environment }}.yaml \
--set image.repository="${{ env.REGISTRY }}/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}" \
--set image.tag="${{ needs.detect-environment.outputs.image-tag }}" \
--set blueGreen.enabled=true \
--set rollouts.enabled=true \
--wait --timeout=15m
;;
"canary")
# Canary deployment using Argo Rollouts
helm upgrade --install gemini-flow ./gemini-flow \
--namespace gemini-flow \
--create-namespace \
--values ./gemini-flow/values.yaml \
--values ./gemini-flow/values-${{ needs.detect-environment.outputs.environment }}.yaml \
--set image.repository="${{ env.REGISTRY }}/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}" \
--set image.tag="${{ needs.detect-environment.outputs.image-tag }}" \
--set canary.enabled=true \
--set rollouts.enabled=true \
--wait --timeout=20m
;;
esac
- name: Wait for deployment readiness
run: |
kubectl -n gemini-flow rollout status deployment/gemini-flow --timeout=600s
kubectl -n gemini-flow wait --for=condition=available --timeout=600s deployment/gemini-flow
- name: Setup port forwarding for health check
run: |
kubectl -n gemini-flow port-forward svc/gemini-flow 8080:8080 &
sleep 10
- name: Health check
run: |
max_attempts=30
attempt=1
while [ $attempt -le $max_attempts ]; do
if curl -f http://localhost:8080/health; then
echo "✅ Health check passed"
break
fi
echo "⏳ Health check attempt $attempt/$max_attempts failed, retrying..."
sleep 10
attempt=$((attempt + 1))
done
if [ $attempt -gt $max_attempts ]; then
echo "❌ Health check failed after $max_attempts attempts"
kubectl -n gemini-flow describe pods
kubectl -n gemini-flow logs -l app.kubernetes.io/name=gemini-flow --tail=100
exit 1
fi
# Feature Flag Configuration
feature-flags-config:
name: Configure Feature Flags
runs-on: ubuntu-latest
needs: [detect-environment, kubernetes-deploy]
if: needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure Unleash feature flags
run: |
# Parse feature flags
IFS=',' read -ra FLAGS <<< "${{ needs.detect-environment.outputs.feature-flags }}"
echo "🚩 Configuring feature flags for ${{ needs.detect-environment.outputs.environment }}:"
for flag in "${FLAGS[@]}"; do
echo " - $flag: enabled"
# Here you would make API calls to your feature flag service
# curl -X POST "https://unleash.example.com/api/admin/features/$flag/environments/${{ needs.detect-environment.outputs.environment }}/on" \
# -H "Authorization: Bearer ${{ secrets.UNLEASH_API_TOKEN }}"
done
# Post-Deployment Testing
post-deployment-tests:
name: Post-Deployment Testing
runs-on: ubuntu-latest
needs: [detect-environment, kubernetes-deploy, feature-flags-config]
if: needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run integration tests against deployed environment
run: |
export TEST_ENVIRONMENT="${{ needs.detect-environment.outputs.environment }}"
export TEST_URL="https://api-${{ needs.detect-environment.outputs.environment }}.gemini-flow.example.com"
npm run test:integration:live
- name: Run performance benchmarks
run: |
npm run test:performance -- --environment=${{ needs.detect-environment.outputs.environment }}
- name: API health validation
run: |
curl -f "https://api-${{ needs.detect-environment.outputs.environment }}.gemini-flow.example.com/health" || exit 1
curl -f "https://api-${{ needs.detect-environment.outputs.environment }}.gemini-flow.example.com/metrics" || exit 1
# Rollback Mechanism
rollback-on-failure:
name: Automated Rollback
runs-on: ubuntu-latest
needs: [detect-environment, kubernetes-deploy, post-deployment-tests]
if: failure() && needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Get GKE credentials
run: |
gcloud container clusters get-credentials \
${{ needs.detect-environment.outputs.environment }}-gemini-flow-gke \
--region us-central1 \
--project ${{ env.GCP_PROJECT_ID }}
- name: Rollback deployment
run: |
kubectl -n gemini-flow rollout undo deployment/gemini-flow
kubectl -n gemini-flow rollout status deployment/gemini-flow --timeout=300s
echo "🔄 Deployment rolled back successfully"
- name: Notify rollback
run: |
echo "🚨 Deployment to ${{ needs.detect-environment.outputs.environment }} failed and was rolled back"
# Add notification logic here (Slack, email, etc.)
# Deployment Success Notification
deployment-success:
name: Deployment Success Notification
runs-on: ubuntu-latest
needs: [detect-environment, kubernetes-deploy, post-deployment-tests]
if: success() && needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Success notification
run: |
echo "🎉 Successful deployment to ${{ needs.detect-environment.outputs.environment }}"
echo "🚀 Deployment Type: ${{ needs.detect-environment.outputs.deployment-type }}"
echo "🏷️ Image: ${{ needs.docker-build.outputs.image-full-name }}"
echo "🚩 Feature Flags: ${{ needs.detect-environment.outputs.feature-flags }}"
echo "🌐 URL: https://api-${{ needs.detect-environment.outputs.environment }}.gemini-flow.example.com"
# Add success notification logic here (Slack, email, etc.)
# Google Services Specific Validation
google-services-validation:
name: Google Services Integration Validation
runs-on: ubuntu-latest
needs: [detect-environment, kubernetes-deploy]
if: needs.detect-environment.outputs.should-deploy == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Get GKE credentials
run: |
gcloud container clusters get-credentials \
${{ needs.detect-environment.outputs.environment }}-gemini-flow-gke \
--region us-central1 \
--project ${{ env.GCP_PROJECT_ID }}
- name: Apply Google Services secrets
run: |
# Apply secrets with environment substitution
envsubst < infrastructure/k8s/google-services-secrets.yaml | kubectl apply -f -
env:
VERTEX_AI_KEY: ${{ secrets.VERTEX_AI_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
VEO3_API_KEY: ${{ secrets.VEO3_API_KEY }}
IMAGEN4_API_KEY: ${{ secrets.IMAGEN4_API_KEY }}
LYRIA_API_KEY: ${{ secrets.LYRIA_API_KEY }}
CHIRP_API_KEY: ${{ secrets.CHIRP_API_KEY }}
CO_SCIENTIST_API_KEY: ${{ secrets.CO_SCIENTIST_API_KEY }}
- name: Apply Google Services monitoring
run: |
kubectl apply -f infrastructure/monitoring/google-services-monitoring.yaml
- name: Wait for Google Services to be ready
run: |
echo "🔍 Waiting for Google Services to initialize..."
max_attempts=60
attempt=1
while [ $attempt -le $max_attempts ]; do
# Check if all services are responding
if kubectl exec -n gemini-flow deployment/gemini-flow -- curl -f http://localhost:8080/health/google-services; then
echo "✅ Google Services are ready"
break
fi
echo "⏳ Attempt $attempt/$max_attempts - Google Services not ready yet"
sleep 10
attempt=$((attempt + 1))
done
if [ $attempt -gt $max_attempts ]; then
echo "❌ Google Services failed to become ready"
kubectl logs -n gemini-flow -l app.kubernetes.io/name=gemini-flow --tail=50
exit 1
fi
- name: Run Google Services integration tests
run: |
export TEST_ENVIRONMENT="${{ needs.detect-environment.outputs.environment }}"
export GOOGLE_SERVICES_ENABLED="true"
npm run test:google-services:integration
- name: Validate Veo3 service
run: |
echo "🎬 Testing Veo3 video generation..."
kubectl exec -n gemini-flow deployment/gemini-flow -- \
node -e "
const veo3 = require('./src/services/google-services/veo3-video-generator');
veo3.healthCheck().then(result => {
console.log('Veo3 health check:', result);
process.exit(result.healthy ? 0 : 1);
});
"
- name: Validate Imagen4 service
run: |
echo "🖼️ Testing Imagen4 image generation..."
kubectl exec -n gemini-flow deployment/gemini-flow -- \
node -e "
const imagen4 = require('./src/services/google-services/imagen4-generator');
imagen4.healthCheck().then(result => {
console.log('Imagen4 health check:', result);
process.exit(result.healthy ? 0 : 1);
});
"
- name: Validate Lyria service
run: |
echo "🎵 Testing Lyria music composition..."
kubectl exec -n gemini-flow deployment/gemini-flow -- \
node -e "
const lyria = require('./src/services/google-services/lyria-music-composer');
lyria.healthCheck().then(result => {
console.log('Lyria health check:', result);
process.exit(result.healthy ? 0 : 1);
});
"
- name: Performance baseline test
run: |
echo "📊 Running performance baseline tests..."
npm run test:performance:google-services -- \
--environment=${{ needs.detect-environment.outputs.environment }} \
--baseline-mode=true
- name: GPU utilization check
run: |
echo "🖥️ Checking GPU utilization..."
kubectl exec -n gemini-flow daemonset/gpu-metrics-exporter -- \
curl -s http://localhost:9400/metrics | grep nvidia_gpu_utilization || echo "GPU metrics not available"
# Cleanup
cleanup:
name: Cleanup Resources
runs-on: ubuntu-latest
needs: [deployment-success, rollback-on-failure]
if: always()
steps:
- name: Cleanup temporary resources
run: |
echo "🧹 Cleaning up temporary resources..."
# Add cleanup logic for temporary resources
echo "✅ Cleanup completed"