-
Notifications
You must be signed in to change notification settings - Fork 4
/
buildspec.yml
62 lines (48 loc) · 2.21 KB
/
buildspec.yml
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
version: 0.2
phases:
install:
runtime-versions:
golang: 1.13
pre_build:
commands:
- echo "Installing and downloading essentials"
- echo `pwd`
- mkdir ~/.kube
- aws s3 cp s3://itselavia-kops-state-store/.kube/config ~/.kube/config
- aws s3 cp s3://samkops-com-state-store/.kube/config ~/.kube/samarth
- aws s3 cp s3://itselavia-kops-state-store/nirbhay/config ~/.kube/nirbhay
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/amd64/kubectl
- chmod +x ./kubectl
- mv ./kubectl /usr/local/bin
build:
commands:
- echo "Starting the build"
- echo `pwd`
- cd backend/AnnouncementsMicroservice
- TAG=$(date +%s | sha256sum | base64 | head -c 10)
- docker build -t itselavia/announcements:$TAG .
- echo $DOCKER_HUB_PASSWORD | docker login --username itselavia --password-stdin
- docker push itselavia/announcements:$TAG
- cd ../GradingMicroservice
- docker build -t samarthkhatwani/grading_ms:$TAG .
- echo $SAMARTH_DOCKER_HUB_PASSWORD | docker login --username samarthkhatwani --password-stdin
- docker push samarthkhatwani/grading_ms:$TAG
- cd ../CoursesMicroservice
- docker build -t nirbhayk/courses_ms:$TAG .
- echo $NIRBHAY_DOCKER_HUB_PASSWORD | docker login --username nirbhayk --password-stdin
- docker push nirbhayk/courses_ms:$TAG
post_build:
commands:
- echo "Pushing to Kubernetes"
- cd ../AnnouncementsMicroservice
- sed -i "s/VERSION/${TAG}/g" AnnouncementsMicroservice.yaml
- /usr/local/bin/kubectl apply -f AnnouncementsMicroservice.yaml
- /usr/local/bin/kubectl get pods
- cd ../GradingMicroservice
- sed -i "s/VERSION/${TAG}/g" GradingManifest.yaml
- /usr/local/bin/kubectl apply -f GradingManifest.yaml --kubeconfig=/root/.kube/samarth
- /usr/local/bin/kubectl get pods --kubeconfig=/root/.kube/samarth
- cd ../CoursesMicroservice
- sed -i "s/VERSION/${TAG}/g" CoursesMicroservice.yaml
- /usr/local/bin/kubectl apply -f CoursesMicroservice.yaml --kubeconfig=/root/.kube/nirbhay
- /usr/local/bin/kubectl get pods --kubeconfig=/root/.kube/nirbhay