steps:
  - name: 'gcr.io/kaniko-project/executor:v1.5.1'
    id: builder-image
    args:
      [
        '--cache=true',
        '--use-new-run',
        '--build-arg',
        'SOURCE_COMMIT=$COMMIT_SHA',
        '--destination=us.gcr.io/$PROJECT_ID/sentry-builder:$COMMIT_SHA',
        '-f',
        './self-hosted/builder.dockerfile',
      ]
    timeout: 180s
  - name: 'us.gcr.io/$PROJECT_ID/sentry-builder:$COMMIT_SHA'
    id: builder-run
    env:
      - 'SOURCE_COMMIT=$COMMIT_SHA'
    timeout: 600s
  - name: 'gcr.io/kaniko-project/executor:v1.5.1'
    id: runtime-image
    waitFor:
      - builder-run
    args:
      [
        '--cache=true',
        '--use-new-run',
        '--build-arg',
        'SOURCE_COMMIT=$COMMIT_SHA',
        '--destination=us.gcr.io/$PROJECT_ID/sentry:$COMMIT_SHA',
        '-f',
        './self-hosted/Dockerfile',
      ]
    timeout: 300s
timeout: 2640s
artifacts:
  objects:
    location: 'gs://sentryio-cloudbuild-opensource/getsentry/sentry/$COMMIT_SHA/'
    paths: ['dist/*.whl']
options:
  # We need more memory for Webpack builds & e2e self-hosted tests
  machineType: 'E2_HIGHCPU_8'
  env:
    - 'SENTRY_IMAGE=us.gcr.io/$PROJECT_ID/sentry:$COMMIT_SHA'