Skip to content

Commit ce8f213

Browse files
committed
Change CI and Push image
1 parent 67b69c3 commit ce8f213

File tree

6 files changed

+200
-200
lines changed

6 files changed

+200
-200
lines changed

.github/workflows/SonarQube.yaml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# name: SonarCloud scan for User Services
2-
# on:
3-
# workflow_call:
4-
# secrets:
5-
# SONAR_TOKEN:
6-
# required: true
7-
# jobs:
8-
# sonar-cloud-scan:
9-
# name: Build and analyze
10-
# runs-on: ubuntu-latest
11-
# steps:
12-
# - uses: actions/checkout@v3
13-
# with:
14-
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
15-
# - name: Set up JDK 17
16-
# uses: actions/setup-java@v3
17-
# with:
18-
# java-version: 17
19-
# distribution: 'zulu' # Alternative distribution options are available.
20-
# - name: Cache SonarCloud packages
21-
# uses: actions/cache@v3
22-
# with:
23-
# path: ~/.sonar/cache
24-
# key: ${{ runner.os }}-sonar
25-
# restore-keys: ${{ runner.os }}-sonar
26-
# - name: Cache Maven packages
27-
# uses: actions/cache@v3
28-
# with:
29-
# path: ~/.m2
30-
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
31-
# restore-keys: ${{ runner.os }}-m2
32-
# - name: Build and analyze
33-
# env:
34-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
35-
# run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=DevOps-Video-Sharing_UserService
1+
name: SonarCloud scan for User Services
2+
on:
3+
workflow_call:
4+
secrets:
5+
SONAR_TOKEN:
6+
required: true
7+
jobs:
8+
sonar-cloud-scan:
9+
name: Build and analyze
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
15+
- name: Set up JDK 17
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: 17
19+
distribution: 'zulu' # Alternative distribution options are available.
20+
- name: Cache SonarCloud packages
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.sonar/cache
24+
key: ${{ runner.os }}-sonar
25+
restore-keys: ${{ runner.os }}-sonar
26+
- name: Cache Maven packages
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.m2
30+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
31+
restore-keys: ${{ runner.os }}-m2
32+
- name: Build and analyze
33+
env:
34+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
35+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=DevOps-Video-Sharing_UserService
Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
# name: Continuous Deployment for User Service
2-
3-
# on:
4-
# workflow_run:
5-
# workflows: ["Continuous Integration for Comment Service"]
6-
# types:
7-
# - completed
8-
9-
# env:
10-
# PROJECT_ID: gke-project-423206
11-
# CLUSTER_NAME: autopilot-cluster-1
12-
# ZONE: us-central1
13-
14-
# jobs:
15-
# deploy:
16-
# name: Deploy to GKE Autopilot
17-
# runs-on: ubuntu-latest
18-
# steps:
19-
# - name: Checkout code
20-
# uses: actions/checkout@v3
21-
22-
# - name: Setup JDK 17
23-
# uses: actions/setup-java@v3
24-
# with:
25-
# distribution: 'corretto'
26-
# java-version: 17
27-
28-
# - name: Build the application
29-
# run: |
30-
# mvn clean
31-
# mvn -B package --file pom.xml
32-
33-
# - name: Authenticate
34-
# uses: google-github-actions/auth@v2
35-
# with:
36-
# credentials_json: ${{ secrets.GCP_SA_KEY }}
37-
38-
# - name: Configure gcloud
39-
# uses: google-github-actions/setup-gcloud@v2
40-
# with:
41-
# project_id: ${{ env.PROJECT_ID }}
42-
# install_components: 'gke-gcloud-auth-plugin'
43-
44-
# - name: Set cluster context
45-
# run: |
46-
# gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.ZONE }} --project ${{ env.PROJECT_ID }}
47-
48-
# - name: Apply Kubernetes manifests
49-
# run: |
50-
# kubectl apply -f resources.yaml
51-
52-
# notifications:
53-
# needs: deploy
54-
# uses: ./.github/workflows/notifyCD.yaml
55-
# secrets:
56-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL}}
1+
name: Continuous Deployment for User Service
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Continuous Integration for Comment Service"]
6+
types:
7+
- completed
8+
9+
env:
10+
PROJECT_ID: gke-project-423206
11+
CLUSTER_NAME: autopilot-cluster-1
12+
ZONE: us-central1
13+
14+
jobs:
15+
deploy:
16+
name: Deploy to GKE Autopilot
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
- name: Setup JDK 17
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: 'corretto'
26+
java-version: 17
27+
28+
- name: Build the application
29+
run: |
30+
mvn clean
31+
mvn -B package --file pom.xml
32+
33+
- name: Authenticate
34+
uses: google-github-actions/auth@v2
35+
with:
36+
credentials_json: ${{ secrets.GCP_SA_KEY }}
37+
38+
- name: Configure gcloud
39+
uses: google-github-actions/setup-gcloud@v2
40+
with:
41+
project_id: ${{ env.PROJECT_ID }}
42+
install_components: 'gke-gcloud-auth-plugin'
43+
44+
- name: Set cluster context
45+
run: |
46+
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.ZONE }} --project ${{ env.PROJECT_ID }}
47+
48+
- name: Apply Kubernetes manifests
49+
run: |
50+
kubectl apply -f resources.yaml
51+
52+
notifications:
53+
needs: deploy
54+
uses: ./.github/workflows/notifyCD.yaml
55+
secrets:
56+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL}}

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Continuous Integration for User Service
33
on:
44
push:
55
branches:
6-
- QA
6+
- main
77

