forked from shivaaws69/Wisdom-School-Spring-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
55 lines (48 loc) · 1.47 KB
/
cloudbuild.yaml
File metadata and controls
55 lines (48 loc) · 1.47 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
steps:
# Step 1: Check out the repository (Cloud Build clones the source automatically)
- name: gcr.io/cloud-builders/git
entrypoint: "bash"
args:
- "-c"
- |
echo "$(newcommit)"
echo "Source code is already cloned by Cloud Build."
git fetch --unshallow
newcommit=$(git rev-parse --short=6 HEAD)
echo "Commit ID is: $newcommit"
echo "$newcommit" > /workspace/commit_id
# Step 2: Set up JDK (for Maven)
- name: gcr.io/cloud-builders/mvn
args:
- clean
- package
# Step 3: Authenticate to Google Cloud
- name: gcr.io/cloud-builders/gcloud
args:
- auth
- configure-docker
- asia-docker.pkg.dev
# Step 4: Build the Docker image
- name: gcr.io/cloud-builders/docker
entrypoint: "bash"
args:
- "-c"
# - |
- newcommit=$(cat /workspace/commit_id)
# ['build', '-t', 'asia-south1-docker.pkg.dev/${_PROJECT_ID}/newschool:${newcommit}','.']
- build
- "-t"
- asia-south1-docker.pkg.dev/aqueous-cortex-445305-m6/newschool:$(newcommit) .
- "."
# Step 5: Push the Docker image
- name: gcr.io/cloud-builders/docker
args:
- "-c"
- newcommit=$(cat /workspace/commit_id)
- push
- asia-south1-docker.pkg.dev/aqueous-cortex-445305-m6/newschool:$(newcommit) .
# images:
# - asia-docker.pkg.dev/$_PROJECT_ID/school/sch:$(newcommit) .
logsBucket: gs://school-build-logs
options:
logging: GCS_ONLY