-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
71 lines (65 loc) · 1.84 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
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
substitutions:
_CD_REPO: schedulytics-environment
steps:
# Build the image and push it to GCR (with Kaniko caching for quick consecutive builds)
- name: 'gcr.io/kaniko-project/executor:latest'
args:
- --destination=gcr.io/$PROJECT_ID/schedulytics-frontend:$COMMIT_SHA
- --cache=true
- --cache-ttl=12h
# Make changes to the schedulytics-environment GitHub project
- name: gcr.io/cloud-builders/gcloud
id: Acquire SSH key for GitHub from SecretManager
entrypoint: 'bash'
args:
- '-c'
- 'gcloud secrets versions access latest --secret=schedulytics-environment-ssh > /root/.ssh/id_rsa'
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
id: Setup git with key and domain
entrypoint: 'bash'
args:
- '-c'
- |
chmod 600 /root/.ssh/id_rsa
ssh-keyscan github.com > /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
id: Clone the repository
args:
- clone
- git@github.com:noltedennis/schedulytics-environment
volumes:
- name: 'ssh'
path: /root/.ssh
- name: gcr.io/$PROJECT_ID/yq
id: Update chart
dir: $_CD_REPO/charts
args:
- yq
- write
- '-i'
- schedulytics-frontend/values.yaml
- image.tag
- $COMMIT_SHA
- name: 'gcr.io/cloud-builders/git'
id: Commit and push build changes
dir: $_CD_REPO
entrypoint: 'bash'
args:
- '-c'
- |
git config --global user.email "dennis_nolte@gmx.com"
if [ -n "$(git status --porcelain)" ]; then
git add -A
git commit -m 'CI: ${COMMIT_SHA} Author: $(git log --format="%an <%ae>" -n 1 HEAD)'
git pull
git push
fi
volumes:
- name: 'ssh'
path: /root/.ssh