Repository navigation
Expand file tree
/
Copy pathdeploy-observability-collector.yml
More file actions
59 lines (56 loc) · 2.66 KB
/
Copy pathdeploy-observability-collector.yml
File metadata and controls
59 lines (56 loc) · 2.66 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
name: Deploy observability collector
on:
push:
branches:
- master
paths:
- "gcp/observability/collector/**"
- ".github/scripts/deploy_observability_collector.sh"
- ".github/scripts/verify_observability_collector.sh"
- ".github/scripts/verify_observability_collector.py"
- ".github/workflows/deploy-observability-collector.yml"
workflow_dispatch:
concurrency:
group: observability-collector-production
cancel-in-progress: false
jobs:
deploy:
name: Build, deploy, and verify collector
if: github.repository == 'PolicyEngine/policyengine-api'
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
id-token: write
env:
OBSERVABILITY_PROJECT_ID: ${{ vars.OBSERVABILITY_PROJECT_ID }}
OBSERVABILITY_COLLECTOR_REGION: ${{ vars.OBSERVABILITY_COLLECTOR_REGION }}
OBSERVABILITY_COLLECTOR_SERVICE: ${{ vars.OBSERVABILITY_COLLECTOR_SERVICE }}
OBSERVABILITY_COLLECTOR_ARTIFACT_REPOSITORY: ${{ vars.OBSERVABILITY_COLLECTOR_ARTIFACT_REPOSITORY }}
OBSERVABILITY_COLLECTOR_IMAGE_NAME: ${{ vars.OBSERVABILITY_COLLECTOR_IMAGE_NAME }}
OBSERVABILITY_COLLECTOR_SERVICE_ACCOUNT: ${{ vars.OBSERVABILITY_COLLECTOR_SERVICE_ACCOUNT }}
OBSERVABILITY_METRIC_LOCATION: ${{ vars.OBSERVABILITY_METRIC_LOCATION }}
steps:
- name: Require master branch
if: github.ref != 'refs/heads/master'
run: exit 1
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate collector configuration
run: docker run --rm --env OBSERVABILITY_PROJECT_ID="${OBSERVABILITY_PROJECT_ID}" --env OBSERVABILITY_METRIC_LOCATION="${OBSERVABILITY_METRIC_LOCATION}" --volume "${PWD}/gcp/observability/collector/config.yaml:/etc/otelcol-google/config.yaml:ro" us-docker.pkg.dev/cloud-ops-agents-artifacts/google-cloud-opentelemetry-collector/otelcol-google:0.163.1 validate --config=/etc/otelcol-google/config.yaml
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_DEPLOY_SERVICE_ACCOUNT }}
- name: Set up Google Cloud CLI
uses: google-github-actions/setup-gcloud@v2
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
version: "0.13.4"
- name: Build and deploy collector
id: collector
run: bash .github/scripts/deploy_observability_collector.sh
- name: Verify Google Cloud ingestion and log rejection
run: bash .github/scripts/verify_observability_collector.sh '${{ steps.collector.outputs.service_url }}'