Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49627

Last Changes Plugin shows git changes only in the first directory of the multidirectory pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • last-changes-plugin
    • None
    • Jenkins 2.101
      Last Changes Plugin 2.6

      I'd like to see git changes in all 3 projects PIPELINE_PROJECT, FOO_PROJECT and BAR_PROJECT under the link workspace/<build_number>/last-changes/.

      However, I see only the change in the first repo PIPELINE_PROJECT. Nevertheless, the links themselves contain right info about commits in all 3 repos. As you can see, all commit ids are different.

      // Last changes from revision f566cf1 to d1e91ab published successfully!
      
      Last changes from revision 5d837fd to 4ea9b64 published successfully!
      
      Last changes from revision 1e840f9 to e53ecf8 published successfully!
      

      This is my Jenkinsfile

       

       

      //node(JENKINS_NODE) {
        try {
          stage('Checkout repos') {
            echo '\n========== Checking out required repositories  ==========\n'
            DEPENDENCY_REPOS = [
              [
                project:           PIPELINE_PROJECT,
                branch:            PIPELINE_BRANCH,
                relativeTargetDir: '.',
              ],
              [
                project:           FOO_PROJECT,
                branch:            FOO_BRANCH,
                relativeTargetDir: 'sync_folders/foo_project',
              ],
              [
                project:           BAR_PROJECT,
                branch:            BAR_BRANCH,
                relativeTargetDir: 'sync_folders/bar_project',
              ],
            ]
      
            GERRIT_URL    = 'gerrit_url'
            GITLAB_URL    = 'gitlab_url'
            CREDENTIALSID = 'id'
      
            for ( repo in DEPENDENCY_REPOS ) {
              repo_name = repo['project'].tokenize('/')[-1]
              repo_settings = [
                $class: 'GitSCM',
                branches: null,
                doGenerateSubmoduleConfigurations: false,
                extensions: [
                    [
                        $class: 'RelativeTargetDirectory',
                        relativeTargetDir: repo['relativeTargetDir']
                    ],
                    [$class: 'WipeWorkspace']
                ],
                submoduleCfg: [],
                userRemoteConfigs: [
                  [
                    credentialsId: CREDENTIALSID
                  ]
                ]
              ]
              if (params.GERRIT_CHANGE_ID && GERRIT_PROJECT.tokenize('/')[-1] == repo_name) {
                // build triggered by Gerrit -> use code from Gerrit
                repo_settings['branches'] = [[name: GERRIT_PATCHSET_REVISION]]
                repo_settings['userRemoteConfigs'][0]['refspec'] = GERRIT_REFSPEC
                repo_settings['userRemoteConfigs'][0]['url'] = "${GERRIT_URL}/${GERRIT_PROJECT}.git"
              } else {
                // build not triggered by Gerrit -> use code from GitLab
                repo_settings['branches'] = [[name: repo['branch']]]
                repo_settings['userRemoteConfigs'][0]['url'] = "${GITLAB_URL}:${repo['project']}.git"
              }
              checkout(repo_settings)
              lastChanges since:'LAST_SUCCESSFUL_BUILD', vcsDir:repo['relativeTargetDir']
            }
          }
        } catch(err) {
          echo "Caught: ${err}"
          currentBuild.result = 'Failure'
        }
      
        // load actual Jenkinsfile from pipeline repo
        load 'Jenkinsfile'
      }
      

       

       

            rmpestano Rafael Pestano
            anastasiiavlaskina Anastasiia Vlaskina
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: