diff --git a/Jenkinsfile_CI b/Jenkinsfile_CI deleted file mode 100644 index c4459b9..0000000 --- a/Jenkinsfile_CI +++ /dev/null @@ -1,62 +0,0 @@ -pipeline { - agent any - - tools { - nodejs 'nodejs23' - } - - environment { - SCANNER_HOME = tool 'sonar-scanner' - } - stages { - stage('Git Checkout') { - steps { - git branch: 'dev', url: 'https://github.com/jaiswaladi246/3-Tier-DevSecOps-Mega-Project.git' - } - } - - stage('Frontend Compilation') { - steps { - dir('client') { - sh 'find . -name "*.js" -exec node --check {} +' - } - } - } - - stage('Backend Compilation') { - steps { - dir('api') { - sh 'find . -name "*.js" -exec node --check {} +' - } - } - } - - stage('GitLeaks Scan') { - steps { - sh 'gitleaks detect --source ./client --exit-code 1' - sh 'gitleaks detect --source ./api --exit-code 1' - } - } - - stage('SonarQube Analysis') { - steps { - withSonarQubeEnv('sonar') { - sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=NodeJS-Project \ - -Dsonar.projectKey=NodeJS-Project ''' - } - } - } - stage('Quality Gate Check') { - steps { - timeout(time: 1, unit: 'HOURS') { - waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' - } - } - } - stage('Trivy FS Scan') { - steps { - sh 'trivy fs --format table -o fs-report.html .' - } - } - } -} diff --git a/api/.env b/api/.env index 198ff73..bb60ab6 100644 --- a/api/.env +++ b/api/.env @@ -1,6 +1,6 @@ -DB_HOST=localhost -DB_USER=root -DB_PASSWORD=Aditya -DB_NAME=crud_app -JWT_SECRET=devopsShackSuperSecretKey +#DB_HOST=localhost +#DB_USER=root +#DB_PASSWORD=Aditya +#DB_NAME=crud_app +#JWT_SECRET=devopsShackSuperSecretKey diff --git a/jenkins-ci.yaml b/jenkins-ci.yaml new file mode 100644 index 0000000..f51a6ea --- /dev/null +++ b/jenkins-ci.yaml @@ -0,0 +1,56 @@ +pipeline { + agent any + tools { + nodejs 'nodejs25' + } + + environment { + SCANNER_HOME = tool 'sonar-scanner' + } + stages { + stage('Git checkout') { + steps { + git branch: 'local-dev', url: 'https://github.com/dina0062/3-Tier-DevSecOps-Mega-Project.git' + } + } + stage('Frontend compilation') { + steps { + dir('client') { + sh 'find . -name "*.js" -exec node --check {} +' + } + } + } + + stage('backend compilation') { + steps { + dir('api') { + sh 'find . -name "*.js" -exec node --check {} +' + } + } + } + + + stage('Sonar qube') { + steps { + withSonarQubeEnv('sonar') { + sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=NodeJS-PROJECT \ + -Dsonar.projectKey=NodeJS-project ''' + } + } + } + + stage('Quality Gate Check') { + steps { + timeout(1) { + waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' + } + } + } + + stage('trivy') { + steps { + sh 'trivy fs --format table -o fs-report.html .' + } + } + } +}