Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def imageName="192.168.44.44:8082/docker_registry/frontend"
- def dockerTag=""
- def dockerRegistry="https://192.168.44.44:8082"
- def registryCredentials="artifactory"
- pipeline {
- agent {
- label 'agent'
- }
- environment {
- PIP_BREAK_SYSTEM_PACKAGES = 1
- scannerHome = tool 'SonarQube'
- }
- stages {
- stage('Get Code') {
- steps {
- git branch: 'jenkinsfile', url: 'https://github.com/Panda-Academy-Core-2-0/Frontend'
- }
- }
- stage('Unit tests') {
- steps {
- sh "pip3 install -r requirements.txt"
- sh "python3 -m pytest --cov=. --cov-report xml:test-results/coverage.xml --junitxml=test-results/pytest-report.xml"
- }
- }
- stage('Sonarqube analysis') {
- steps {
- withSonarQubeEnv('SonarQube') {
- sh "${scannerHome}/bin/sonar-scanner"
- }
- }
- }
- stage('Build application image') {
- steps {
- script {
- dockerTag = "RC-${env.BUILD_ID}"
- applicationImage = docker.build("$imageName:$dockerTag")
- }
- }
- }
- stage ('Pushing image to docker registry') {
- steps {
- script {
- docker.withRegistry("$dockerRegistry", "$registryCredentials") {
- applicationImage.push()
- applicationImage.push('latest')
- }
- }
- }
- }
- }
- post {
- always {
- junit testResults: "test-results/*.xml"
- cleanWs()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement