forked from l2blackbelt/GameOfPureStrategy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
88 lines (73 loc) · 1.94 KB
/
cloudbuild.yaml
File metadata and controls
88 lines (73 loc) · 1.94 KB
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
80
81
82
83
84
85
86
87
88
# Decrypt the file containing the key
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --ciphertext-file=.ssh/id_rsa.enc
- --plaintext-file=/root/.ssh/id_rsa
- --location=global
- --keyring=my-keyring
- --key=github-key
volumes:
- name: 'ssh'
path: /root/.ssh
# Set up git with key and domain.
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
chmod 600 /root/.ssh/id_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/id_rsa
EOF
mv .ssh/known_hosts /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
# Use git clone.
- name: 'gcr.io/cloud-builders/git'
args:
- clone
- git@github.com:l2blackbelt/GameOfPureStrategy.git
env:
- 'GIT_SSH_COMMAND=ssh -v'
volumes:
- name: 'ssh'
path: /root/.ssh
#run docker scoreboard, exports data.json, bot_scores.md to current environment
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/docker', '.' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'run', 'gcr.io/$PROJECT_ID/docker']
volumes:
- name: 'ssh'
path: /root/.ssh
#create git commit
- name: 'gcr.io/cloud-builders/git'
args: ['config', '--global', 'user.email', "arosmith3@gmail.com"]
- name: 'gcr.io/cloud-builders/git'
args: ['-C', 'GameOfPureStrategy', 'status']
env:
- 'GIT_SSH_COMMAND=ssh -v'
- name: 'gcr.io/cloud-builders/git'
args: ['-C', 'GameOfPureStrategy', 'commit', '-m', 'Auto-Build']
volumes:
- name: 'ssh'
path: /root/.ssh
#git pull, using decrypted ssh key (in case there were updates while regression ran)
- name: 'gcr.io/cloud-builders/git'
args: ['-C', 'GameOfPureStrategy', 'pull']
volumes:
- name: 'ssh'
path: /root/.ssh
#git push, using decrypted ssh key
- name: 'gcr.io/cloud-builders/git'
args: ['-C', 'GameOfPureStrategy', 'push']
volumes:
- name: 'ssh'
path: /root/.ssh
images:
- 'gcr.io/$PROJECT_ID/docker'