# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
- name: 'gcr.io/google-appengine/python'
  id: test
  entrypoint: /bin/bash
  args:
  - '-c'
  - |
    pip3 install -r src/requirements.txt && \
    cd src && pytest
- name: 'gcr.io/cloud-builders/gcloud'
  id: min-instance
  entrypoint: /bin/bash
  args:
  - '-c'
  - |
    sed -i.bak 's/{{MIN_INSTANCES}}/${_MIN_INSTANCES_}/g' ./src/app.yaml
- name: 'gcr.io/cloud-builders/gcloud'
  id: deploy
  args:
    - app
    - deploy
    - ./src/app.yaml
    - --project=${_TARGET_PROJECT_}
  waitFor:
    - test
    - min-instance
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
- name: 'gcr.io/google-appengine/python'
  id: test
  entrypoint: /bin/bash
  args:
  - '-c'
  - |
    pip3 install -r src/requirements.txt && \
    cd src && pytest
- name: 'gcr.io/cloud-builders/gcloud'
  id: min-instance
  entrypoint: /bin/bash
  args:
  - '-c'
  - |
    sed -i.bak 's/{{MIN_INSTANCES}}/${_MIN_INSTANCES_}/g' ./src/app.yaml
- name: 'gcr.io/cloud-builders/gcloud'
  id: deploy
  args:
    - app
    - deploy
    - ./src/app.yaml
    - --project=${_TARGET_PROJECT_}
    - --version=$SHORT_SHA
  waitFor:
    - test
    - min-instance
Use Short Sha for version reference
Use Short Sha for version reference

Replaces date time default version which doesn't help debug
etc.

Closes #15
