-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
97 lines (77 loc) · 3.16 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# steps:
# # Build the Docker image using the Docker Cloud Builder
# - name: 'gcr.io/cloud-builders/docker'
# args: ['build', '-t', 'REGION-docker.pkg.dev/$PROJECT_ID/YOUR_ARTIFACT_REGISTRY_NAME/YOUR_IMAGE_NAME:$COMMIT_SHA', '.']
# # Push the image to Google Artifact Registry
# - name: 'gcr.io/cloud-builders/docker'
# args: ['push', 'REGION-docker.pkg.dev/$PROJECT_ID/YOUR_ARTIFACT_REGISTRY_NAME/YOUR_IMAGE_NAME:$COMMIT_SHA']
# Deploy the container to Google Cloud Run
# - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
# entrypoint: 'gcloud'
# args:
# - 'run'
# - 'deploy'
# - '<YOUR-GOOGLE-CLOUD-RUN-SERVICE>'
# - '--image'
# - '<YOUR-ARTIFACT-REGISTRY-PATH>:$COMMIT_SHA'
# - '--region'
# - '<YOUR-GOOGLE-CLOUD-RUN-REGION>'
# - '--platform'
# - 'managed'
# - '--allow-unauthenticated' # Use '--no-allow-unauthenticated' if you don't want to allow unauthenticated access
# options:
# # Set logs bucket behavior to create a user-owned logs bucket in the same region as the build project
# logging: 'REGIONAL_USER_OWNED_BUCKET'
# images:
# - 'REGION-docker.pkg.dev/$PROJECT_ID/YOUR_ARTIFACT_REGISTRY_NAME/YOUR_IMAGE_NAME:$COMMIT_SHA'
steps:
# Build the Docker image using the Docker Cloud Builder
- name: 'gcr.io/cloud-builders/docker'
# args: ['build', '-t', 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:$COMMIT_SHA', '.']
args: ['build', '-t', 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:latest', '-t', 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:$COMMIT_SHA', '.']
# Push the image to Google Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:latest']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:$COMMIT_SHA']
# Deploy the container to Google Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'gcloud'
args:
- 'run'
- 'deploy'
- 'devops-lab2'
- '--image'
- 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:latest'
- '--region'
- 'us-central1'
- '--platform'
- 'managed'
- '--allow-unauthenticated' # Use '--no-allow-unauthenticated' if you don't want to allow unauthenticated access
# options:
# # Set logs bucket behavior to create a user-owned logs bucket in the same region as the build project
# logging: 'febin-log'
images:
- 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:latest'
- 'us-central1-docker.pkg.dev/ci-lab-412213/febin-100912966/devops-lab2:$COMMIT_SHA'
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:StartInstances",
"ec2:StopInstances"
],
"Resource": "arn:aws:ec2:ca-central-1:846116578401:instance/i-0f4a4eb97ca6f7e7e"
},
{
"Effect": "Allow",
"Action": "rds:*",
"Resource": "arn:aws:rds:ca-central-1:846116578401:db:stephen-dbr"
}
]
}
846116578401
Backend-dev - Gaza875790