steps:
- id: Build Dockertools Docker Image
  name: gcr.io/cloud-builders/docker
  args:
  - build
  - --tag
  - dockertools
  - --file
  - tools/dockertools.Dockerfile
  - tools

- id: Share dockertools using workspaces
  name: dockertools
  entrypoint: bash
  args:
  - -c
  - |
    cp /bin/cloudbuild /workspace/cloudbuild &&
    cp /bin/dockerfiles /workspace/dockerfiles &&
    cp /bin/cloudbuild /workspace/cloudbuild_$COMMIT_SHA &&
    cp /bin/dockerfiles /workspace/dockerfiles_$COMMIT_SHA

artifacts:
  objects:
    location: 'gs://$PROJECT_ID-kokoro/artifacts/'
    paths: ['/workspace/cloudbuild', '/workspace/dockerfiles', '/workspace/cloudbuild_$COMMIT_SHA', '/workspace/dockerfiles_$COMMIT_SHA']
