substitutions:
  _REGION: europe-west6
  _REPOSITORY: teleo
  _IMAGE: teleo-pipeline-gcp-staging
  _TAG: manual-local
  _REVISION: unknown

options:
  logging: CLOUD_LOGGING_ONLY
  machineType: E2_HIGHCPU_8

serviceAccount: projects/teleo-501523/serviceAccounts/sa-teleo-cloudbuild@teleo-501523.iam.gserviceaccount.com

steps:
  - id: build-staging-image
    name: gcr.io/cloud-builders/docker
    args:
      - build
      - -f
      - Dockerfile.gcp-staging
      - --label
      - org.opencontainers.image.source=https://github.com/living-ip/teleo-infrastructure
      - --label
      - org.opencontainers.image.revision=${_REVISION}
      - --label
      - livingip.revision=${_REVISION}
      - --label
      - livingip.surface=teleo-infrastructure
      - --label
      - livingip.tier=gcp-staging
      - -t
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPOSITORY}/${_IMAGE}:${_TAG}
      - .

  - id: smoke-test-image-before-push
    name: gcr.io/cloud-builders/docker
    args:
      - run
      - --rm
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPOSITORY}/${_IMAGE}:${_TAG}

images:
  - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPOSITORY}/${_IMAGE}:${_TAG}
