mirror of
				https://github.com/simon987/Architeuthis.git
				synced 2025-10-31 14:46:52 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
| 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
 | |
| logLevel = 'FINER'
 | |
| 
 | |
| pipeline {
 | |
|     agent none
 | |
|     environment {
 | |
|         GOOS='linux'
 | |
|         CGO_ENABLED='1'
 | |
|         HOME='.'
 | |
|     }
 | |
|     stages {
 | |
|         stage('Build & deploy') {
 | |
|             agent {
 | |
|                 docker {
 | |
|                     image 'golang:latest'
 | |
|                 }
 | |
|             }
 | |
|             steps {
 | |
|                 sh 'mkdir -p /go/src/github.com/simon987/Architeuthis'
 | |
|                 sh 'cp *.go "/go/src/github.com/simon987/Architeuthis"'
 | |
|                 sh 'cd /go/src/github.com/simon987/Architeuthis && go get ./...'
 | |
|                 sh 'cd /go/src/github.com/simon987/Architeuthis && go build -a -installsuffix cgo -o "${WORKSPACE}/architeuthis" .'
 | |
|                 sh 'tar -czf ${BUILD_NUMBER}_architeuthis.tar.gz config.json architeuthis reload.sh'
 | |
|                 sshPut remote: remote, from: env.BUILD_NUMBER + '_architeuthis.tar.gz', into: 'architeuthis/webroot/'
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |