diff --git a/.github/workflows/mymaven.yml b/.github/workflows/mymaven.yml new file mode 100644 index 0000000..41ebb95 --- /dev/null +++ b/.github/workflows/mymaven.yml @@ -0,0 +1,43 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Java CI with Maven + +on: + push: + branches: [ sandbox ] + pull_request: + branches: [ sandbox ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Build & push Docker image + uses: mr-smithers-excellent/docker-build-push@v5 + with: + image: kidunnu/springappmongo4 + tags: v1, latest + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: send slack notification + uses: docker://technosophos/slack-notify + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_MESSAGE: Run succesfully + + diff --git a/jenkinsfilek8s b/jenkinsfilek8s new file mode 100644 index 0000000..0fc862a --- /dev/null +++ b/jenkinsfilek8s @@ -0,0 +1,51 @@ + +pipeline{ + agent any + tools{ + maven "maven3.8.4" + } +stages{ +stage('SCM Checkout'){ + steps{ + git 'https://github.com/Kidunnu/spring-boot-docker.git' +} +} +stage('maven-Build'){ +steps{ + sh "mvn clean package" + } +} +/*stage('code quality'){ +steps{ + sh "mvn sonar:sonar" + } +}*/ + +stage('approval'){ +steps{ +timeout (time:5, unit:'HOURS'){ +input message: "please verify and approve" +} +} +} +stage('Build Docker Image'){ +steps{ +sh "docker build -t kidunnu/spring-boot-mongo ." + } +} +stage('Push Docker Image'){ +steps{ + withCredentials([string(credentialsId: 'DockerHubCredential', variable: 'DockerHubCredential')]) { + sh "docker login -u kidunnu -p ${DockerHubCredential}" +} + sh "docker push kidunnu/spring-boot-mongo" +} +} +stage("Deploy To Kuberates Cluster"){ +steps{withKubeConfig(caCertificate: '', clusterName: '', contextName: '', credentialsId: 'k8ss', namespace: '', serverUrl: '') { + sh "kubectl apply -f springBootMongo.yml" + } +} +} +} +} diff --git a/pom.xml b/pom.xml index 52194fa..7c5aa7b 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,15 @@ 2.1.5.RELEASE Greenwich.RELEASE 6.1 + 1.8 + 5.1.2.RELEASE + 4.11 + 1.2.17 + http://localhost:8000 + admin + admin123 + UTF-8 + UTF-8 @@ -83,6 +92,22 @@ test + + + + nexus + Landmark Technologies Releases Nexus Repository + http://54.175.166.158:7079/repository/team_release + + + + nexus + Landmark Technologies Snapshot Nexus Repository + http://54.175.166.158:7079/repository/team_snapshot + + + + @@ -90,5 +115,6 @@ spring-boot-maven-plugin + - \ No newline at end of file + diff --git a/springBootMongo.yml b/springBootMongo.yml index acadb81..5f8d25f 100644 --- a/springBootMongo.yml +++ b/springBootMongo.yml @@ -24,7 +24,7 @@ spec: app: springboot spec: containers: - - image: mylandmarktech/springapp + - image: kidunnu/spring-boot-mongo name: springboot ports: - containerPort: 8080 diff --git a/springapp.yml b/springapp.yml index 0c7f627..3411a55 100644 --- a/springapp.yml +++ b/springapp.yml @@ -19,7 +19,7 @@ spec: spec: containers: - name: springappcontainer - image: mylandmarktech/spring-boot-mongo + image: kidunnu/spring-boot-mongo ports: - containerPort: 8080 env: