1
votes

I have a jenkins pipeline which checkouts the project repository from github to build the project in the build stage, in the next deploy stage we checkout another repository in github to read the configurations pertaining to deployment.

Since we checkout two times jenkins shows two workspaces along with two changes

  1. For the build changes of the actual project
  2. For the deploy changes of the deploy configuration repo

How can I limit the workspace and changes only to 1. For the build changes of the actual project ?

My pipeline looks something like below:

pipeline {

    agent any
    
    options {
        skipDefaultCheckout(true)
    }
    
    stages {
      stage('Build') {
          steps {
                checkout scm
                // build related tasks
            }   
      }

      stage('Deploy') {
        when { branch "master" }
        steps {
          script {
            node("docker-ee") {
              script:
                checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'some.client.id', url: 'https://somegithuburl.git']]])
            }
          }
        }
      }
    }
}
1
Please include information about how exactly you checkout the projects. - MaratC
@MaratC I have updated the question. Thank you for looking into this. - paul58914080
I also tried looking at stackoverflow.com/questions/56731950/… which is somewhat similar to this issue - paul58914080

1 Answers

1
votes

Use changelog: false to disable changelog generation, more detail

pipeline {

    agent any
    
    options {
        skipDefaultCheckout(true)
    }
    
    stages {
      stage('Build') {
          steps {
                checkout scm
                // build related tasks
            }   
      }

      stage('Deploy') {
        when { branch "master" }
        steps {
          script {
            node("docker-ee") {
              script:
                checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'some.client.id', url: 'https://somegithuburl.git']]], changelog: false, poll: false
            }
          }
        }
      }
    }
}