Jenkinsfile 640 Bytes
Newer Older
FabiusE's avatar
FabiusE committed
1 2 3
pipeline {
    agent {
        kubernetes {
FabiusE's avatar
FabiusE committed
4 5
            label 'jenkins-jenkins-slave'
            defaultContainer 'jnlp'
FabiusE's avatar
FabiusE committed
6 7 8
        }
    }
}
FabiusE's avatar
FabiusE committed
9
 {
FabiusE's avatar
FabiusE committed
10 11 12 13
    def app
    stage('Clone repository'){
        checkout scm
    }
FabiusE's avatar
FabiusE committed
14

FabiusE's avatar
FabiusE committed
15 16 17
    stage('Build image'){
        app = docker.build("fabiuse/reactdocker")
    }
FabiusE's avatar
FabiusE committed
18

FabiusE's avatar
FabiusE committed
19 20 21
    stage('Test image'){
        app.inside {
            sh 'echo "Tests passed"'
FabiusE's avatar
FabiusE committed
22
        }
FabiusE's avatar
FabiusE committed
23
    }
FabiusE's avatar
FabiusE committed
24 25 26 27 28 29 30 31 32 33 34

    stage('Push image'){
        docker.withRegistry('','docker-hub-credentials'){
            app.push("latest")
        }
    } 
    
    stage ('Deploy') {
        sh 'echo kubectl get nodes'
    }      
}