Advertisement
PandaAcademy

Docker Build pipeline without tag

Feb 20th, 2024 (edited)
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def imageName="192.168.44.44:8082/docker_registry/frontend"
  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. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement