mirror of
				https://github.com/simon987/simon987.net.git
				synced 2025-10-30 15:06:52 +00:00 
			
		
		
		
	Jenkins setup
This commit is contained in:
		
							parent
							
								
									5880eb3fab
								
							
						
					
					
						commit
						2c318fa4df
					
				
							
								
								
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @ -0,0 +1,2 @@ | ||||
| build/* linguist-vendored | ||||
| config/* linguist-vendored | ||||
							
								
								
									
										5
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| [](https://www.codefactor.io/repository/github/simon987/simon987.net/overview/master) | ||||
| [](https://ci.simon987.net/job/simon987.net/) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
							
								
								
									
										47
									
								
								jenkins/Jenkinsfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								jenkins/Jenkinsfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,47 @@ | ||||
| def remote = [:] | ||||
| remote.name = 'remote' | ||||
| remote.host = env.DEPLOY_HOST | ||||
| remote.user = env.DEPLOY_USER | ||||
| remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa' | ||||
| remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts' | ||||
| remote.allowAnyHosts = true | ||||
| remote.retryCount = 3 | ||||
| remote.retryWaitSec = 3 | ||||
| logLevel = 'FINER' | ||||
| 
 | ||||
| pipeline { | ||||
|     agent none | ||||
|     environment { | ||||
|         HOME='.' | ||||
|     } | ||||
|     stages { | ||||
|         stage('Build') { | ||||
|             agent { | ||||
|                 docker { | ||||
|                     image 'node:10-alpine' | ||||
|                 } | ||||
|             } | ||||
|             steps { | ||||
|                 sh 'cd simon987/ && npm install' | ||||
|                 sh 'cd simon987/ && npm audit fix' | ||||
|                 sh 'cd simon987/ && npm run build' | ||||
|                 sh 'mv simon987/dist webroot' | ||||
|                 stash includes: 'webroot/', name: 'webdist' | ||||
|             } | ||||
|         } | ||||
|         stage('Deploy') { | ||||
|             agent none | ||||
|             steps { | ||||
|                 node('master') { | ||||
|                     unstash 'webdist' | ||||
|                     sshCommand remote: remote, command: "cd simon987 && rm -rf webroot/* deploy.sh" | ||||
|                     sshPut remote: remote, from: 'webroot/', into: 'simon987' | ||||
|                     sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'simon987/' | ||||
|                     sshCommand remote: remote, command: 'chmod +x simon987/deploy.sh && ./simon987/deploy.sh' | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
							
								
								
									
										5
									
								
								jenkins/deploy.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								jenkins/deploy.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,5 @@ | ||||
| #!/bin/bash | ||||
| 
 | ||||
| export TTROOT="simon987" | ||||
| 
 | ||||
| chmod 755 -R "${TTROOT}/webroot" | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user