Skip to content

Commit a41bca2

Browse files
committed
Update CI, CD
1 parent 85f54e1 commit a41bca2

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

.github/workflows/deploymentCd.yaml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,32 @@ jobs:
3030
mvn clean
3131
mvn -B package --file pom.xml
3232
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-
45-
- name: Set cluster context
33+
- name: Install OpenVPN
34+
run: sudo apt-get update && sudo apt-get install -y openvpn
35+
36+
- name: Connect to VPN
37+
env:
38+
VPN_USERNAME: ${{ secrets.VPN_USERNAME }}
39+
VPN_PASSWORD: ${{ secrets.VPN_PASSWORD }}
4640
run: |
47-
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.ZONE }} --project ${{ env.PROJECT_ID }}
41+
echo "${{ secrets.VPN_PROFILE_BASE64 }}" | base64 --decode > profile-559.ovpn
42+
echo -e "${VPN_USERNAME}\n${VPN_PASSWORD}" > vpn-auth.txt
43+
sudo openvpn --config profile-559.ovpn --auth-user-pass vpn-auth.txt --daemon
44+
sleep 10
45+
rm vpn-auth.txt
46+
rm profile-559.ovpn
47+
48+
- name: Deploy to Server
49+
uses: appleboy/[email protected]
50+
with:
51+
host: ${{ secrets.SERVER_HOST }}
52+
username: ${{ secrets.SERVER_USERNAME }}
53+
key: ${{ secrets.SERVER_SSH_KEY }}
54+
script: |
55+
cd /home/ubuntu/K8S
56+
sudo kubectl apply -f video-mongo-deployment.yaml
57+
sudo kubectl apply -f video-service-deployment.yaml
4858
49-
- name: Apply Kubernetes manifests
50-
run: |
51-
kubectl apply -f resources.yaml
52-
5359
notifications:
5460
needs: deploy
5561
uses: ./.github/workflows/notifyCD.yaml

.github/workflows/main.yaml

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

30-
# sonar_cloud_scan:
31-
# needs: testing
32-
# uses: ./.github/workflows/SonarQube.yaml
33-
# secrets:
34-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
30+
sonar_cloud_scan:
31+
needs: testing
32+
uses: ./.github/workflows/SonarQube.yaml
33+
secrets:
34+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3535

3636
build-image:
3737
needs: testing
3838
uses: ./.github/workflows/build-image.yaml
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

0 commit comments

Comments
 (0)