Jenkinsfile 1.36 KB
Newer Older
Dominik Vayhinger's avatar
Dominik Vayhinger committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pipeline {
    environment {
        registry = "hftstuttgart/modocot-backend"
        registryCredential = 'Dockerhub'
        dockerImage = ''
    }
    agent any
    tools {
        jdk 'Java11'
        maven 'Maven_Home'
    }
    stages {
        stage('Checkout') {
            steps {
                echo 'Checkout Repository..'
                git branch: 'master',
Vayhinger's avatar
Vayhinger committed
17
                url: 'https://transfer.hft-stuttgart.de/gitlab/HFTSoftwareProject/MoDoCoT-Backend.git'
Dominik Vayhinger's avatar
Dominik Vayhinger committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
            }
        }
        stage('Build') {
            steps {
                echo 'Maven Build..'
                sh 'mvn clean package -DskipTests=false'
            }
        }
        stage('Docker Build..') {
            steps{
                script {
                    dockerImage = docker.build registry + ":latest"
                }
            }
        }
        stage('Push to Dockerhub..') {
                    steps{
                        script {
                            docker.withRegistry( '', registryCredential ) {
                                dockerImage.push()
                            }
                        }
                    }
                }

        stage('ShellScript') {
            steps {
                echo 'Exectue Shellscript..'
                sh 'chmod 744 restart_modocot_backend.sh && ./restart_modocot_backend.sh'
            }
        }
    }
}