diff --git a/CICD pipeline with maven and jenkins b/CICD pipeline with maven and jenkins new file mode 100644 index 00000000..c2f1bf28 --- /dev/null +++ b/CICD pipeline with maven and jenkins @@ -0,0 +1,79 @@ +name: CICD pipline with maven and jenkins + +on: [push, workflow_dispatch] + +jobs: + +CICDjob: + +runs-on: ubuntu-latest + +steps: + +- name: clone the repo on ubuntu server + +uses: actions/checkout@v4 + +- name: install java and maven on ubuntu server + +uses: actions/setup-java@v3 + +with: + +java-version: 11 + +cache: 'maven' + +distribution: 'temurin' + +- name: Build the source code and .war file + +run: mvn package + +- name: connect to lab and depoloy code on tomcat9 + +uses: cross-the-world/ssh-scp-ssh-pipelines@latest + +with: + +host: '3.109.48.70' + +port: 22 + +user: 'labuser' + +pass: 'Nuvelabs123$' + +connect_timeout: 10s + +first_ssh: | + +sudo chmod 777 /var/lib/tomcat9/webapps + +scp: | + +'./target/*.war' => /var/lib/tomcat9/webapps + +last_ssh: | + +sudo systemctl restart tomcat9 + +- name: Connect to lab and trigger Jenkins job to deploy code on tomcat9 + +uses: cross-the-world/ssh-scp-ssh-pipelines@latest + +with: + +host: '3.109.48.70' + +port: 22 + +user: 'labuser' + +pass: 'Nuvelabs123$' + +connect_timeout: 10s + +first_ssh: | + +sudo curl -l -u admin:115593825ca2975f5fdd181a936862d4db diff --git a/pom.xml b/pom.xml index 56cd7c17..ee101748 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,10 @@ org.apache.maven.plugins maven-compiler-plugin 3.10.1 + + 1.8 + 1.8 + org.apache.maven.plugins