Skip to content

Commit 9ab2253

Browse files
committed
Update CI
1 parent 7a16806 commit 9ab2253

File tree

9 files changed

+260
-371
lines changed

9 files changed

+260
-371
lines changed

.github/workflows/ArgoCD.yaml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/workflows/applyK8S.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/build-image.yaml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
# name: Build Image Comment Service
1+
name: Build Image Comment Service
22

3-
# on:
4-
# workflow_call:
5-
# secrets:
6-
# DOCKER_HUB_ACCESS_TOKEN:
7-
# required: true
3+
on:
4+
workflow_call:
5+
secrets:
6+
DOCKER_HUB_ACCESS_TOKEN:
7+
required: true
88

9-
# jobs:
10-
# build-image:
11-
# name: Build and Push Docker Image
12-
# runs-on: ubuntu-latest
13-
# steps:
14-
# - name: Checkout code
15-
# uses: actions/checkout@v3
9+
jobs:
10+
build-image:
11+
name: Build and Push Docker Image
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
1616

17-
# - name: Setup JDK 17
18-
# uses: actions/setup-java@v3
19-
# with:
20-
# distribution: 'corretto'
21-
# java-version: 17
17+
- name: Setup JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
distribution: 'corretto'
21+
java-version: 17
2222

23-
# - name: Login to Docker Hub
24-
# uses: docker/login-action@v2
25-
# with:
26-
# username: datuits
27-
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
23+
- name: Login to Docker Hub
24+
uses: docker/login-action@v2
25+
with:
26+
username: datuits
27+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
2828

29-
# - name: Build the application
30-
# run: |
31-
# mvn clean
32-
# mvn -B package --file pom.xml
29+
- name: Build the application
30+
run: |
31+
mvn clean
32+
mvn -B package --file pom.xml
3333
34-
# - name: Build and Push the docker image
35-
# run: |
36-
# docker build -t datuits/devops-comment-service:latest .
37-
# docker push datuits/devops-comment-service:latest
34+
- name: Build and Push the docker image
35+
run: |
36+
docker build -t datuits/devops-comment-service:latest .
37+
docker push datuits/devops-comment-service:latest
Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,46 @@
1-
# name: Continuous Deployment for Comment Service
1+
name: Continuous Deployment for Comment Service
22

3-
# on:
4-
# push:
5-
# branches:
6-
# - main
7-
# env:
8-
# PROJECT_ID=gke-project-423206
9-
# CLUSTER_NAME=autopilot-cluster-1
10-
# ZONE=us-central1
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
name: Deploy to GKE Autopilot
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
1115

12-
# jobs:
13-
# deploy:
14-
# name: Deploy to GKE Autopilot
15-
# runs-on: ubuntu-latest
16-
# steps:
17-
# - name: Checkout code
18-
# uses: actions/checkout@v3
19-
20-
# - name: Setup JDK 17
21-
# uses: actions/setup-java@v3
22-
# with:
23-
# distribution: 'corretto'
24-
# java-version: 17
16+
- name: Setup JDK 17
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: 'corretto'
20+
java-version: 17
2521

26-
# - name: Authenticate
27-
# uses: google-github-actions/auth@v2
28-
# with:
29-
# credentials_json: ${{ secrets.GCP_SA_KEY }}
22+
- name: Authenticate
23+
uses: google-github-actions/auth@v2
24+
with:
25+
credentials_json: ${{ secrets.GCP_SA_KEY }}
3026

31-
# - name: Configure gcloud
32-
# uses: google-github-actions/setup-gcloud@v2
33-
# with:
34-
# project_id: ${{ env.PROJECT_ID }}
35-
# install_components: 'gke-gcloud-auth-plugin'
27+
- name: Configure gcloud
28+
uses: google-github-actions/setup-gcloud@v2
29+
with:
30+
project_id: ${{ env.PROJECT_ID }}
31+
install_components: 'gke-gcloud-auth-plugin'
3632

37-
# - name: Set cluster context
38-
# run: |
39-
# gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.ZONE }} --project ${{ env.PROJECT_ID }}
33+
- name: Set cluster context
34+
run: |
35+
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.ZONE }} --project ${{ env.PROJECT_ID }}
4036
41-
# - name: Apply Kubernetes manifests for application
42-
# run: |
43-
# kubectl apply -f resources.yaml
37+
- name: Apply Kubernetes manifests for application
38+
run: |
39+
kubectl apply -f resources.yaml
4440
45-
# notify:
46-
# needs: deploy
47-
# uses: ./.github/workflows/notifyCD.yaml
48-
# secrets:
49-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
41+
notify:
42+
needs: deploy
43+
uses: ./.github/workflows/notifyCD.yaml
44+
secrets:
45+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
5046

.github/workflows/main.yaml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
# name: Continuous Integration for Comment Service
2-
3-
# on:
4-
# push:
5-
# branches:
6-
# - main
7-
8-
# jobs:
9-
# testing:
10-
# name: Testing Comment Service
11-
# runs-on: ubuntu-latest
12-
# steps:
13-
14-
# - name: Checkout code
15-
# uses: actions/checkout@v3
16-
17-
# - name: Setup JDK 17
18-
# uses: actions/setup-java@v3
19-
# with:
20-
# distribution: 'corretto'
21-
# java-version: 17
22-
23-
# - name: Set up MongoDB URI
24-
# run: echo "SPRING_DATA_MONGODB_URI=mongodb://localhost:27017/comment-service" >> $GITHUB_ENV
25-
26-
# - name: Unit Tests
27-
# run: mvn -B test --file pom.xml
28-
29-
# sonarQube-scan:
30-
# needs: testing
31-
# uses: ./.github/workflows/sonarqube.yaml
32-
# secrets:
33-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1+
name: Continuous Integration for Comment Service
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
testing:
10+
name: Testing Comment Service
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Setup JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
distribution: 'corretto'
21+
java-version: 17
22+
23+
- name: Set up MongoDB URI
24+
run: echo "SPRING_DATA_MONGODB_URI=mongodb://localhost:27017/comment-service" >> $GITHUB_ENV
25+
26+
- name: Unit Tests
27+
run: mvn -B test --file pom.xml
28+
29+
# sonarQube-scan:
30+
# needs: testing
31+
# uses: ./.github/workflows/sonarqube.yaml
32+
# secrets:
33+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3434

3535

36-
# build-image:
37-
# needs: testing
38-
# uses: ./.github/workflows/build-image.yaml
39-
# secrets:
40-
# DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
41-
42-
# scan-image:
43-
# needs: build-image
44-
# uses: ./.github/workflows/scan-image.yaml
45-
46-
# notify:
47-
# needs: scan-image
48-
# uses: ./.github/workflows/notifyCI.yaml
49-
# secrets:
50-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
36+
build-image:
37+
needs: testing
38+
uses: ./.github/workflows/build-image.yaml
39+
secrets:
40+
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
41+
42+
# scan-image:
43+
# needs: build-image
44+
# uses: ./.github/workflows/scan-image.yaml
45+
46+
# notify:
47+
# needs: scan-image
48+
# uses: ./.github/workflows/notifyCI.yaml
49+
# secrets:
50+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)