-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
32 lines (26 loc) · 1.13 KB
/
cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
steps:
# This steps clone the repository into GCP
- name: gcr.io/cloud-builders/git
args: ['clone', 'https://PatrickVibild:[email protected]/PatrickVibild/marginsaver']
# This step runs the unit tests on the src
- name: 'docker.io/library/python:3.7'
id: Test
entrypoint: /bin/sh
args:
- -c
- 'pip install -r requirements.txt && python -m pytest test/**'
#This step creates a container and leave it on CloudBuilds repository.
- name: 'gcr.io/cloud-builders/docker'
id: Build
args: ['build', '-t', 'gcr.io/abiding-robot-255320/marginsaver:$SHORT_SHA', '.']
#Adds the container to Google container registry as an artefact
- name: 'gcr.io/cloud-builders/docker'
id: Container push
args: ['push', 'gcr.io/abiding-robot-255320/marginsaver:$SHORT_SHA']
#Uses the container and replaces the existing one in Kubernetes
- name: 'gcr.io/cloud-builders/kubectl'
id: Kubernetes deployment
args: ['set', 'image', 'deployment/margin-saver-service', 'marginsaver-sha256=gcr.io/abiding-robot-255320/marginsaver:$SHORT_SHA']
env:
- 'CLOUDSDK_COMPUTE_ZONE=us-central1-a'
- 'CLOUDSDK_CONTAINER_CLUSTER=scrapper-cluster'