88
jobs:
99
testing:

.github/workflows/notifyCD.yaml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
# name: Send Slack Notification for User Service
1+
name: Send Slack Notification for User Service
22

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

9-
# jobs:
10-
# success_notifier:
11-
# if: success()
12-
# runs-on: ubuntu-latest
13-
# steps:
14-
# - name: Send success notification on Slack
15-
# uses: slackapi/[email protected]
16-
# with:
17-
# payload: |
18-
# {
19-
# "text": "The Continuous Deployment for User Service workflow has completed successfully."
20-
# }
21-
# env:
22-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
9+
jobs:
10+
success_notifier:
11+
if: success()
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Send success notification on Slack
15+
uses: slackapi/[email protected]
16+
with:
17+
payload: |
18+
{
19+
"text": "The Continuous Deployment for User Service workflow has completed successfully."
20+
}
21+
env:
22+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
2323

24-
# failure_notifier:
25-
# if: failure()
26-
# runs-on: ubuntu-latest
27-
# steps:
28-
# - name: Send failure notification on Slack
29-
# uses: slackapi/[email protected]
30-
# with:
31-
# payload: |
32-
# {
33-
# "text": "The Continuous Deployment for User Service workflow has failed."
34-
# }
35-
# env:
36-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
24+
failure_notifier:
25+
if: failure()
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Send failure notification on Slack
29+
uses: slackapi/[email protected]
30+
with:
31+
payload: |
32+
{
33+
"text": "The Continuous Deployment for User Service workflow has failed."
34+
}
35+
env:
36+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/notifyCI.yaml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
# name: Send Slack Notification for User Service
1+
name: Send Slack Notification for User Service
22

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

9-
# jobs:
10-
# success_notifier:
11-
# if: success()
12-
# runs-on: ubuntu-latest
13-
# steps:
14-
# - name: Send success notification on Slack
15-
# uses: slackapi/[email protected]
16-
# with:
17-
# payload: |
18-
# {
19-
# "text": "The Continuous Integration for User Service workflow has completed successfully."
20-
# }
21-
# env:
22-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
9+
jobs:
10+
success_notifier:
11+
if: success()
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Send success notification on Slack
15+
uses: slackapi/[email protected]
16+
with:
17+
payload: |
18+
{
19+
"text": "The Continuous Integration for User Service workflow has completed successfully."
20+
}
21+
env:
22+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
2323

24-
# failure_notifier:
25-
# if: failure()
26-
# runs-on: ubuntu-latest
27-
# steps:
28-
# - name: Send failure notification on Slack
29-
# uses: slackapi/[email protected]
30-
# with:
31-
# payload: |
32-
# {
33-
# "text": "The Continuous Integration for User Service workflow has failed."
34-
# }
35-
# env:
36-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
24+
failure_notifier:
25+
if: failure()
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Send failure notification on Slack
29+
uses: slackapi/[email protected]
30+
with:
31+
payload: |
32+
{
33+
"text": "The Continuous Integration for User Service workflow has failed."
34+
}
35+
env:
36+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)