Advertisement
Guest User

Untitled

a guest
Jan 9th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.19 KB | None | 0 0
  1. Декларативный пайплайн:
  2.  
  3. #!groovy
  4. // Одновременно только 1 билд
  5. properties([disableConcurrentBuilds()])
  6.  
  7. def ab = "foo"
  8.  
  9. pipeline {
  10.     environment {
  11.     registry = "ruvod-docker.artifactory.local"
  12.     registryCredential = 'artifactory'
  13.     dockerImage = ''
  14.   }
  15.     //Агент выбирается по метке master
  16.     agent {
  17.         label 'OAM'
  18.  
  19.     }
  20.     // опрашиваем scm каждую минуту
  21.     triggers { pollSCM('* * * * *') }    
  22.  
  23.     options {
  24.         // Хранить 10 историй сборок и 10 артефактов
  25.         buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
  26.         timestamps() // выводить временные отметки
  27.     }
  28.     stages {
  29.         stage("Create Docker Images") {
  30.             steps {
  31.                
  32.              sh "docker build -t $registry/api_php:$BUILD_NUMBER ."
  33.                 }
  34.                 }
  35.            
  36.         stage('Publish') {
  37.    steps {
  38.     withDockerRegistry([credentialsId: 'artifactory', url: 'https://$registry']) {
  39.             sh "docker push $registry/api_php:$BUILD_NUMBER"
  40.         }
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement