Skip to content

Commit b542e09

Browse files
committed
Update CI CD
1 parent ce6b014 commit b542e09

File tree

5 files changed

+41
-111
lines changed

5 files changed

+41
-111
lines changed

.github/workflows/deploymentCD.yaml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,36 @@ jobs:
1919
distribution: 'corretto'
2020
java-version: 17
2121

22-
- name: Authenticate
23-
uses: google-github-actions/auth@v2
24-
with:
25-
credentials_json: ${{ secrets.GCP_SA_KEY }}
26-
27-
- name: Configure gcloud
28-
uses: google-github-actions/setup-gcloud@v2
22+
- name: Install OpenVPN
23+
run: sudo apt-get update && sudo apt-get install -y openvpn
24+
25+
- name: Connect to VPN
26+
env:
27+
VPN_USERNAME: ${{ secrets.VPN_USERNAME }}
28+
VPN_PASSWORD: ${{ secrets.VPN_PASSWORD }}
29+
run: |
30+
echo "${{ secrets.VPN_PROFILE_BASE64 }}" | base64 --decode > profile-559.ovpn
31+
echo -e "${VPN_USERNAME}\n${VPN_PASSWORD}" > vpn-auth.txt
32+
sudo openvpn --config profile-559.ovpn --auth-user-pass vpn-auth.txt --daemon
33+
sleep 10
34+
rm vpn-auth.txt
35+
rm profile-559.ovpn
36+
37+
- name: Deploy to Server
38+
uses: appleboy/[email protected]
2939
with:
30-
project_id: ${{ env.PROJECT_ID }}
31-
install_components: 'gke-gcloud-auth-plugin'
40+
host: ${{ secrets.SERVER_HOST }}
41+
username: ${{ secrets.SERVER_USERNAME }}
42+
key: ${{ secrets.SERVER_SSH_KEY }}
43+
script: |
44+
cd /home/ubuntu/K8S
45+
sudo kubectl apply -f comment-mongo-deployment.yaml
46+
sudo kubectl apply -f comment-service-deployment.yaml
3247
33-
- name: Set cluster context
34-
run: |
35-
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.ZONE }} --project ${{ env.PROJECT_ID }}
3648
37-
- name: Apply Kubernetes manifests for application
38-
run: |
39-
kubectl apply -f resources.yaml
49+
# - name: Apply Kubernetes manifests
50+
# run: |
51+
# kubectl apply -f resources.yaml
4052

4153
notify:
4254
needs: deploy

.github/workflows/main.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
- name: Unit Tests
2727
run: mvn -B test --file pom.xml
2828

29-
# sonarQube-scan:
30-
# needs: testing
31-
# uses: ./.github/workflows/sonarqube.yaml
32-
# secrets:
33-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
29+
sonarQube-scan:
30+
needs: testing
31+
uses: ./.github/workflows/sonarqube.yaml
32+
secrets:
33+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3434

3535

3636
build-image:
@@ -39,12 +39,12 @@ jobs:
3939
secrets:
4040
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
4141

42-
# scan-image:
43-
# needs: build-image
44-
# uses: ./.github/workflows/scan-image.yaml
42+
scan-image:
43+
needs: build-image
44+
uses: ./.github/workflows/scan-image.yaml
4545

46-
# notify:
47-
# needs: scan-image
48-
# uses: ./.github/workflows/notifyCI.yaml
49-
# secrets:
50-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
46+
notify:
47+
needs: scan-image
48+
uses: ./.github/workflows/notifyCI.yaml
49+
secrets:
50+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/scan-image.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
' scan-results.json > vulnerability-report.md
4141
4242
- name: Upload vulnerability report
43-
uses: actions/upload-artifact@v2
43+
uses: actions/upload-artifact@v4
4444
with:
4545
name: vulnerability-report
4646
path: vulnerability-report.md

database.yaml

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

resources.yaml

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

0 commit comments

Comments
 (0)