diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml
new file mode 100644
index 00000000..97d38d2e
--- /dev/null
+++ b/.github/workflows/cicd.yml
@@ -0,0 +1,94 @@
+name: CICD Pipeline
+
+on:
+ push:
+ branches: [ "main" ]
+
+jobs:
+ build:
+
+ runs-on: self-hosted
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ cache: maven
+ - name: Install Maven
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y maven
+
+ - name: Build with Maven
+ run: mvn package --file pom.xml
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: Boardgame
+ path: target/*.jar
+
+ - name: Install Trivy
+ run: |
+ sudo apt-get install -y wget apt-transport-https gnupg lsb-release
+ curl -fsSL https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
+ echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/trivy.list > /dev/null
+ sudo apt-get update
+ sudo apt-get install -y trivy
+
+ - name: Trivy FS Scan
+ run:
+ trivy fs --format table -o trivy-fs-report.html .
+
+ - name: Install unzip
+ run: sudo apt-get update && sudo apt-get install -y unzip jq maven
+
+ - name: SonarQube Scan
+ uses: sonarsource/sonarqube-scan-action@master
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
+
+ - name: SonarQube Quality Gate check
+ id: sonarqube-quality-gate-check
+ uses: sonarsource/sonarqube-quality-gate-action@master
+ timeout-minutes: 5
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker Image
+ timeout-minutes: 20
+ run: |
+ docker build -t nuruzzaman24x/boardgame:latest .
+
+ - name: Trivy Image Scan
+ run: |
+ trivy image --format table -o trivy-image-report.html nuruzzaman24x/boardgame:latest
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Push Docker Image
+ run: |
+ docker push nuruzzaman24x/boardgame:latest
+
+ - name: Kubectl Action
+ uses: tale/kubectl-action@v1
+ with:
+ base64-kube-config: ${{ secrets.KUBE_CONFIG }}
+ - run: |
+ kubectl apply -f deployment-service.yaml -n webapps
+ kubectl get svc -n webapps
+
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
deleted file mode 100644
index 0c458d82..00000000
--- a/.github/workflows/maven.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-name: Java CI with Maven
-
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
-
-jobs:
- build:
-
- runs-on: self-hosted
-
- steps:
- - uses: actions/checkout@v4
- - name: Set up JDK 17
- uses: actions/setup-java@v3
- with:
- java-version: '17'
- distribution: 'temurin'
- cache: maven
- - name: Build with Maven
- run: mvn -B package --file pom.xml
-
- - name: Trivy FS scan
- run: |
- trivy fs --format table -o fs.html .
-
- - name: SonarQube Scan
- uses: sonarsource/sonarqube-scan-action@master
- env:
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
-
- - name: SonarQube Quality Gate check
- id: sonarqube-quality-gate-check
- uses: sonarsource/sonarqube-quality-gate-action@master
- # Force to fail step after specific time.
- timeout-minutes: 5
- env:
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
-
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
- - name: Build Docker Image
- run: |
- docker build -t adijaiswal/boardgame:latest .
-
- - name: Trivy Image Scan
- run: |
- trivy image --format table -o trivy-image-report.html adijaiswal/board:latest
-
- - name: Login to Docker Hub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
-
- - name: Push Docker Image
- run: |
- docker push adijaiswal/boardgame:latest
-
-
-
-
diff --git a/.github/workflows/maven2.yml b/.github/workflows/maven2.yml
deleted file mode 100644
index 52f5c5ce..00000000
--- a/.github/workflows/maven2.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-name: Java CI with Maven
-
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
- - name: Set up JDK 17
- uses: actions/setup-java@v4
- with:
- java-version: '17'
- distribution: 'temurin'
- cache: maven
- - name: Build with Maven
- run: mvn -B package --file pom.xml
-
-
diff --git a/Dockerfile b/Dockerfile
index c717f3d9..c8fc096c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,10 @@
-FROM openjdk:17-alpine
+FROM adoptopenjdk/openjdk11
EXPOSE 8080
ENV APP_HOME /usr/src/app
-COPY target/*.jar $APP_HOME/app.jar
+COPY artifact/*.jar $APP_HOME/app.jar
WORKDIR $APP_HOME
diff --git a/deployment-service.yaml b/deployment-service.yaml
index c735026a..8b0b5014 100644
--- a/deployment-service.yaml
+++ b/deployment-service.yaml
@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: boardgame
- image: adijaiswal/boardshack:latest # Image that will be used to containers in the cluster
+ image: nuruzzaman24x/boardgame:latest # Image that will be used to containers in the cluster
imagePullPolicy: Always
ports:
- containerPort: 8080 # The port that the container is running on in the cluster
diff --git a/pom.xml b/pom.xml
index bc36443b..60d9f17a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
com.javaproject
database_service_project
- 0.0.7-SNAPSHOT
+ 0.0.6
database_service_project
Project for Spring Boot
jar
@@ -120,11 +120,11 @@
maven-releases
- http://13.201.64.186:8081/repository/maven-releases/
+ http://172.17.0.232:8081/repository/maven-releases
maven-snapshots
- http://13.201.64.186:8081/repository/maven-snapshots/
+ http://172.17.0.232:8081/repository/maven-snapshots/
diff --git a/test.txt b/test.txt
new file mode 100644
index 00000000..04d03f86
--- /dev/null
+++ b/test.txt
@@ -0,0 +1 @@
+aditya jaiswal