git - Jenkins 文件 : All stages not visible in Pipeline

标签 git jenkins jenkins-pipeline

我的 GitRepo 的不同分支上有相同的 Jenkinsfile。但我只能在 Master 分支上看到 Jenkinsfile 上的所有阶段。在其他分支上,只有少数阶段可见。

这些阶段不是 Jenkinsfile 上特定于分支的。

我在其他存储库中也看到了类似的行为。我的分支或 Jenkinsfile 中缺少什么?

node {
stage('Checkout from Github') {
    checkout scm
}
try{

            stage('Unit Tests') {
                sh 'gradle test'
                junit 'build/test-results/test/*.xml'
            }
            stage('Integration Tests') {
                sh 'gradle integrationTest'
                junit 'build/test-results/integrationTest/*.xml'
            }
            stage('Coverage') {
                // generate test report
                sh 'gradle jacocoTestReport'
                // verify minimum coverage
                sh 'gradle jacocoTestCoverageVerification'
            }
            stage('SonarQube') {
                withSonarQubeEnv('SonarQubeServer') {
                    // submit results to SonarQube
                    sh 'gradle sonarqube'
                }
            }
            stage('Quality Gate') {
                timeout(time: 1, unit: 'HOURS') {
                    // TODO: make this a failure criteria once coverage is ready
                    waitForQualityGate abortPipeline: false
                }
            }
            stage('Publish War') {
                sh 'gradle publish'
            }
        }
    }

    stage('Publish Helm Chart') {
        something
    }
} finally {
    something
}
}

on feature branch

on master

两个分支上的 Jenkinsfile 是相同的。

最佳答案

管道阶段 View 插件仅显示其显示的任何构建至少执行过一次的阶段。

在您的屏幕截图中您可以看到这一点。在 master 上,所有阶段都已在构建 #5 中执行,因此它们由表中的一列表示。在分支上,只有一个构建,该构建在早期阶段失败,因此只有到该阶段的列,因为其他列已被跳过。

当您删除或(更烦人)重命名阶段时,也可以看到这种行为。旧的阶段会一直保留一个专栏,直到它们退出历史。

关于git - Jenkins 文件 : All stages not visible in Pipeline,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52998132/

相关文章:

git - ssh_exchange_identification

java - 如何在 Jenkins 上的 Gradle 构建中过滤测试而无需提交?

jenkins - 如何让 xunit 在失败时停止 Jenkins 管道?

jenkins - 所有项目的模板 Jenkinsfile

windows - 用于在 Windows 上进行符号链接(symbolic link)转换的 Git Hook

git - 如何获得 pull 请求的所有权?

jenkins - 无法通过jenkins连接到AWS从站

testing - 使用 Jenkins 自动测试 Nifi 流

jenkins - 如何在 withCredentials 中获取用户范围的凭据(个人凭据)

windows - 非交互式 "git clean -fdx"