Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Декларативный пайплайн:
- #!groovy
- // Одновременно только 1 билд
- properties([disableConcurrentBuilds()])
- def ab = "foo"
- pipeline {
- environment {
- registry = "ruvod-docker.artifactory.local"
- registryCredential = 'artifactory'
- dockerImage = ''
- }
- //Агент выбирается по метке master
- agent {
- label 'OAM'
- }
- // опрашиваем scm каждую минуту
- triggers { pollSCM('* * * * *') }
- options {
- // Хранить 10 историй сборок и 10 артефактов
- buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
- timestamps() // выводить временные отметки
- }
- stages {
- stage("Create Docker Images") {
- steps {
- sh "docker build -t $registry/api_php:$BUILD_NUMBER ."
- }
- }
- stage('Publish') {
- steps {
- withDockerRegistry([credentialsId: 'artifactory', url: 'https://$registry']) {
- sh "docker push $registry/api_php:$BUILD_NUMBER"
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement