Jenkins声明式管道不读取阶段或步骤

时间:2019-03-11 14:50:41

标签: jenkins jenkins-groovy

我对詹金斯世界是陌生的,并且不确定为什么它不阅读我的声明式管道中的步骤。

我敢肯定这很简单,但是我似乎看不出错误在哪里。

import cloud.GitClient
import cloud.SlackClient

def call(body) {
    def parameters = [:]
    body.resolveStrategy = Closure.DELEGATE_FIRST
    body.delegate = parameters
    body()

    pipeline {
      agent {
        kubernetes {
          cloud parameters['buildCloudId']
        }
      }
      stages {
        stage('Inform Build Start') {
          steps {
            script{
              slackClient.warn('Starting build!')
            }
          }
        }
        stage('Build Docker Images') {
          steps {
            checkout scm
            container('docker') {
              withCredentialsee(usernamePassword(credentialsId: parameters.docker.credentialsId, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')) {
                sh """
                echo "\$PASSWORD" | docker login -u \$USERNAME --password-stdin hub.containers
                ./build.sh
                """
              }
            }
          }
          post {
            failure {
              script {
                slackClient.failed("Docker backend build *FAILED*! <${env.BUILD_URL}console|See log> for details.")
              }
            }
            success {
              script {
                slackClient.success("Docker backend build *COMPLETED*! <${env.BUILD_URL}console|See log> for details.")
              }
            }
        }
      }
    }
  }
}

在詹金斯,一切都显示为绿色,但是日志显示根本没有运行。

0 个答案:

没有答案