From c0b1d5a4e37d09126179cb6151ccaee16b7b61b0 Mon Sep 17 00:00:00 2001 From: Emmanuel Ezeali Date: Mon, 20 Jun 2022 20:15:37 -0400 Subject: [PATCH 01/14] Update .env.sample --- .env.sample | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.sample b/.env.sample index 1c39502a5..b7f940993 100644 --- a/.env.sample +++ b/.env.sample @@ -3,10 +3,12 @@ APP_DEBUG=true APP_KEY=SomeRandomString APP_URL=http://localhost -DB_HOST=127.0.0.1 +DB_HOST=172.31.34.157 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=sePret^i +DB_CONNECTION=mysql +DB_PORT=3306 CACHE_DRIVER=file SESSION_DRIVER=file @@ -21,4 +23,4 @@ MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null -MAIL_ENCRYPTION=null \ No newline at end of file +MAIL_ENCRYPTION=null From 41e1f2a54f7a508f5b10629cc5e6601ad78b45f8 Mon Sep 17 00:00:00 2001 From: Emmanuel Ezeali Date: Mon, 20 Jun 2022 20:18:21 -0400 Subject: [PATCH 02/14] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e4fb29ec9..82dfc18c0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { stage('Checkout SCM') { steps { - git branch: 'main', url: 'https://github.com/darey-devops/php-todo.git' + git branch: 'main', url: 'https://github.com/mexez/php-todo.git' } } @@ -110,4 +110,4 @@ stage ('Deploy to Dev Environment') { // } // } -} \ No newline at end of file +} From 2adde5a2b650474b26fe54600bb230ba44d6224f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Tue, 21 Jun 2022 19:27:16 +0000 Subject: [PATCH 03/14] jenkinsfile stages --- Jenkinsfile | 89 +++------------------------------------ README.md | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 83 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 82dfc18c0..a778022ef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,25 +1,23 @@ pipeline { agent any - stages { - stage("Initial cleanup") { + stage("Initial cleanup") { steps { dir("${WORKSPACE}") { deleteDir() } } } - + stage('Checkout SCM') { steps { git branch: 'main', url: 'https://github.com/mexez/php-todo.git' } } - - stage('Install Dependencies') { + stage('Prepare Dependencies') { steps { sh 'mv .env.sample .env' sh 'composer install' @@ -28,86 +26,11 @@ pipeline { sh 'php artisan key:generate' } } - stage('Execute Unit Tests') { steps { - sh './vendor/bin/phpunit --log-junit reports/unitreport.xml' - } - } - - - stage('Publish & Plot Code Coverage Report') { - steps { - sh 'phploc app/ --log-csv build/logs/phploc.csv' + sh './vendor/bin/phpunit' + } - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Lines of Code (LOC),Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Logical Lines of Code (LLOC) ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'A - Lines of code', yaxis: 'Lines of Code' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Directories,Files,Namespaces', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'B - Structures Containers', yaxis: 'Count' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Average Class Length (LLOC),Average Method Length (LLOC),Average Function Length (LLOC)', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'C - Average Length', yaxis: 'Average Lines of Code' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Cyclomatic Complexity / Lines of Code,Cyclomatic Complexity / Number of Methods ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'D - Relative Cyclomatic Complexity', yaxis: 'Cyclomatic Complexity by Structure' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Classes,Abstract Classes,Concrete Classes', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'E - Types of Classes', yaxis: 'Count' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'F - Types of Methods', yaxis: 'Count' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Constants,Global Constants,Class Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'G - Types of Constants', yaxis: 'Count' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Test Classes,Test Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'I - Testing', yaxis: 'Count' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Logical Lines of Code (LLOC),Classes Length (LLOC),Functions Length (LLOC),LLOC outside functions or classes ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'AB - Code Structure by Logical Lines of Code', yaxis: 'Logical Lines of Code' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Functions,Named Functions,Anonymous Functions', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'H - Types of Functions', yaxis: 'Count' - plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Interfaces,Traits,Classes,Methods,Functions,Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'BB - Structure Objects', yaxis: 'Count' - - - } - } - - - - stage('SonarQube Quality Gate') { - when { branch pattern: "^develop*|^hotfix*|^release*|^main*", comparator: "REGEXP"} - environment { - scannerHome = tool 'SonarQubeScanner' - } - steps { - withSonarQubeEnv('sonarqube') { - sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=sonar-project.properties" - } - timeout(time: 1, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } - } - } - - -stage ('Deploy Artifact') { - steps { - sh 'zip -qr ${WORKSPACE}/php-todo.zip ${WORKSPACE}/*' - script { - def server = Artifactory.server 'artifactory-server' - def uploadSpec = """{ - "files": [{ - "pattern": "php-todo.zip", - "target": "php-todo" - }] - }""" - - server.upload(uploadSpec) - } - // sh 'jfrog rt upload ${WORKSPACE}/php-todo.zip http://35.157.31.6:8082/artifactory/php-todo/todo-${BUILD_NUMBER}.zip' - } - -} - - -stage ('Deploy to Dev Environment') { - steps { - build job: 'ansible-project/main', parameters: [[$class: 'StringParameterValue', name: 'env', value: 'dev']], propagate: false, wait: true - } } - - -} - - // post { - // always { - // echo 'Clean up' - // // xunit thresholds: [failed(failureNewThreshold: '0', failureThreshold: '0', unstableNewThreshold: '0', unstableThreshold: '0'), skipped(failureNewThreshold: '0', failureThreshold: '0', unstableNewThreshold: '0', unstableThreshold: '0')], tools: [PHPUnit(deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/logs/junit.xml', skipNoTestFiles: false, stopProcessingIfError: true)] - // } - // } - } +} \ No newline at end of file diff --git a/README.md b/README.md index 65e8b628b..00f938619 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,121 @@ php artisan serve [Complete Tutorial](https://laravel.com/docs/5.2/quickstart) + + + +#### Jenkinsfile stages +======================= +pipeline { + agent any + + + stages { + + stage("Initial cleanup") { + steps { + dir("${WORKSPACE}") { + deleteDir() + } + } + } + + stage('Checkout SCM') { + steps { + git branch: 'main', url: 'https://github.com/mexez/php-todo.git' + } + } + + + stage('Install Dependencies') { + steps { + sh 'mv .env.sample .env' + sh 'composer install' + sh 'php artisan migrate' + sh 'php artisan db:seed' + sh 'php artisan key:generate' + } + } + + stage('Execute Unit Tests') { + steps { + sh './vendor/bin/phpunit --log-junit reports/unitreport.xml' + } + } + + + stage('Publish & Plot Code Coverage Report') { + steps { + sh 'phploc app/ --log-csv build/logs/phploc.csv' + + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Lines of Code (LOC),Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Logical Lines of Code (LLOC) ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'A - Lines of code', yaxis: 'Lines of Code' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Directories,Files,Namespaces', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'B - Structures Containers', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Average Class Length (LLOC),Average Method Length (LLOC),Average Function Length (LLOC)', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'C - Average Length', yaxis: 'Average Lines of Code' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Cyclomatic Complexity / Lines of Code,Cyclomatic Complexity / Number of Methods ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'D - Relative Cyclomatic Complexity', yaxis: 'Cyclomatic Complexity by Structure' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Classes,Abstract Classes,Concrete Classes', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'E - Types of Classes', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'F - Types of Methods', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Constants,Global Constants,Class Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'G - Types of Constants', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Test Classes,Test Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'I - Testing', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Logical Lines of Code (LLOC),Classes Length (LLOC),Functions Length (LLOC),LLOC outside functions or classes ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'AB - Code Structure by Logical Lines of Code', yaxis: 'Logical Lines of Code' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Functions,Named Functions,Anonymous Functions', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'H - Types of Functions', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Interfaces,Traits,Classes,Methods,Functions,Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'BB - Structure Objects', yaxis: 'Count' + + + } + } + + + + stage('SonarQube Quality Gate') { + when { branch pattern: "^develop*|^hotfix*|^release*|^main*", comparator: "REGEXP"} + environment { + scannerHome = tool 'SonarQubeScanner' + } + steps { + withSonarQubeEnv('sonarqube') { + sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=sonar-project.properties" + } + timeout(time: 1, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } + } + } + + +stage ('Deploy Artifact') { + steps { + sh 'zip -qr ${WORKSPACE}/php-todo.zip ${WORKSPACE}/*' + script { + def server = Artifactory.server 'artifactory-server' + def uploadSpec = """{ + "files": [{ + "pattern": "php-todo.zip", + "target": "php-todo" + }] + }""" + + server.upload(uploadSpec) + } + // sh 'jfrog rt upload ${WORKSPACE}/php-todo.zip http://35.157.31.6:8082/artifactory/php-todo/todo-${BUILD_NUMBER}.zip' + } + +} + + +stage ('Deploy to Dev Environment') { + steps { + build job: 'ansible-project/main', parameters: [[$class: 'StringParameterValue', name: 'env', value: 'dev']], propagate: false, wait: true + } + } + + +} + + // post { + // always { + // echo 'Clean up' + // // xunit thresholds: [failed(failureNewThreshold: '0', failureThreshold: '0', unstableNewThreshold: '0', unstableThreshold: '0'), skipped(failureNewThreshold: '0', failureThreshold: '0', unstableNewThreshold: '0', unstableThreshold: '0')], tools: [PHPUnit(deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/logs/junit.xml', skipNoTestFiles: false, stopProcessingIfError: true)] + // } + // } + +} From 41b74f7a86480b98de47d150c17d2758af05a6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Tue, 21 Jun 2022 20:13:35 +0000 Subject: [PATCH 04/14] qa analysis stages --- Jenkinsfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index a778022ef..3ea02a024 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,5 +32,23 @@ pipeline { } } + + stage('Plot Code Coverage Report') { + steps { + + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Lines of Code (LOC),Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Logical Lines of Code (LLOC) ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'A - Lines of code', yaxis: 'Lines of Code' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Directories,Files,Namespaces', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'B - Structures Containers', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Average Class Length (LLOC),Average Method Length (LLOC),Average Function Length (LLOC)', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'C - Average Length', yaxis: 'Average Lines of Code' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Cyclomatic Complexity / Lines of Code,Cyclomatic Complexity / Number of Methods ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'D - Relative Cyclomatic Complexity', yaxis: 'Cyclomatic Complexity by Structure' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Classes,Abstract Classes,Concrete Classes', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'E - Types of Classes', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'F - Types of Methods', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Constants,Global Constants,Class Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'G - Types of Constants', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Test Classes,Test Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'I - Testing', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Logical Lines of Code (LLOC),Classes Length (LLOC),Functions Length (LLOC),LLOC outside functions or classes ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'AB - Code Structure by Logical Lines of Code', yaxis: 'Logical Lines of Code' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Functions,Named Functions,Anonymous Functions', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'H - Types of Functions', yaxis: 'Count' + plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Interfaces,Traits,Classes,Methods,Functions,Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'BB - Structure Objects', yaxis: 'Count' + } + } + } } \ No newline at end of file From 437b1a550e1a915218abdc7a9347adbe171de9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Tue, 21 Jun 2022 22:12:55 +0000 Subject: [PATCH 05/14] update JF --- Jenkinsfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3ea02a024..ada489d5e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,5 +50,32 @@ pipeline { } } + stage ('Package Artifact') { + steps { + sh 'zip -qr php-todo.zip ${WORKSPACE}/*' + } + } + + stage ('Upload Artifact to Artifactory') { + steps { + script { + def server = Artifactory.server 'artifactory-server' + def uploadSpec = """{ + "files": [ + { + "pattern": "php-todo.zip", + "target": "AEON/php-todo", + "props": "type=zip;status=ready" + + } + ] + }""" + + server.upload spec: uploadSpec + } + } + + } + } } \ No newline at end of file From 37b3024bcf963e25d96ed30127984c155a32a643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Wed, 22 Jun 2022 07:57:13 +0000 Subject: [PATCH 06/14] deploy --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ada489d5e..eea8cff58 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,5 +77,11 @@ pipeline { } + stage ('Deploy to Dev Environment') { + steps { + build job: 'P14_CI-with-Jenkins-Ansible-Artifactory-Sonarqube-PHP/main', parameters: [[$class: 'StringParameterValue', name: 'env', value: 'dev']], propagate: false, wait: true + } + } + } } \ No newline at end of file From cfcf3423b9389657df8f30ca3a3ab64fa0894c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Wed, 22 Jun 2022 19:23:13 +0000 Subject: [PATCH 07/14] deploy --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index eea8cff58..7b41fea1e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -78,10 +78,10 @@ pipeline { } stage ('Deploy to Dev Environment') { - steps { - build job: 'P14_CI-with-Jenkins-Ansible-Artifactory-Sonarqube-PHP/main', parameters: [[$class: 'StringParameterValue', name: 'env', value: 'dev']], propagate: false, wait: true + steps { + build job: 'P14_CI-with-Jenkins-Ansible-Artifactory-Sonarqube-PHP/main', parameters: [[$class: 'StringParameterValue', name: 'env', value: 'dev']], propagate: false, wait: true } } } -} \ No newline at end of file +} \ No newline at end of file From f2592ebc77f727d198259c3471d6e4d61ea77657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Tue, 28 Jun 2022 09:05:29 +0000 Subject: [PATCH 08/14] updated --- Jenkinsfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7b41fea1e..369db46d5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,6 +50,18 @@ pipeline { } } + stage('SonarQube Quality Gate') { + environment { + scannerHome = tool 'SonarQubeScanner' + } + steps { + withSonarQubeEnv('sonarqube') { + sh "${scannerHome}/bin/sonar-scanner" + } + + } + } + stage ('Package Artifact') { steps { sh 'zip -qr php-todo.zip ${WORKSPACE}/*' From dc5eb42ad23920bd75fb923441a5b8b2af3344ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Tue, 28 Jun 2022 22:08:41 +0000 Subject: [PATCH 09/14] updated --- sonar.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar.properties b/sonar.properties index 38159e49d..0ddee7822 100644 --- a/sonar.properties +++ b/sonar.properties @@ -1,4 +1,4 @@ -sonar.host.url=http://18.192.57.119:9000 +sonar.host.url=http://18.191.88.48:9000/sonar/ sonar.projectKey=php-todo #----- Default source code encoding sonar.sourceEncoding=UTF-8 From 851b2d829ebabee4fbee1dd35ff31bd0ac8ba6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Tue, 28 Jun 2022 22:38:59 +0000 Subject: [PATCH 10/14] updated --- Jenkinsfile | 7 +++++-- sonar.properties | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 369db46d5..921f8c3b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,14 +51,17 @@ pipeline { } stage('SonarQube Quality Gate') { + when { branch pattern: "^develop*|^hotfix*|^release*|^main*", comparator: "REGEXP"} environment { scannerHome = tool 'SonarQubeScanner' } steps { withSonarQubeEnv('sonarqube') { - sh "${scannerHome}/bin/sonar-scanner" + sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=sonar-project.properties" + } + timeout(time: 1, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true } - } } diff --git a/sonar.properties b/sonar.properties index 0ddee7822..f9997074e 100644 --- a/sonar.properties +++ b/sonar.properties @@ -4,4 +4,5 @@ sonar.projectKey=php-todo sonar.sourceEncoding=UTF-8 sonar.php.exclusions=**/vendor/** sonar.php.coverage.reportPaths=build/logs/phploc.csv -sonar.php.tests.reportPath=reports/unitreport.xml \ No newline at end of file +sonar.php.tests.reportPath=reports/unitreport.xml +sonar.exclusions=**/*.ts \ No newline at end of file From ca076244ba56383c3cdedcd9f267b75ae512db96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Wed, 29 Jun 2022 02:28:34 +0000 Subject: [PATCH 11/14] updated --- sonar.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sonar.properties b/sonar.properties index f9997074e..50ffc9e01 100644 --- a/sonar.properties +++ b/sonar.properties @@ -1,8 +1,8 @@ -sonar.host.url=http://18.191.88.48:9000/sonar/ -sonar.projectKey=php-todo +#sonar.host.url=http://18.191.88.48:9000/sonar/ +#sonar.projectKey=php-todo #----- Default source code encoding -sonar.sourceEncoding=UTF-8 -sonar.php.exclusions=**/vendor/** -sonar.php.coverage.reportPaths=build/logs/phploc.csv -sonar.php.tests.reportPath=reports/unitreport.xml -sonar.exclusions=**/*.ts \ No newline at end of file +#sonar.sourceEncoding=UTF-8 +#sonar.php.exclusions=**/vendor/** +#sonar.php.coverage.reportPaths=build/logs/phploc.csv +#sonar.php.tests.reportPath=reports/unitreport.xml +#sonar.exclusions=**/*.ts \ No newline at end of file From 5be86f946eebbcc9335cca1b74671c0b0621b77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Wed, 29 Jun 2022 04:01:34 +0000 Subject: [PATCH 12/14] updated --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 921f8c3b5..5dbf78580 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,7 +59,7 @@ pipeline { withSonarQubeEnv('sonarqube') { sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=sonar-project.properties" } - timeout(time: 1, unit: 'MINUTES') { + timeout(time: 5, unit: 'MINUTES') { waitForQualityGate abortPipeline: true } } From 880243198745244d4ce1653e1a67b6e667fbb65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Wed, 29 Jun 2022 04:36:33 +0000 Subject: [PATCH 13/14] updated --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5dbf78580..f395da715 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,7 +59,7 @@ pipeline { withSonarQubeEnv('sonarqube') { sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=sonar-project.properties" } - timeout(time: 5, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { waitForQualityGate abortPipeline: true } } From 3135f3ed8d50fd7a7170b2b3ad67b4de4afdbd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmexez=E2=80=9D?= Date: Wed, 29 Jun 2022 17:33:53 +0000 Subject: [PATCH 14/14] updated --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f395da715..77132424f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,7 +59,7 @@ pipeline { withSonarQubeEnv('sonarqube') { sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=sonar-project.properties" } - timeout(time: 20, unit: 'MINUTES') { + timeout(time: 7, unit: 'MINUTES') { waitForQualityGate abortPipeline: true } }