Параллельный пример. Сбой декларативного конвейера Jenkinsfile. - PullRequest
0 голосов
/ 26 апреля 2018

Использование Jenkinsfile Parallel Example - зависает в ожидании запланированной задачи.Я предполагаю, что пример должен работать.В этом примере параллельный этап был пропущен из-за

when branch master

, поэтому я удалил его.К сожалению, это приводит к зависанию процесса.Я также добавил узел к метке агента ... не помогло

agent { node { label "for-branch-a" } }

Может кто-нибудь сказать мне, как это работает?

pipeline {
  agent any
  stages {
    stage('Non-Parallel Stage') {
      steps {
        echo 'This stage will be executed first.'
      }
    }
    stage('Parallel Stage') {
      when {
        branch 'master'
      }
      failFast true
      parallel {
        stage('Branch A') {
          agent {
            label "for-branch-a"
          }
          steps {
            echo "On Branch A"
          }
        }
        stage('Branch B') {
          agent {
            label "for-branch-b"
          }
          steps {
            echo "On Branch B"
          }
        }
      }
    }
  }
}

Зависает на обеих ветвях А иB

> This stage will be executed first.
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Parallel Stage)
[Pipeline] parallel
[Pipeline] [Branch A] { (Branch: Branch A)
[Pipeline] [Branch B] { (Branch: Branch B)
[Pipeline] [Branch A] stage
[Pipeline] [Branch A] { (Branch A)
[Pipeline] [Branch B] stage
[Pipeline] [Branch B] { (Branch B)
[Pipeline] [Branch A] node
[Pipeline] [Branch B] node
[Branch A] Still waiting to schedule task
[Branch A] There are no nodes with the label ‘for-branch-a’
[Branch B] Still waiting to schedule task
[Branch B] There are no nodes with the label ‘for-branch-b’

Ответы [ 2 ]

0 голосов
/ 26 апреля 2018

Как заявил @BigGinDaHouse, я не создавал агентов.Я обновил параллельный пример использования агентов Docker: Примечание: эта версия работает, только если мы удалим атрибут «label» из определения агента Docker.

pipeline {
  agent any
  stages {
    stage('Non-Parallel Stage') {
      steps {
        echo 'This stage will be executed first.'
      }
    }
    stage('Parallel Stage') {
      failFast true
      parallel {
        stage('Branch A') {
            agent { 
              docker{ 
                image 'alpine:latest'  
                label 'for-branch-a'   # remove this
              }
            }
            steps {
              echo "On Branch A"
            }
        }
        stage('Branch B') {
          agent { 
            docker { 
              image 'alpine:latest' 
              label 'for-branch-b'     # remove this
            }
          }
          steps {
            echo "On Branch B"
          }
        }
      }
    }
  }
}
0 голосов
/ 26 апреля 2018

[Branch A] There are no nodes with the label ‘for-branch-a’ [Branch B] There are no nodes with the label ‘for-branch-b’ это означает, что у вас нет раба (ов) с этими именами, настройте их в соответствии с руководством Дженкинса (https://wiki.jenkins.io/display/JENKINS/Distributed+builds), и тогда все будет работать

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...