mirror of
				https://github.com/simon987/task_tracker_drone.git
				synced 2025-11-04 09:46:52 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			890 B
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			890 B
		
	
	
	
		
			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'
 | 
						|
 | 
						|
pipeline {
 | 
						|
    agent any
 | 
						|
    stages {
 | 
						|
        stage('Build') {
 | 
						|
			steps {
 | 
						|
				sh './jenkins/build.sh'
 | 
						|
			}
 | 
						|
        }
 | 
						|
        stage('Test') {
 | 
						|
			steps {
 | 
						|
				sh 'bash -c "source env/bin/activate && cd src && python -m unittest discover"'
 | 
						|
			}
 | 
						|
        }
 | 
						|
        stage('Deploy') {
 | 
						|
            steps {
 | 
						|
				sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'task_tracker_drone/deploy.sh'
 | 
						|
				sshPut remote: remote, from: 'src', into: 'task_tracker_drone'
 | 
						|
				sshPut remote: remote, from: 'requirements.txt', into: 'task_tracker_drone'
 | 
						|
				sshCommand remote: remote, command: 'chmod +x task_tracker_drone/deploy.sh && ./task_tracker_drone/deploy.sh'
 | 
						|
            }
 | 
						|
        }
 | 
						|
   	}
 | 
						|
} |