Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.33 KB | None | 0 0
  1. pipeline {
  2.          agent any
  3.          stages {
  4.                  
  5.                  stage('Checkout') {
  6.                  steps {
  7.                      echo 'Retrieving Jenkinsfile from the github repository.'
  8.                    checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: 'dummy']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/humblemetsuke/coursework_2']]])
  9.                  }
  10.                  }
  11.                  
  12.         stage('SonarQube') {
  13.     environment {
  14.         scannerHome = tool 'SonarQube'
  15.     }
  16.     steps {
  17.         withSonarQubeEnv('SonarQube') {
  18.             sh "${scannerHome}/bin/sonar-scanner"
  19.         }
  20.         timeout(time: 1, unit: 'HOURS') {
  21.             waitForQualityGate abortPipeline: true
  22.         }
  23.     }
  24. }
  25.  
  26. stage ('build docker image') {
  27.  
  28. steps {
  29. echo 'Beginning to build the docker image.'
  30.  
  31. script {
  32.  
  33.  dockerImage= docker.build("coursework_2:${env.BUILD_ID}")
  34.  
  35.          }
  36. }
  37.  
  38. }
  39.  
  40. stage ('push docker image to DockerHub') {
  41.  
  42. steps {
  43. echo 'Beginning to push the built docker image to Dockerhub.'
  44.  
  45. script {
  46.  
  47. withDockerRegistry(credentialsId: 'e1984af9-1751-4825-883a-9194875c8f89', url: '') {
  48.          
  49.  
  50.          }
  51.          dockerImage.push()
  52. }
  53.  
  54. }
  55.  
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement