Advertisement
PandaAcademy

Docker Build pipeline

Oct 7th, 2023 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. def imageName="192.168.44.44:8082/docker_registry/frontend"
  2. def dockerTag=""
  3.  
  4.  
  5. pipeline {
  6. agent {
  7. label 'agent'
  8. }
  9.  
  10. environment {
  11. PIP_BREAK_SYSTEM_PACKAGES = 1
  12. scannerHome = tool 'SonarQube'
  13. }
  14.  
  15. stages {
  16. stage('Get Code') {
  17. steps {
  18. git branch: 'jenkinsfile', url: 'https://github.com/Panda-Academy-Core-2-0/Frontend'
  19. }
  20. }
  21.  
  22. stage('Unit tests') {
  23. steps {
  24. sh "pip3 install -r requirements.txt"
  25. sh "python3 -m pytest --cov=. --cov-report xml:test-results/coverage.xml --junitxml=test-results/pytest-report.xml"
  26. }
  27. }
  28.  
  29. stage('Sonarqube analysis') {
  30. steps {
  31. withSonarQubeEnv('SonarQube') {
  32. sh "${scannerHome}/bin/sonar-scanner"
  33. }
  34. }
  35. }
  36.  
  37. stage('Build application image') {
  38. steps {
  39. script {
  40. dockerTag = "RC-${env.BUILD_ID}"
  41. applicationImage = docker.build("$imageName:$dockerTag")
  42. }
  43. }
  44. }
  45. }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement