Skip to content

Make the configuration independent from SCM #401

Description

@SunBlack

What feature do you want to see added?

I tried to simplify our Jenkinsfile from sth. like this (already simplified):

pipeline {
  agent {
    label 'built-in'
  }
  
  options {
    skipDefaultCheckout()
  }

  stages {
    stage('Build') {
      parallel {
        stage('Windows') {
          stages {
            stage('msvc2017') {
              steps {
                publishChecks(name: 'MSVC 2017', status: 'IN_PROGRESS', summary: 'running')
                build job: 'msvc2017'
              }
              post {
                success {
                  publishChecks(name: 'MSVC 2017', status: 'COMPLETED', summary: 'success', conclusion: 'SUCCESS')
                }
                failure {
                  publishChecks(name: 'MSVC 2017', status: 'COMPLETED', summary: 'failed', conclusion: 'FAILURE')
                }
                unstable {
                  publishChecks(name: 'MSVC 2017', status: 'COMPLETED', summary: 'unstable', conclusion: 'FAILURE')
                }
                aborted {
                  publishChecks(name: 'MSVC 2017', status: 'COMPLETED', summary: 'canceled', conclusion: 'CANCELED')
                }
              }
            }
            stage('msvc2022') {
              when { 
                branch 'main' 
              }
              steps {
                publishChecks(name: 'MSVC 2022', status: 'IN_PROGRESS', summary: 'running')
                build job: 'msvc2022'
              }
              post {
                success {
                  publishChecks(name: 'MSVC 2022', status: 'COMPLETED', summary: 'success', conclusion: 'SUCCESS')
                }
                failure {
                  publishChecks(name: 'MSVC 2022', status: 'COMPLETED', summary: 'failed', conclusion: 'FAILURE')
                }
                unstable {
                  publishChecks(name: 'MSVC 2022', status: 'COMPLETED', summary: 'unstable', conclusion: 'FAILURE')
                }
                aborted {
                  publishChecks(name: 'MSVC 2022', status: 'COMPLETED', summary: 'canceled', conclusion: 'CANCELED')
                }
              }
            }
          }
        }
        stage('Linux') {
          stages {
            stage('clang') {
              when { 
                branch 'dev' 
              }
              steps {
                publishChecks(name: 'clang', status: 'IN_PROGRESS', summary: 'running')
                build job: 'clang'
              }
              post {
                success {
                  publishChecks(name: 'clang', status: 'COMPLETED', summary: 'success', conclusion: 'SUCCESS')
                }
                failure {
                  publishChecks(name: 'clang', status: 'COMPLETED', summary: 'failed', conclusion: 'FAILURE')
                }
                unstable {
                  publishChecks(name: 'clang', status: 'COMPLETED', summary: 'unstable', conclusion: 'FAILURE')
                }
                aborted {
                  publishChecks(name: 'clang', status: 'COMPLETED', summary: 'canceled', conclusion: 'CANCELED')
                }
              }
            }
            stage('gcc') {
              steps {
                publishChecks(name: 'gcc', status: 'IN_PROGRESS', summary: 'running')
                build job: 'gcc'
              }
              post {
                success {
                  publishChecks(name: 'gcc', status: 'COMPLETED', summary: 'success', conclusion: 'SUCCESS')
                }
                failure {
                  publishChecks(name: 'gcc', status: 'COMPLETED', summary: 'failed', conclusion: 'FAILURE')
                }
                unstable {
                  publishChecks(name: 'gcc', status: 'COMPLETED', summary: 'unstable', conclusion: 'FAILURE')
                }
                aborted {
                  publishChecks(name: 'gcc', status: 'COMPLETED', summary: 'canceled', conclusion: 'CANCELED')
                }
              }
            }
          }
        }
      }
    }
  }
}

To:

pipeline {
  agent {
    label 'built-in'
  }
  
  options {
    skipDefaultCheckout()
  }

  stages {
    stage('Build') {
      parallel {
        stage('Windows') {
          stages {
            stage('msvc2017') {
              steps {
                withChecks('MSVC 2017') {
                  build job: 'msvc2017'
                }
              }
            }
            stage('msvc2022') {
              when { 
                branch 'main' 
              }
              steps {
                withChecks('MSVC 2022') {
                  build job: 'msvc2022'
                }
              }
            }
          }
        }
        stage('Linux') {
          stages {
            stage('clang') {
              when { 
                branch 'dev' 
              }
              steps {
                withChecks('clang') {
                  build job: 'clang'
                }
              }
            }
            stage('gcc') {
              steps {
                withChecks('gcc') {
                  build job: 'gcc'
                }
              }
            }
          }
        }
      }
    }
  }
}

But somehow GitHub sees that the jobs are starting and even get notification in case of an error, but never a success state. So I wanted to check whether Verbose Console log could help - but this configuration depends on the checkout step, which we were skipping in our case.

So it would be nice, when there is another way to enable debug log - maybe as pipeline option (not sure whether Skip GitHub Branch Source could also be independent of the checkout).

Upstream changes

No response

Are you interested in contributing this feature?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions