| 
									
										
										
										
											2021-06-08 20:44:58 +08:00
										 |  |  | pipeline { | 
					
						
							|  |  |  |     agent any | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-14 21:22:56 +08:00
										 |  |  |     triggers { | 
					
						
							| 
									
										
										
										
											2021-07-14 21:51:03 +08:00
										 |  |  |      | 
					
						
							| 
									
										
										
										
											2021-07-14 21:22:56 +08:00
										 |  |  |         pollSCM('') // Enabling being build on Push | 
					
						
							| 
									
										
										
										
											2021-07-14 21:51:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-14 21:22:56 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-08 20:44:58 +08:00
										 |  |  |     stages { | 
					
						
							|  |  |  |         stage('MakeDatabasefile') { | 
					
						
							|  |  |  | 	    steps { | 
					
						
							|  |  |  | 	        sh 'touch ./app/static/wordfreqapp.db && rm -f ./app/static/wordfreqapp.db'  | 
					
						
							|  |  |  | 	        sh 'cat ./app/static/wordfreqapp.sql | sqlite3 ./app/static/wordfreqapp.db' | 
					
						
							|  |  |  | 	    } | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  |         stage('BuildIt') { | 
					
						
							|  |  |  |             steps { | 
					
						
							|  |  |  |                 echo 'Building..' | 
					
						
							| 
									
										
										
										
											2021-07-13 12:24:29 +08:00
										 |  |  | 		sh 'sudo docker kill $(sudo docker ps -q)' | 
					
						
							| 
									
										
										
										
											2021-06-08 20:44:58 +08:00
										 |  |  | 		sh 'sudo docker build -t englishpal .' | 
					
						
							|  |  |  | 		sh 'sudo docker run -d -p 91:80 -v /var/lib/jenkins/workspace/EnglishPal_Pipeline_master/app/static/frequency:/app/static/frequency -t englishpal' | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         stage('TestIt') { | 
					
						
							|  |  |  |             steps { | 
					
						
							|  |  |  |                 echo 'Testing..' | 
					
						
							| 
									
										
										
										
											2021-07-14 17:58:37 +08:00
										 |  |  | 		sh 'sudo docker run -d -p 4444:4444 selenium/standalone-firefox' | 
					
						
							| 
									
										
										
										
											2021-06-08 20:44:58 +08:00
										 |  |  | 		sh 'pip3 install pytest -U -q' | 
					
						
							| 
									
										
										
										
											2021-07-13 12:32:57 +08:00
										 |  |  | 		sh 'pip3 install pytest-html -U -q'		 | 
					
						
							| 
									
										
										
										
											2021-06-08 20:44:58 +08:00
										 |  |  | 		sh 'pip3 install selenium -U -q' | 
					
						
							| 
									
										
										
										
											2021-06-09 08:43:50 +08:00
										 |  |  | 		sh 'pytest -v -s --html=EnglishPalTestReport.html ./app/test' | 
					
						
							| 
									
										
										
										
											2021-06-08 20:44:58 +08:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         stage('DeployIt') { | 
					
						
							|  |  |  |             steps { | 
					
						
							| 
									
										
										
										
											2021-06-09 08:15:18 +08:00
										 |  |  |                 echo 'Deploying (TBD)' | 
					
						
							| 
									
										
										
										
											2021-06-08 20:44:58 +08:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |