-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild-tag.yaml
42 lines (38 loc) · 1.36 KB
/
cloudbuild-tag.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
steps:
# Access the id_github file from Secret Manager, and setup SSH
- name: 'gcr.io/cloud-builders/git'
secretEnv: ['SSH_KEY']
entrypoint: 'bash'
args:
- -c
- |
echo "$$SSH_KEY" >> /root/.ssh/id_rsa
chmod 400 /root/.ssh/id_rsa
cp known_hosts.github /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
# Get submodules
- name: 'gcr.io/cloud-builders/git'
args: [ 'submodule', 'update', '--init', '--recursive' ]
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/kaniko-project/executor:latest'
args:
- --destination=gcr.io/$PROJECT_ID/deployer:${_IMAGE_TAG_MINOR}
- --destination=gcr.io/$PROJECT_ID/deployer:${_IMAGE_TAG_MAJOR}
- --destination=gcr.io/$PROJECT_ID/deployer:latest
- --destination=gcr.io/climate-engine-public/climate-engine/deployer:${_IMAGE_TAG_MINOR}
- --destination=gcr.io/climate-engine-public/climate-engine/deployer:${_IMAGE_TAG_MAJOR}
- --destination=gcr.io/climate-engine-public/climate-engine/deployer:latest
- --cache=true
- --cache-ttl=48h
- --dockerfile=Dockerfile
availableSecrets:
secretManager:
- versionName: projects/378574554703/secrets/cloudbuild-github-key/versions/latest
env: 'SSH_KEY'
substitutions:
_IMAGE_TAG_MINOR: ${TAG_NAME#v}
_IMAGE_TAG_MAJOR: ${_IMAGE_TAG_MINOR%.*}