├── Jenkinsfile ├── Jenkinsfile_test ├── build.bat ├── build.sh ├── deploy.bat ├── deploy.sh ├── pipeline_sample1.yml ├── pipeline_sample2.yml ├── pipeline_sample3.yml ├── pipeline_sample4_exercies11.yml ├── quality.bat ├── quality.sh ├── unit.bat └── unit.sh /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | tools { 4 | maven 'maven3.8.2' 5 | } 6 | stages { 7 | stage('github clone') { 8 | steps { 9 | git 'https://github.com/joneconsulting/one-apigate.git' 10 | } 11 | } 12 | stage('build') { 13 | steps { 14 | sh ''' 15 | echo build start 16 | mvn clean compile package -DskipTests=true 17 | ''' 18 | 19 | // sh 'mvn clean compile package -DskipTests=true' 20 | } 21 | } 22 | stage('deploy') { 23 | steps { 24 | deploy adapters: [tomcat9(credentialsId: 'deployer_user', path: '', url: 'http://192.168.0.8:8080/')], contextPath: null, war: '**/*.war' 25 | } 26 | } 27 | stage('ssh publisher') { 28 | steps { 29 | sshPublisher(publishers: [sshPublisherDesc(configName: 'aws-docker-server', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker build -t edowon0623/devops_exam1 -f Dockerfile .', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '.', remoteDirectorySDF: false, removePrefix: 'target', sourceFiles: 'target/devops_demo-0.1.war')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Jenkinsfile_test: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | stages { 4 | stage('Compile') { 5 | steps { 6 | echo "Compiled successfully!"; 7 | } 8 | } 9 | 10 | stage('JUint') { 11 | steps { 12 | echo "JUint passed successfully!"; 13 | } 14 | } 15 | 16 | stage('Code Analysis') { 17 | steps { 18 | echo "Code Analysis completed successfully!"; 19 | } 20 | } 21 | 22 | stage('Deploy') { 23 | steps { 24 | echo "Deployed successfully!"; 25 | } 26 | } 27 | } 28 | 29 | post { 30 | always { 31 | echo 'This will always run' 32 | } 33 | success { 34 | echo 'This will run when the run finished successfully' 35 | } 36 | failure { 37 | echo 'This will run if failed' 38 | } 39 | unstable { 40 | echo 'This will run when the run was marked as unstable' 41 | } 42 | changed { 43 | echo 'This will run when the state of the pipeline has changed' 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | echo "Building the Project : %date%, %time%' 2 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | echo "Building the Project : `date`" 2 | -------------------------------------------------------------------------------- /deploy.bat: -------------------------------------------------------------------------------- 1 | echo "Deploying the Project : : %date%, %time%' 2 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | echo "Deploying the Project : `date`" 2 | -------------------------------------------------------------------------------- /pipeline_sample1.yml: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | stages { 4 | stage('Compile') { 5 | steps { 6 | echo "Compiled successfully!"; 7 | } 8 | } 9 | 10 | stage('JUnit') { 11 | steps { 12 | echo "JUnit passed successfully!"; 13 | } 14 | } 15 | 16 | stage('Code Analysis') { 17 | steps { 18 | echo "Code Analysis completed successfully!"; 19 | } 20 | } 21 | 22 | stage('Deploy') { 23 | steps { 24 | echo "Deployed successfully!"; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /pipeline_sample2.yml: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | stages { 4 | stage('Compile') { 5 | steps { 6 | echo "Compiled successfully!"; 7 | } 8 | } 9 | 10 | stage('JUnit') { 11 | steps { 12 | echo "JUnit passed successfully!"; 13 | } 14 | } 15 | 16 | stage('Code Analysis') { 17 | steps { 18 | echo "Code Analysis completed successfully!"; 19 | } 20 | } 21 | 22 | stage('Deploy') { 23 | steps { 24 | echo "Deployed successfully!"; 25 | } 26 | } 27 | } 28 | 29 | post { 30 | always { 31 | echo "This will always run" 32 | } 33 | success { 34 | echo "This will run when the run finished successfully" 35 | } 36 | failure { 37 | echo "This will run if failed" 38 | } 39 | unstable { 40 | echo "This will run when the run was marked as unstable" 41 | } 42 | changed { 43 | echo "This will run when the state of the pipeline has changed" 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /pipeline_sample3.yml: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | stages { 4 | stage('Git clone') { 5 | steps { 6 | git 'https://github.com/joneconsulting/jenkins_pipeline_script'; 7 | } 8 | } 9 | 10 | stage('Compile') { 11 | steps { 12 | echo "Compiled successfully!"; 13 | sh './build.sh' 14 | } 15 | } 16 | 17 | stage('JUnit') { 18 | steps { 19 | echo "JUnit passed successfully!"; 20 | sh './unit.sh' 21 | } 22 | } 23 | 24 | stage('Code Analysis') { 25 | steps { 26 | echo "Code Analysis completed successfully!"; 27 | sh './quality.sh' 28 | } 29 | } 30 | 31 | stage('Deploy') { 32 | steps { 33 | echo "Deployed successfully!"; 34 | sh './deploy.sh' 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /pipeline_sample4_exercies11.yml: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | tools { 4 | maven 'Maven3.8.5' 5 | } 6 | stages { 7 | stage('github clone') { 8 | steps { 9 | git branch: 'main', url: 'https://github.com/joneconsulting/cicd-web-project.git'; 10 | } 11 | } 12 | 13 | stage('build') { 14 | steps { 15 | sh ''' 16 | echo build start 17 | mvn clean compile package -DskipTests=true 18 | ''' 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /quality.bat: -------------------------------------------------------------------------------- 1 | echo "Code Quality Check : : %date%, %time%' 2 | -------------------------------------------------------------------------------- /quality.sh: -------------------------------------------------------------------------------- 1 | echo "Code Quality Check : `date`" 2 | -------------------------------------------------------------------------------- /unit.bat: -------------------------------------------------------------------------------- 1 | echo "Running Unit Test Cases : : %date%, %time%' 2 | -------------------------------------------------------------------------------- /unit.sh: -------------------------------------------------------------------------------- 1 | echo "Running Unit Test Cases : `date`" 2 | --------------------------------------------------------------------------------