Kiwi

Kiwi for Google Cloud Build

Report check results from Google Cloud Build to a run's Verify step with a checker key.

  • Posts named check results over HTTP with a checker key. The key can report only the checks you choose in one project.
  • Checks reserved for CI accept results only from a checker key.
  • Records each result against the candidate under review. A pass counts toward Verify; a fail means the run needs rework.
  • Records a retried report once.
  • Kiwi does not start pipelines or read their logs. It records the results your pipeline sends.

Set up

Store your checker key in Secret Manager as a secret named kiwi-checker-key that your build's service account can access, and add report-kiwi-check.sh from the setup guide to your repository.

This cloudbuild.yaml runs your tests, then reports the tests-pass check as pass or fail:

steps:
  - name: node:22
    entrypoint: bash
    args:
      - -c
      - |
        set -e
        apt-get update && apt-get install -y jq uuid-runtime
        npm ci && npm test && status=pass || status=fail
        ./report-kiwi-check.sh tests-pass "$$status" "https://console.cloud.google.com/cloud-build/builds/$BUILD_ID?project=$PROJECT_ID"
        [ "$$status" = pass ]
    env:
      - KIWI_RUN_ID=$_KIWI_RUN_ID
    secretEnv: ['KIWI_CHECKER_KEY']
availableSecrets:
  secretManager:
    - versionName: projects/$PROJECT_ID/secrets/kiwi-checker-key/versions/latest
      env: KIWI_CHECKER_KEY

Start the build with the Kiwi run ID as the _KIWI_RUN_ID substitution, for example with gcloud builds submit --substitutions=_KIWI_RUN_ID=<run ID> or by running a trigger with that substitution.

The step reports the test result, then exits with it.

Replace tests-pass with the check ID from your plan.