-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
53 lines (51 loc) · 1.77 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
steps:
- 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
- name: gcr.io/cloud-builders/git
id: 'fetch-git-repo'
entrypoint: bash
args:
- -c
- |
git remote set-url origin '[email protected]:Go-Ideal-Software-LLC/<project-id>'
git fetch --unshallow
volumes:
- name: 'ssh'
path: /root/.ssh
- name: node:18
id: 'npm-install'
entrypoint: npm
args: ['install']
- name: 'gcr.io/cloud-builders/docker'
id: 'build-hello-docker-image'
args: ['build', '-t', 'us-central1-docker.pkg.dev/<project-id>/<project-id>/hello:$BUILD_ID', '-f', 'Dockerfile.hello', '.']
- name: 'gcr.io/cloud-builders/docker'
id: 'push-hello-docker-image'
args: ['push', 'us-central1-docker.pkg.dev/<project-id>/<project-id>/hello:$BUILD_ID']
waitFor: ['build-hello-docker-image']
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
id: "deploy-hello-to-dev"
entrypoint: 'bash'
args:
- '-c'
- |
gcloud deploy releases create release-$(date '+%Y%m%d-%H%M%S') --skaffold-file skaffold.hello.yaml --delivery-pipeline hello-deployment-pipeline --region us-central1 --images hello_app=us-central1-docker.pkg.dev/<project-id>/<project-id>/hello:$BUILD_ID
waitFor: ['push-hello-docker-image']
availableSecrets:
secretManager:
- versionName: projects/796283614197/secrets/Github-clone-build-blog/versions/latest
env: 'SSH_KEY'
options:
logging: CLOUD_LOGGING_ONLY
pool:
name: 'projects/go-ideal-software-websites/locations/us-central1/workerPools/go-ideal-software-websites-pp'