-
Notifications
You must be signed in to change notification settings - Fork 5
/
cloudbuild-tags.yaml
36 lines (34 loc) · 1.3 KB
/
cloudbuild-tags.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
33
34
35
36
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: bash
env:
# User defined
- 'DOCKER_REGISTRY=${_DOCKER_REGISTRY}'
args:
- '-xec'
- |
export IMAGE_TAG="${TAG_NAME}_ci_${BUILD_ID}"
export IMAGE_NAME="$${DOCKER_REGISTRY}:$$IMAGE_TAG"
export GIT_VERSION="$TAG_NAME@$COMMIT_SHA"
docker build --pull -t $$IMAGE_NAME --build-arg GIT_VERSION=$$GIT_VERSION .
docker run -u root --rm $$IMAGE_NAME py.test --cov --nomigrations
docker push $$IMAGE_NAME
- name: 'gcr.io/$PROJECT_ID/kustomize'
entrypoint: bash
env:
# User defined
- 'CLOUDSDK_COMPUTE_ZONE=${_CLOUDSDK_COMPUTE_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_CLOUDSDK_CONTAINER_CLUSTER}'
- 'DOCKER_REGISTRY=${_DOCKER_REGISTRY}'
args:
- '-xec'
- |
echo "Running from Cloud build IP: `curl -q https://canihazip.com/s`"
CLUSTER=$$(gcloud config get-value container/cluster)
PROJECT=$$(gcloud config get-value core/project)
ZONE=$$(gcloud config get-value compute/zone)
gcloud container clusters get-credentials --project "$${PROJECT}" --zone "$${ZONE}" "$${CLUSTER}"
export IMAGE_TAG="${TAG_NAME}_ci_${BUILD_ID}"
export IMAGE_NAME="$${DOCKER_REGISTRY}:$$IMAGE_TAG"
export PYTHONIOENCODING=utf-8
./deployment/deploy-env.py prd djangofluent=$$IMAGE_NAME --wait-for=${COMMIT_SHA}