-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild-web-argo.yaml
79 lines (69 loc) · 3 KB
/
cloudbuild-web-argo.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-php-fpm-web:latest || exit 0']
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'-t', 'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-php-fpm-web:$SHORT_SHA',
'-t', 'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-php-fpm-web:latest',
'--cache-from', 'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-php-fpm-web:latest',
'-f', './docker/php-fpm/Dockerfile-web.production',
'.'
]
timeout: 1200s
- name: 'gcr.io/cloud-builders/docker'
entrypoint: /bin/sh
args:
- -c
- |
docker push gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-php-fpm-web:$SHORT_SHA
docker push gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-php-fpm-web:latest
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-nginx-web:latest || exit 0']
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'-t', 'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-nginx-web:$SHORT_SHA',
'-t', 'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-nginx-web:latest',
'--cache-from', 'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-nginx-web:latest',
'-f', './docker/nginx/Dockerfile.production',
'.'
]
timeout: 1200s
- name: 'gcr.io/cloud-builders/docker'
entrypoint: /bin/sh
args:
- -c
- |
docker push gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-nginx-web:$SHORT_SHA
docker push gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-nginx-web:latest
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: /bin/sh
secretEnv: ['GIT_ACCESS_TOKEN']
args:
- '-c'
- |
git clone https://mvnrs:$$GIT_ACCESS_TOKEN@github.com/MVnRs/rentsoft_service_ob-deployment.git -b ${_CD_BRANCH}
echo "Updating image tag version ..."
cd rentsoft_service_ob-deployment
sed "s/GOOGLE_CLOUD_PROJECT/$PROJECT_ID/g" ${_ENV}/deployment.yaml.tpl | \
sed "s/COMMIT_SHA/${SHORT_SHA}/g" > ${_ENV}/deployment.yaml
echo "Pushing changes to k8s manifest repo ..."
git config --global user.name "Automatic build"
git config --global user.email "dev@rentsoft.de"
git add -A
git commit -m "[Cloud Builder] Updated image tag $SHORT_SHA from commit ${COMMIT_SHA}."
git push https://mvnrs:$$GIT_ACCESS_TOKEN@github.com/MVnRs/rentsoft_service_ob-deployment.git ${_CD_BRANCH}
options:
machineType: 'N1_HIGHCPU_8'
timeout: 2400s
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_NUMBER/secrets/github-access-token/versions/latest
env: 'GIT_ACCESS_TOKEN'
images: [
'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-php-fpm-web:latest',
'gcr.io/$PROJECT_ID/argo-${_ENV}-rentsoft-service-ob-nginx-web:latest'
]