View difference between Paste ID: q0gvmL5t and dhQL7vvi
SHOW: | | - or go back to the newest paste.
1
def imageName="192.168.44.44:8082/docker_registry/frontend"
2-
def dockerTag=""
2+
3
pipeline {
4
    agent {
5
        label 'agent'
6
    }
7
8
    environment {
9
        PIP_BREAK_SYSTEM_PACKAGES = 1
10
        scannerHome = tool 'SonarQube'
11
    }
12
13
    stages {
14
        stage('Get Code') {
15
            steps {
16
                git branch: 'jenkinsfile', url: 'https://github.com/Panda-Academy-Core-2-0/Frontend'
17
            }
18
        }
19
20
        stage('Unit tests') {
21
            steps {
22
                sh "pip3 install -r requirements.txt"
23
                sh "python3 -m pytest --cov=. --cov-report xml:test-results/coverage.xml --junitxml=test-results/pytest-report.xml"
24
            }
25
        }
26
        
27
        stage('Sonarqube analysis') {
28
            steps {
29
                withSonarQubeEnv('SonarQube') {
30
                    sh "${scannerHome}/bin/sonar-scanner"
31
                }
32
            }
33
        }
34
35
        stage('Build application image') {
36
            steps {
37
                script {
38
                  applicationImage = docker.build("$imageName")
39
                }
40-
                  dockerTag = "RC-${env.BUILD_ID}"
40+
41-
                  applicationImage = docker.build("$imageName:$dockerTag")
41+
42
    }
43
}