|
| 1 | +name: Manual POC run (pull artifacts from GCS) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + use_prod_service_url: |
| 7 | + description: "Call the Cloud Run service after downloading artifacts?" |
| 8 | + required: false |
| 9 | + type: boolean |
| 10 | + default: false |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +env: |
| 16 | + # ---- Update these if needed ---- |
| 17 | + GCP_PROJECT_ID: moz-testops-tools |
| 18 | + SERVICE_URL: https://llm-tool-620861480696.us-central1.run.app |
| 19 | + # GCS object URIs you shared: |
| 20 | + CRASH_URI: gs://testops-llm-artifacts/crashes/minidumps/examples/crash_example.txt |
| 21 | + ANR_URI: gs://testops-llm-artifacts/anr/examples/anr_example.txt |
| 22 | + LOCAL_ARTIFACT_DIR: artifacts |
| 23 | + |
| 24 | +jobs: |
| 25 | + manual-run: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + # Auth via JSON key (what you asked for) |
| 33 | + - name: Authenticate to Google Cloud (JSON key) |
| 34 | + uses: google-github-actions/auth@v2 |
| 35 | + with: |
| 36 | + credentials_json: ${{ secrets.GCP_SA_VERTEX_AI }} |
| 37 | + |
| 38 | + - name: Setup gcloud |
| 39 | + uses: google-github-actions/setup-gcloud@v2 |
| 40 | + with: |
| 41 | + project_id: ${{ env.GCP_PROJECT_ID }} |
| 42 | + |
| 43 | + - name: Set gcloud project (quiet) |
| 44 | + run: | |
| 45 | + gcloud --quiet config set project "$GCP_PROJECT_ID" |
| 46 | +
|
| 47 | + - name: Download artifacts from GCS |
| 48 | + run: | |
| 49 | + mkdir -p "${LOCAL_ARTIFACT_DIR}" |
| 50 | + gcloud storage cp "${CRASH_URI}" "${LOCAL_ARTIFACT_DIR}/crash_example.txt" |
| 51 | + gcloud storage cp "${ANR_URI}" "${LOCAL_ARTIFACT_DIR}/anr_example.txt" |
| 52 | + echo "Downloaded files:" |
| 53 | + ls -la "${LOCAL_ARTIFACT_DIR}" |
| 54 | +
|
| 55 | + # Optional: call your private Cloud Run service (only if you toggle the input) |
| 56 | + - name: (Optional) Invoke secured Cloud Run service |
| 57 | + if: ${{ inputs.use_prod_service_url == true }} |
| 58 | + run: | |
| 59 | + # Fetch an ID token for the SERVICE_URL audience and call the service |
| 60 | + TOKEN="$(gcloud auth print-identity-token --audiences="${SERVICE_URL}")" |
| 61 | + curl -i -H "Authorization: Bearer ${TOKEN}" "${SERVICE_URL}" || true |
| 62 | +
|
0 commit comments